2006-03-07 21:15:24 +00:00
|
|
|
|
2008-02-18 18:44:40 +00:00
|
|
|
policy_module(amavis,1.5.1)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
|
|
|
type amavis_t;
|
|
|
|
type amavis_exec_t;
|
|
|
|
domain_type(amavis_t)
|
|
|
|
init_daemon_domain(amavis_t, amavis_exec_t)
|
|
|
|
|
|
|
|
# configuration files
|
|
|
|
type amavis_etc_t;
|
|
|
|
files_type(amavis_etc_t)
|
|
|
|
|
|
|
|
# pid files
|
|
|
|
type amavis_var_run_t;
|
|
|
|
files_pid_file(amavis_var_run_t)
|
|
|
|
|
|
|
|
# var/lib files
|
|
|
|
type amavis_var_lib_t;
|
|
|
|
files_type(amavis_var_lib_t)
|
|
|
|
|
|
|
|
# log files
|
|
|
|
type amavis_var_log_t;
|
|
|
|
logging_log_file(amavis_var_log_t)
|
|
|
|
|
|
|
|
# tmp files
|
|
|
|
type amavis_tmp_t;
|
|
|
|
files_tmp_file(amavis_tmp_t)
|
|
|
|
|
|
|
|
# virus quarantine
|
|
|
|
type amavis_quarantine_t;
|
|
|
|
files_type(amavis_quarantine_t)
|
|
|
|
|
2006-05-19 14:02:24 +00:00
|
|
|
type amavis_spool_t;
|
|
|
|
files_type(amavis_spool_t)
|
|
|
|
|
2006-03-07 21:15:24 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# amavis local policy
|
|
|
|
#
|
|
|
|
|
2006-05-19 14:02:24 +00:00
|
|
|
allow amavis_t self:capability { kill chown dac_override setgid setuid };
|
2006-03-07 21:15:24 +00:00
|
|
|
dontaudit amavis_t self:capability sys_tty_config;
|
|
|
|
allow amavis_t self:process { signal sigchld signull };
|
2006-12-12 20:08:08 +00:00
|
|
|
allow amavis_t self:fifo_file rw_fifo_file_perms;
|
2006-03-07 21:15:24 +00:00
|
|
|
allow amavis_t self:unix_stream_socket create_stream_socket_perms;
|
|
|
|
allow amavis_t self:unix_dgram_socket create_socket_perms;
|
|
|
|
allow amavis_t self:tcp_socket { listen accept };
|
2007-04-30 15:19:47 +00:00
|
|
|
allow amavis_t self:netlink_route_socket r_netlink_socket_perms;
|
2006-03-07 21:15:24 +00:00
|
|
|
|
|
|
|
# configuration files
|
2006-12-12 20:08:08 +00:00
|
|
|
allow amavis_t amavis_etc_t:dir list_dir_perms;
|
|
|
|
read_files_pattern(amavis_t,amavis_etc_t,amavis_etc_t)
|
|
|
|
read_lnk_files_pattern(amavis_t,amavis_etc_t,amavis_etc_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
|
|
|
# mail quarantine
|
2006-12-12 20:08:08 +00:00
|
|
|
manage_dirs_pattern(amavis_t,amavis_quarantine_t,amavis_quarantine_t)
|
|
|
|
manage_files_pattern(amavis_t,amavis_quarantine_t,amavis_quarantine_t)
|
|
|
|
manage_sock_files_pattern(amavis_t,amavis_quarantine_t,amavis_quarantine_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
2006-05-19 14:02:24 +00:00
|
|
|
# Spool Files
|
2006-12-12 20:08:08 +00:00
|
|
|
manage_dirs_pattern(amavis_t,amavis_spool_t,amavis_spool_t)
|
|
|
|
manage_files_pattern(amavis_t,amavis_spool_t,amavis_spool_t)
|
2008-02-18 18:44:40 +00:00
|
|
|
manage_lnk_files_pattern(amavis_t, amavis_spool_t, amavis_spool_t)
|
2006-12-12 20:08:08 +00:00
|
|
|
manage_sock_files_pattern(amavis_t,amavis_spool_t,amavis_spool_t)
|
|
|
|
filetrans_pattern(amavis_t,amavis_spool_t,amavis_var_run_t,sock_file)
|
2006-08-29 02:41:00 +00:00
|
|
|
files_search_spool(amavis_t)
|
2006-05-19 14:02:24 +00:00
|
|
|
|
2006-03-07 21:15:24 +00:00
|
|
|
# tmp files
|
2006-12-12 20:08:08 +00:00
|
|
|
manage_files_pattern(amavis_t,amavis_tmp_t,amavis_tmp_t)
|
|
|
|
allow amavis_t amavis_tmp_t:dir setattr;
|
2006-03-07 21:15:24 +00:00
|
|
|
files_tmp_filetrans(amavis_t,amavis_tmp_t,file)
|
|
|
|
|
|
|
|
# var/lib files for amavis
|
2006-12-12 20:08:08 +00:00
|
|
|
manage_dirs_pattern(amavis_t,amavis_var_lib_t,amavis_var_lib_t)
|
|
|
|
manage_files_pattern(amavis_t,amavis_var_lib_t,amavis_var_lib_t)
|
|
|
|
manage_sock_files_pattern(amavis_t,amavis_var_lib_t,amavis_var_lib_t)
|
2007-04-30 15:19:47 +00:00
|
|
|
files_search_var_lib(amavis_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
|
|
|
# log files
|
2006-12-12 20:08:08 +00:00
|
|
|
allow amavis_t amavis_var_log_t:dir setattr;
|
|
|
|
manage_files_pattern(amavis_t,amavis_var_log_t,amavis_var_log_t)
|
|
|
|
manage_sock_files_pattern(amavis_t,amavis_var_log_t,amavis_var_log_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
logging_log_filetrans(amavis_t,amavis_var_log_t,{ sock_file file dir })
|
|
|
|
|
|
|
|
# pid file
|
2006-12-12 20:08:08 +00:00
|
|
|
manage_files_pattern(amavis_t,amavis_var_run_t,amavis_var_run_t)
|
|
|
|
manage_sock_files_pattern(amavis_t,amavis_var_run_t,amavis_var_run_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
files_pid_filetrans(amavis_t,amavis_var_run_t, { file sock_file })
|
|
|
|
|
2006-05-19 14:02:24 +00:00
|
|
|
kernel_read_kernel_sysctls(amavis_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
# amavis tries to access /proc/self/stat, /etc/shadow and /root - perl...
|
|
|
|
kernel_dontaudit_list_proc(amavis_t)
|
2006-06-07 17:43:10 +00:00
|
|
|
kernel_dontaudit_read_proc_symlinks(amavis_t)
|
2006-05-19 14:02:24 +00:00
|
|
|
kernel_dontaudit_read_system_state(amavis_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
|
|
|
# find perl
|
|
|
|
corecmd_exec_bin(amavis_t)
|
|
|
|
|
2007-06-27 15:23:21 +00:00
|
|
|
corenet_all_recvfrom_unlabeled(amavis_t)
|
|
|
|
corenet_all_recvfrom_netlabel(amavis_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
corenet_tcp_sendrecv_all_if(amavis_t)
|
|
|
|
corenet_tcp_sendrecv_all_nodes(amavis_t)
|
2006-06-07 17:43:10 +00:00
|
|
|
corenet_tcp_bind_all_nodes(amavis_t)
|
|
|
|
corenet_udp_bind_all_nodes(amavis_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
# amavis uses well-defined ports
|
|
|
|
corenet_tcp_sendrecv_amavisd_recv_port(amavis_t)
|
|
|
|
corenet_tcp_sendrecv_amavisd_send_port(amavis_t)
|
|
|
|
# just the other side not. ;-)
|
|
|
|
corenet_tcp_sendrecv_all_ports(amavis_t)
|
|
|
|
# connect to backchannel port
|
|
|
|
corenet_tcp_connect_amavisd_send_port(amavis_t)
|
|
|
|
# bind to incoming port
|
|
|
|
corenet_tcp_bind_amavisd_recv_port(amavis_t)
|
2006-06-07 17:43:10 +00:00
|
|
|
corenet_udp_bind_generic_port(amavis_t)
|
2008-02-18 18:44:40 +00:00
|
|
|
corenet_dontaudit_udp_bind_all_ports(amavis_t)
|
2006-08-29 02:41:00 +00:00
|
|
|
corenet_tcp_connect_razor_port(amavis_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
|
|
|
dev_read_rand(amavis_t)
|
|
|
|
dev_read_urand(amavis_t)
|
|
|
|
|
|
|
|
domain_use_interactive_fds(amavis_t)
|
|
|
|
|
|
|
|
files_read_etc_files(amavis_t)
|
|
|
|
files_read_etc_runtime_files(amavis_t)
|
|
|
|
files_read_usr_files(amavis_t)
|
|
|
|
|
|
|
|
auth_dontaudit_read_shadow(amavis_t)
|
|
|
|
|
2006-05-19 14:02:24 +00:00
|
|
|
init_stream_connect_script(amavis_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
|
|
|
libs_use_ld_so(amavis_t)
|
|
|
|
libs_use_shared_libs(amavis_t)
|
|
|
|
|
|
|
|
logging_send_syslog_msg(amavis_t)
|
|
|
|
|
|
|
|
miscfiles_read_localization(amavis_t)
|
|
|
|
|
|
|
|
sysnet_dns_name_resolve(amavis_t)
|
2006-09-04 18:22:12 +00:00
|
|
|
sysnet_use_ldap(amavis_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
|
|
|
userdom_dontaudit_search_sysadm_home_dirs(amavis_t)
|
|
|
|
|
|
|
|
# Cron handling
|
|
|
|
cron_use_fds(amavis_t)
|
|
|
|
cron_use_system_job_fds(amavis_t)
|
|
|
|
cron_rw_pipes(amavis_t)
|
|
|
|
|
|
|
|
mta_read_config(amavis_t)
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-03-07 21:15:24 +00:00
|
|
|
clamav_stream_connect(amavis_t)
|
2006-05-19 14:02:24 +00:00
|
|
|
clamav_domtrans_clamscan(amavis_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
')
|
|
|
|
|
2006-05-04 17:44:26 +00:00
|
|
|
optional_policy(`
|
|
|
|
dcc_domtrans_client(amavis_t)
|
|
|
|
dcc_stream_connect_dccifd(amavis_t)
|
|
|
|
')
|
|
|
|
|
2006-08-29 02:41:00 +00:00
|
|
|
optional_policy(`
|
|
|
|
postfix_read_config(amavis_t)
|
|
|
|
')
|
|
|
|
|
2006-05-03 19:58:01 +00:00
|
|
|
optional_policy(`
|
|
|
|
pyzor_domtrans(amavis_t)
|
2007-08-27 17:57:36 +00:00
|
|
|
pyzor_signal(amavis_t)
|
2006-05-03 19:58:01 +00:00
|
|
|
')
|
|
|
|
|
2006-05-05 19:26:50 +00:00
|
|
|
optional_policy(`
|
|
|
|
razor_domtrans(amavis_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-03-07 21:15:24 +00:00
|
|
|
spamassassin_exec(amavis_t)
|
|
|
|
spamassassin_exec_client(amavis_t)
|
2007-04-30 15:19:47 +00:00
|
|
|
spamassassin_read_lib_files(amavis_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
')
|