Chris PeBenito b9e523
## <summary>Milter mail filters</summary>
Chris PeBenito b9e523
Chris PeBenito b9e523
########################################
Chris PeBenito b9e523
## <summary>
Chris PeBenito b9e523
##	Create a set of derived types for various
Chris PeBenito b9e523
##	mail filter applications using the milter interface.
Chris PeBenito b9e523
## </summary>
Chris PeBenito b9e523
## <param name="milter_name">
Chris PeBenito b9e523
##	<summary>
Chris PeBenito b9e523
##	The name to be used for deriving type names.
Chris PeBenito b9e523
##	</summary>
Chris PeBenito b9e523
## </param>
Chris PeBenito b9e523
#
Chris PeBenito b9e523
template(`milter_template',`
Chris PeBenito b9e523
	# attributes common to all milters
Chris PeBenito b9e523
	gen_require(`
Chris PeBenito b9e523
		attribute milter_data_type, milter_domains;
Chris PeBenito b9e523
	')
Chris PeBenito b9e523
Chris PeBenito b9e523
	type $1_milter_t, milter_domains;
Chris PeBenito b9e523
	type $1_milter_exec_t;
Chris PeBenito b9e523
	init_daemon_domain($1_milter_t, $1_milter_exec_t)
Chris PeBenito b9e523
	role system_r types $1_milter_t;
Chris PeBenito b9e523
Chris PeBenito b9e523
	# Type for the milter data (e.g. the socket used to communicate with the MTA)
Chris PeBenito b9e523
	type $1_milter_data_t, milter_data_type;
Chris PeBenito 26410d
	files_type($1_milter_data_t)
Chris PeBenito b9e523
Chris PeBenito b9e523
	allow $1_milter_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito b9e523
Chris PeBenito b9e523
	# Allow communication with MTA over a unix-domain socket
Chris PeBenito b9e523
	# Note: usage with TCP sockets requires additional policy
Chris PeBenito b9e523
	manage_sock_files_pattern($1_milter_t, $1_milter_data_t, $1_milter_data_t)
Chris PeBenito b9e523
Chris PeBenito b9e523
	# Create other data files and directories in the data directory
Chris PeBenito b9e523
	manage_files_pattern($1_milter_t, $1_milter_data_t, $1_milter_data_t)
Chris PeBenito b9e523
Chris PeBenito 0000b7
	files_read_etc_files($1_milter_t)
Chris PeBenito 0000b7
Dan Walsh 3eaa99
	kernel_dontaudit_read_system_state($1_milter_t)
Dan Walsh 3eaa99
Chris PeBenito b9e523
	miscfiles_read_localization($1_milter_t)
Chris PeBenito b9e523
Chris PeBenito b9e523
	logging_send_syslog_msg($1_milter_t)
Chris PeBenito b9e523
')
Chris PeBenito b9e523
Chris PeBenito b9e523
########################################
Chris PeBenito b9e523
## <summary>
Chris PeBenito b9e523
##	MTA communication with milter sockets
Chris PeBenito b9e523
## </summary>
Chris PeBenito b9e523
## <param name="domain">
Chris PeBenito b9e523
##	<summary>
Chris PeBenito b9e523
##	Domain allowed access.
Chris PeBenito b9e523
##	</summary>
Chris PeBenito b9e523
## </param>
Chris PeBenito b9e523
#
Chris PeBenito b9e523
interface(`milter_stream_connect_all',`
Chris PeBenito b9e523
	gen_require(`
Chris PeBenito b9e523
		attribute milter_data_type, milter_domains;
Chris PeBenito b9e523
	')
Chris PeBenito b9e523
Dominick Grift ce8724
	files_search_pids($1)
Chris PeBenito b9e523
	stream_connect_pattern($1, milter_data_type, milter_data_type, milter_domains)
Chris PeBenito b9e523
')
Chris PeBenito b9e523
Chris PeBenito b9e523
########################################
Chris PeBenito b9e523
## <summary>
Chris PeBenito b9e523
##	Allow getattr of milter sockets
Chris PeBenito b9e523
## </summary>
Chris PeBenito b9e523
## <param name="domain">
Chris PeBenito b9e523
##	<summary>
Chris PeBenito b9e523
##	Domain allowed access.
Chris PeBenito b9e523
##	</summary>
Chris PeBenito b9e523
## </param>
Chris PeBenito b9e523
#
Chris PeBenito b9e523
interface(`milter_getattr_all_sockets',`
Chris PeBenito b9e523
	gen_require(`
Chris PeBenito b9e523
		attribute milter_data_type;
Chris PeBenito b9e523
	')
Chris PeBenito b9e523
Chris PeBenito b9e523
	getattr_sock_files_pattern($1, milter_data_type, milter_data_type)
Chris PeBenito b9e523
')
Chris PeBenito 0cf1d5
Chris PeBenito 0cf1d5
########################################
Chris PeBenito 0cf1d5
## <summary>
Dan Walsh 3eaa99
##	Allow setattr of milter dirs
Dan Walsh 3eaa99
## </summary>
Dan Walsh 3eaa99
## <param name="domain">
Dan Walsh 3eaa99
##	<summary>
Dan Walsh 3eaa99
##	Domain allowed access.
Dan Walsh 3eaa99
##	</summary>
Dan Walsh 3eaa99
## </param>
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
interface(`milter_setattr_all_dirs',`
Dan Walsh 3eaa99
	gen_require(`
Dan Walsh 3eaa99
		attribute milter_data_type;
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	setattr_dirs_pattern($1, milter_data_type, milter_data_type)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
## <summary>
Chris PeBenito 0cf1d5
##	Manage spamassassin milter state
Chris PeBenito 0cf1d5
## </summary>
Chris PeBenito 0cf1d5
## <param name="domain">
Chris PeBenito 0cf1d5
##	<summary>
Chris PeBenito 0cf1d5
##	Domain allowed access.
Chris PeBenito 0cf1d5
##	</summary>
Chris PeBenito 0cf1d5
## </param>
Chris PeBenito 0cf1d5
#
Chris PeBenito 0cf1d5
interface(`milter_manage_spamass_state',`
Chris PeBenito 0cf1d5
	gen_require(`
Chris PeBenito 0cf1d5
		type spamass_milter_state_t;
Chris PeBenito 0cf1d5
	')
Chris PeBenito 0cf1d5
Chris PeBenito 0cf1d5
	files_search_var_lib($1)
Chris PeBenito 0cf1d5
	manage_files_pattern($1, spamass_milter_state_t, spamass_milter_state_t)
Chris PeBenito 0cf1d5
	manage_dirs_pattern($1, spamass_milter_state_t, spamass_milter_state_t)
Chris PeBenito 0cf1d5
	manage_lnk_files_pattern($1, spamass_milter_state_t, spamass_milter_state_t)
Chris PeBenito 0cf1d5
')
Dan Walsh dfe675
Dan Walsh dfe675
#######################################
Dan Walsh dfe675
## <summary>
Dominick Grift 1976dd
##	Delete dkim-milter PID files.
Dan Walsh dfe675
## </summary>
Dan Walsh dfe675
## <param name="domain">
Dominick Grift 1976dd
##	<summary>
Dominick Grift 1976dd
##	Domain allowed access.
Dominick Grift 1976dd
##	</summary>
Dan Walsh dfe675
## </param>
Dan Walsh dfe675
#
Dan Walsh dfe675
interface(`milter_delete_dkim_pid_files',`
Dominick Grift 1976dd
	gen_require(`
Dominick Grift 1976dd
		type dkim_milter_data_t;
Dominick Grift 1976dd
	')
Dan Walsh dfe675
Dominick Grift 1976dd
	files_search_pids($1)
Dominick Grift 1976dd
	delete_files_pattern($1, dkim_milter_data_t, dkim_milter_data_t)
Dan Walsh dfe675
')