80 lines
2.1 KiB
Plaintext
80 lines
2.1 KiB
Plaintext
|
## <summary>Milter mail filters</summary>
|
||
|
|
||
|
########################################
|
||
|
## <summary>
|
||
|
## Create a set of derived types for various
|
||
|
## mail filter applications using the milter interface.
|
||
|
## </summary>
|
||
|
## <param name="milter_name">
|
||
|
## <summary>
|
||
|
## The name to be used for deriving type names.
|
||
|
## </summary>
|
||
|
## </param>
|
||
|
#
|
||
|
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_type($1_milter_data_t);
|
||
|
|
||
|
allow $1_milter_t self:fifo_file rw_fifo_file_perms;
|
||
|
|
||
|
# Allow communication with MTA over a unix-domain socket
|
||
|
# Note: usage with TCP sockets requires additional policy
|
||
|
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)
|
||
|
|
||
|
miscfiles_read_localization($1_milter_t)
|
||
|
|
||
|
logging_send_syslog_msg($1_milter_t)
|
||
|
')
|
||
|
|
||
|
########################################
|
||
|
## <summary>
|
||
|
## MTA communication with milter sockets
|
||
|
## </summary>
|
||
|
## <param name="domain">
|
||
|
## <summary>
|
||
|
## Domain allowed access.
|
||
|
## </summary>
|
||
|
## </param>
|
||
|
#
|
||
|
interface(`milter_stream_connect_all',`
|
||
|
gen_require(`
|
||
|
attribute milter_data_type, milter_domains;
|
||
|
')
|
||
|
|
||
|
getattr_dirs_pattern($1, milter_data_type, milter_data_type)
|
||
|
stream_connect_pattern($1, milter_data_type, milter_data_type, milter_domains)
|
||
|
')
|
||
|
|
||
|
########################################
|
||
|
## <summary>
|
||
|
## Allow getattr of milter sockets
|
||
|
## </summary>
|
||
|
## <param name="domain">
|
||
|
## <summary>
|
||
|
## Domain allowed access.
|
||
|
## </summary>
|
||
|
## </param>
|
||
|
#
|
||
|
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)
|
||
|
')
|