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