## Milter mail filters
########################################
##
## Create a set of derived types for various
## mail filter applications using the milter interface.
##
##
##
## The name to be used for deriving type names.
##
##
#
template(`milter_template',`
# attributes common to all milters
gen_require(`
attribute milter_data_type, milter_domains;
')
type $1_milter_t, milter_domains;
type $1_milter_exec_t;
init_daemon_domain($1_milter_t, $1_milter_exec_t)
role system_r types $1_milter_t;
# Type for the milter data (e.g. the socket used to communicate with the MTA)
type $1_milter_data_t, milter_data_type;
files_pid_file($1_milter_data_t)
# Allow communication with MTA over a unix-domain socket
manage_sock_files_pattern($1_milter_t, $1_milter_data_t, $1_milter_data_t)
# Create other data files and directories in the data directory
manage_files_pattern($1_milter_t, $1_milter_data_t, $1_milter_data_t)
logging_send_syslog_msg($1_milter_t)
')
########################################
##
## MTA communication with milter sockets
##
##
##
## Domain allowed access.
##
##
#
interface(`milter_stream_connect_all',`
gen_require(`
attribute milter_data_type, milter_domains;
')
files_search_pids($1)
getattr_dirs_pattern($1, milter_data_type, milter_data_type)
stream_connect_pattern($1, milter_data_type, milter_data_type, milter_domains)
')
########################################
##
## Allow getattr of milter sockets
##
##
##
## Domain allowed access.
##
##
#
interface(`milter_getattr_all_sockets',`
gen_require(`
attribute milter_data_type;
')
getattr_dirs_pattern($1, milter_data_type, milter_data_type)
getattr_sock_files_pattern($1, milter_data_type, milter_data_type)
')
########################################
##
## Allow setattr of milter dirs
##
##
##
## Domain allowed access.
##
##
#
interface(`milter_setattr_all_dirs',`
gen_require(`
attribute milter_data_type;
')
setattr_dirs_pattern($1, milter_data_type, milter_data_type)
')
########################################
##
## Manage spamassassin milter state
##
##
##
## Domain allowed access.
##
##
#
interface(`milter_manage_spamass_state',`
gen_require(`
type spamass_milter_state_t;
')
files_search_var_lib($1)
manage_files_pattern($1, spamass_milter_state_t, spamass_milter_state_t)
manage_dirs_pattern($1, spamass_milter_state_t, spamass_milter_state_t)
manage_lnk_files_pattern($1, spamass_milter_state_t, spamass_milter_state_t)
')
#######################################
##
## Delete dkim-milter PID files.
##
##
##
## Domain allowed access.
##
##
#
interface(`milter_delete_dkim_pid_files',`
gen_require(`
type dkim_milter_data_t;
')
files_search_pids($1)
delete_files_pattern($1, dkim_milter_data_t, dkim_milter_data_t)
')