Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
policy_module(amavis,1.0.0)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
########################################
Chris PeBenito 8a0a99
#
Chris PeBenito 8a0a99
# Declarations
Chris PeBenito 8a0a99
#
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
type amavis_t;
Chris PeBenito 8a0a99
type amavis_exec_t;
Chris PeBenito 8a0a99
domain_type(amavis_t)
Chris PeBenito 8a0a99
init_daemon_domain(amavis_t, amavis_exec_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
# configuration files
Chris PeBenito 8a0a99
type amavis_etc_t;
Chris PeBenito 8a0a99
files_type(amavis_etc_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
# pid files
Chris PeBenito 8a0a99
type amavis_var_run_t;
Chris PeBenito 8a0a99
files_pid_file(amavis_var_run_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
# var/lib files
Chris PeBenito 8a0a99
type amavis_var_lib_t;
Chris PeBenito 8a0a99
files_type(amavis_var_lib_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
# log files
Chris PeBenito 8a0a99
type amavis_var_log_t;
Chris PeBenito 8a0a99
logging_log_file(amavis_var_log_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
# tmp files
Chris PeBenito 8a0a99
type amavis_tmp_t;
Chris PeBenito 8a0a99
files_tmp_file(amavis_tmp_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
# virus quarantine
Chris PeBenito 8a0a99
type amavis_quarantine_t;
Chris PeBenito 8a0a99
files_type(amavis_quarantine_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
########################################
Chris PeBenito 8a0a99
#
Chris PeBenito 8a0a99
# amavis local policy
Chris PeBenito 8a0a99
#
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
allow amavis_t self:capability { chown dac_override setgid setuid };
Chris PeBenito 8a0a99
dontaudit amavis_t self:capability sys_tty_config;
Chris PeBenito 8a0a99
allow amavis_t self:process { signal sigchld signull };
Chris PeBenito 8a0a99
allow amavis_t self:fifo_file rw_file_perms;
Chris PeBenito 8a0a99
allow amavis_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 8a0a99
allow amavis_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 8a0a99
allow amavis_t self:tcp_socket { listen accept };
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
# configuration files
Chris PeBenito 8a0a99
allow amavis_t amavis_etc_t:dir r_dir_perms;
Chris PeBenito 8a0a99
allow amavis_t amavis_etc_t:file r_file_perms;
Chris PeBenito 8a0a99
allow amavis_t amavis_etc_t:lnk_file { getattr read };
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
# mail quarantine
Chris PeBenito 8a0a99
allow amavis_t amavis_quarantine_t:file create_file_perms;
Chris PeBenito 8a0a99
allow amavis_t amavis_quarantine_t:sock_file create_file_perms;
Chris PeBenito 8a0a99
allow amavis_t amavis_quarantine_t:dir create_dir_perms;
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
# tmp files
Chris PeBenito 8a0a99
allow amavis_t amavis_tmp_t:file create_file_perms;
Chris PeBenito 8a0a99
allow amavis_t amavis_tmp_t:dir { rw_dir_perms setattr };
Chris PeBenito 8a0a99
files_tmp_filetrans(amavis_t,amavis_tmp_t,file)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
# var/lib files for amavis
Chris PeBenito 8a0a99
allow amavis_t amavis_var_lib_t:file create_file_perms;
Chris PeBenito 8a0a99
allow amavis_t amavis_var_lib_t:sock_file create_file_perms;
Chris PeBenito 8a0a99
allow amavis_t amavis_var_lib_t:dir create_dir_perms;
Chris PeBenito 8a0a99
files_var_filetrans(amavis_t,amavis_var_lib_t,{ file dir sock_file })
Chris PeBenito 8a0a99
files_var_lib_filetrans(amavis_t,amavis_var_lib_t,file)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
# log files
Chris PeBenito 8a0a99
allow amavis_t amavis_var_log_t:file create_file_perms;
Chris PeBenito 8a0a99
allow amavis_t amavis_var_log_t:sock_file create_file_perms;
Chris PeBenito 8a0a99
allow amavis_t amavis_var_log_t:dir { rw_dir_perms setattr };
Chris PeBenito 8a0a99
logging_log_filetrans(amavis_t,amavis_var_log_t,{ sock_file file dir })
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
# pid file
Chris PeBenito 8a0a99
allow amavis_t amavis_var_run_t:file manage_file_perms;
Chris PeBenito 8a0a99
allow amavis_t amavis_var_run_t:sock_file manage_file_perms;
Chris PeBenito 8a0a99
allow amavis_t amavis_var_run_t:dir rw_dir_perms;
Chris PeBenito 8a0a99
files_pid_filetrans(amavis_t,amavis_var_run_t, { file sock_file })
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
# amavis tries to access /proc/self/stat, /etc/shadow and /root - perl...
Chris PeBenito 8a0a99
kernel_dontaudit_list_proc(amavis_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
# find perl
Chris PeBenito 8a0a99
corecmd_exec_bin(amavis_t)
Chris PeBenito 8a0a99
corecmd_search_sbin(amavis_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
corenet_non_ipsec_sendrecv(amavis_t)
Chris PeBenito 8a0a99
corenet_tcp_sendrecv_all_if(amavis_t)
Chris PeBenito 8a0a99
corenet_tcp_sendrecv_all_nodes(amavis_t)
Chris PeBenito 8a0a99
# amavis uses well-defined ports
Chris PeBenito 8a0a99
corenet_tcp_sendrecv_amavisd_recv_port(amavis_t)
Chris PeBenito 8a0a99
corenet_tcp_sendrecv_amavisd_send_port(amavis_t)
Chris PeBenito 8a0a99
# just the other side not. ;-)
Chris PeBenito 8a0a99
corenet_tcp_sendrecv_all_ports(amavis_t)
Chris PeBenito 8a0a99
# connect to backchannel port
Chris PeBenito 8a0a99
corenet_tcp_connect_amavisd_send_port(amavis_t)
Chris PeBenito 8a0a99
# bind to incoming port
Chris PeBenito 8a0a99
corenet_tcp_bind_amavisd_recv_port(amavis_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
dev_read_rand(amavis_t)
Chris PeBenito 8a0a99
dev_read_urand(amavis_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
domain_use_interactive_fds(amavis_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
files_read_etc_files(amavis_t)
Chris PeBenito 8a0a99
files_read_etc_runtime_files(amavis_t)
Chris PeBenito 8a0a99
files_read_usr_files(amavis_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
auth_dontaudit_read_shadow(amavis_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
init_use_fds(amavis_t)
Chris PeBenito 8a0a99
init_use_script_ptys(amavis_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
libs_use_ld_so(amavis_t)
Chris PeBenito 8a0a99
libs_use_shared_libs(amavis_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
logging_send_syslog_msg(amavis_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
miscfiles_read_localization(amavis_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
sysnet_dns_name_resolve(amavis_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
userdom_dontaudit_search_sysadm_home_dirs(amavis_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
# Cron handling
Chris PeBenito 8a0a99
cron_use_fds(amavis_t)
Chris PeBenito 8a0a99
cron_use_system_job_fds(amavis_t)
Chris PeBenito 8a0a99
cron_rw_pipes(amavis_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
mta_read_config(amavis_t)
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
optional_policy(`clamav',`
Chris PeBenito 8a0a99
	clamav_stream_connect(amavis_t)
Chris PeBenito 8a0a99
')
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
optional_policy(`ldap',`
Chris PeBenito 8a0a99
	ldap_use(amavis_t)
Chris PeBenito 8a0a99
')
Chris PeBenito 8a0a99
Chris PeBenito 8a0a99
optional_policy(`spamassassin',`
Chris PeBenito 8a0a99
	spamassassin_exec(amavis_t)
Chris PeBenito 8a0a99
	spamassassin_exec_client(amavis_t)
Chris PeBenito 8a0a99
')