2005-05-02 19:24:29 +00:00
|
|
|
|
2006-05-26 20:29:51 +00:00
|
|
|
policy_module(mta,1.3.5)
|
2005-05-02 19:24:29 +00:00
|
|
|
|
2005-05-12 20:50:09 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
2005-08-30 20:47:41 +00:00
|
|
|
attribute mta_user_agent;
|
|
|
|
attribute mailserver_delivery;
|
|
|
|
attribute mailserver_domain;
|
|
|
|
attribute mailserver_sender;
|
|
|
|
|
2005-10-23 20:18:36 +00:00
|
|
|
attribute user_mail_domain;
|
|
|
|
|
2005-05-02 19:24:29 +00:00
|
|
|
type etc_aliases_t;
|
2005-06-29 14:26:41 +00:00
|
|
|
files_type(etc_aliases_t)
|
2005-05-02 19:24:29 +00:00
|
|
|
|
|
|
|
type etc_mail_t;
|
2005-10-24 18:40:24 +00:00
|
|
|
files_config_file(etc_mail_t)
|
2005-05-02 19:24:29 +00:00
|
|
|
|
|
|
|
type mqueue_spool_t;
|
2005-06-29 14:26:41 +00:00
|
|
|
files_type(mqueue_spool_t)
|
2005-05-02 19:24:29 +00:00
|
|
|
|
|
|
|
type mail_spool_t;
|
2005-06-29 14:26:41 +00:00
|
|
|
files_type(mail_spool_t)
|
2005-05-12 20:50:09 +00:00
|
|
|
|
|
|
|
type sendmail_exec_t;
|
2005-06-29 14:26:41 +00:00
|
|
|
files_type(sendmail_exec_t)
|
2005-05-12 20:50:09 +00:00
|
|
|
|
2005-11-28 20:25:36 +00:00
|
|
|
mta_base_mail_template(system)
|
2005-05-12 20:50:09 +00:00
|
|
|
role system_r types system_mail_t;
|
|
|
|
|
2005-10-18 18:25:33 +00:00
|
|
|
# cjp: need to resolve this, but require{}
|
|
|
|
# does not work in the else part of the optional
|
2005-11-28 20:25:36 +00:00
|
|
|
#ifdef(`strict_policy',`
|
2006-03-24 16:13:54 +00:00
|
|
|
# optional_policy(`',`
|
2005-10-18 18:25:33 +00:00
|
|
|
# init_system_domain(system_mail_t,sendmail_exec_t)
|
|
|
|
# ')
|
|
|
|
#')
|
2005-05-13 14:37:13 +00:00
|
|
|
|
2005-05-12 20:50:09 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# System mail local policy
|
|
|
|
#
|
|
|
|
|
2006-02-16 19:32:13 +00:00
|
|
|
# newalias required this, not sure if it is needed in 'if' file
|
|
|
|
allow system_mail_t self:capability { dac_override };
|
|
|
|
|
2005-10-26 18:31:09 +00:00
|
|
|
allow system_mail_t etc_mail_t:dir { getattr search };
|
2005-10-25 20:27:08 +00:00
|
|
|
allow system_mail_t etc_mail_t:file r_file_perms;
|
|
|
|
|
2005-05-12 20:50:09 +00:00
|
|
|
kernel_read_system_state(system_mail_t)
|
|
|
|
kernel_read_network_state(system_mail_t)
|
|
|
|
|
2005-09-15 21:03:29 +00:00
|
|
|
dev_read_rand(system_mail_t)
|
2005-06-13 16:22:32 +00:00
|
|
|
dev_read_urand(system_mail_t)
|
2005-05-12 20:50:09 +00:00
|
|
|
|
2006-01-17 17:50:10 +00:00
|
|
|
fs_read_eventpollfs(system_mail_t)
|
|
|
|
|
2006-02-02 21:08:12 +00:00
|
|
|
init_use_script_ptys(system_mail_t)
|
2005-05-12 20:50:09 +00:00
|
|
|
|
2005-08-30 20:47:41 +00:00
|
|
|
userdom_use_sysadm_terms(system_mail_t)
|
|
|
|
|
|
|
|
ifdef(`targeted_policy',`
|
2005-10-14 18:42:42 +00:00
|
|
|
typealias system_mail_t alias sysadm_mail_t;
|
|
|
|
|
2005-08-30 20:47:41 +00:00
|
|
|
allow system_mail_t mail_spool_t:dir create_dir_perms;
|
|
|
|
allow system_mail_t mail_spool_t:file create_file_perms;
|
|
|
|
allow system_mail_t mail_spool_t:lnk_file create_lnk_perms;
|
|
|
|
allow system_mail_t mail_spool_t:fifo_file rw_file_perms;
|
|
|
|
|
|
|
|
allow system_mail_t mqueue_spool_t:dir create_dir_perms;
|
|
|
|
allow system_mail_t mqueue_spool_t:file create_file_perms;
|
|
|
|
allow system_mail_t mqueue_spool_t:lnk_file create_lnk_perms;
|
|
|
|
|
2005-10-25 00:00:50 +00:00
|
|
|
# for reading .forward - maybe we need a new type for it?
|
|
|
|
# also for delivering mail to maildir
|
|
|
|
# cjp: fix this to generic_user interfaces
|
2006-02-21 18:40:44 +00:00
|
|
|
userdom_manage_user_home_content_dirs(user,mailserver_delivery)
|
|
|
|
userdom_manage_generic_user_home_content_files(mailserver_delivery)
|
|
|
|
userdom_manage_generic_user_home_content_symlinks(mailserver_delivery)
|
|
|
|
userdom_manage_generic_user_home_content_sockets(mailserver_delivery)
|
|
|
|
userdom_manage_generic_user_home_content_pipes(mailserver_delivery)
|
|
|
|
userdom_generic_user_home_dir_filetrans_generic_user_home_content(mailserver_delivery,{ dir file lnk_file sock_file fifo_file })
|
2005-10-25 00:00:50 +00:00
|
|
|
|
2005-10-19 16:44:24 +00:00
|
|
|
# cjp: another require-in-else to resolve
|
2006-03-24 16:13:54 +00:00
|
|
|
# optional_policy(`',`
|
2006-04-19 21:43:02 +00:00
|
|
|
corecmd_exec_all_executables(system_mail_t)
|
2005-08-30 20:47:41 +00:00
|
|
|
|
|
|
|
files_exec_etc_files(system_mail_t)
|
|
|
|
|
|
|
|
libs_exec_ld_so(system_mail_t)
|
|
|
|
libs_exec_lib_files(system_mail_t)
|
2005-10-19 16:44:24 +00:00
|
|
|
# ')
|
2005-08-30 20:47:41 +00:00
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-10-17 17:55:38 +00:00
|
|
|
apache_read_squirrelmail_data(system_mail_t)
|
|
|
|
apache_append_squirrelmail_data(system_mail_t)
|
|
|
|
|
|
|
|
# apache should set close-on-exec
|
|
|
|
apache_dontaudit_append_log(system_mail_t)
|
2006-02-02 21:08:12 +00:00
|
|
|
apache_dontaudit_rw_stream_sockets(system_mail_t)
|
|
|
|
apache_dontaudit_rw_tcp_sockets(system_mail_t)
|
|
|
|
apache_dontaudit_rw_sys_script_stream_sockets(system_mail_t)
|
2005-10-17 17:55:38 +00:00
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-11-28 22:19:08 +00:00
|
|
|
arpwatch_manage_tmp_files(system_mail_t)
|
|
|
|
|
|
|
|
ifdef(`hide_broken_symptoms', `
|
2006-02-02 21:08:12 +00:00
|
|
|
arpwatch_dontaudit_rw_packet_sockets(system_mail_t)
|
2005-11-28 22:19:08 +00:00
|
|
|
')
|
2005-10-25 20:27:08 +00:00
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-08-30 20:47:41 +00:00
|
|
|
cron_read_system_job_tmp_files(system_mail_t)
|
2006-02-02 21:08:12 +00:00
|
|
|
cron_dontaudit_write_pipes(system_mail_t)
|
2005-08-30 20:47:41 +00:00
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-09-20 18:49:13 +00:00
|
|
|
cvs_read_data(system_mail_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-08-30 20:47:41 +00:00
|
|
|
logrotate_read_tmp_files(system_mail_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-01-10 14:39:21 +00:00
|
|
|
logwatch_read_tmp_files(system_mail_t)
|
|
|
|
')
|
|
|
|
|
2006-04-06 15:03:23 +00:00
|
|
|
optional_policy(`
|
|
|
|
nagios_read_tmp_files(system_mail_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-10-23 20:18:36 +00:00
|
|
|
allow system_mail_t etc_aliases_t:dir create_dir_perms;
|
|
|
|
allow system_mail_t etc_aliases_t:file create_file_perms;
|
|
|
|
allow system_mail_t etc_aliases_t:lnk_file create_lnk_perms;
|
|
|
|
allow system_mail_t etc_aliases_t:sock_file create_file_perms;
|
|
|
|
allow system_mail_t etc_aliases_t:fifo_file create_file_perms;
|
2006-02-21 18:40:44 +00:00
|
|
|
files_etc_filetrans(system_mail_t,etc_aliases_t,{ file lnk_file sock_file fifo_file })
|
2005-10-23 20:18:36 +00:00
|
|
|
|
2006-02-20 21:33:25 +00:00
|
|
|
domain_use_interactive_fds(system_mail_t)
|
2005-11-09 15:51:22 +00:00
|
|
|
|
2005-11-28 22:19:08 +00:00
|
|
|
# postfix needs this for newaliases
|
2006-01-31 19:21:01 +00:00
|
|
|
files_getattr_tmp_dirs(system_mail_t)
|
2005-11-08 22:00:30 +00:00
|
|
|
|
2005-11-28 22:19:08 +00:00
|
|
|
postfix_exec_master(system_mail_t)
|
2006-02-13 22:05:08 +00:00
|
|
|
postfix_read_config(system_mail_t)
|
|
|
|
postfix_search_spool(system_mail_t)
|
2005-05-13 14:37:13 +00:00
|
|
|
|
2005-11-28 22:19:08 +00:00
|
|
|
ifdef(`distro_redhat',`
|
|
|
|
# compatability for old default main.cf
|
2006-02-21 18:40:44 +00:00
|
|
|
postfix_config_filetrans(system_mail_t,etc_aliases_t,{ dir file lnk_file sock_file fifo_file })
|
2005-11-28 22:19:08 +00:00
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-02-20 14:31:45 +00:00
|
|
|
cron_rw_tcp_sockets(system_mail_t)
|
2005-11-28 22:19:08 +00:00
|
|
|
')
|
2005-08-30 20:47:41 +00:00
|
|
|
')
|
|
|
|
|
2006-04-05 15:32:38 +00:00
|
|
|
optional_policy(`
|
|
|
|
qmail_domtrans_inject(system_mail_t)
|
|
|
|
')
|
|
|
|
|
2006-05-01 20:36:13 +00:00
|
|
|
optional_policy(`
|
|
|
|
sxid_read_log(system_mail_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-02-02 21:08:12 +00:00
|
|
|
userdom_dontaudit_use_unpriv_users_ptys(system_mail_t)
|
2005-07-13 18:29:08 +00:00
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-11-28 22:19:08 +00:00
|
|
|
cron_dontaudit_append_system_job_tmp_files(system_mail_t)
|
2005-07-13 18:29:08 +00:00
|
|
|
')
|
2005-05-13 14:37:13 +00:00
|
|
|
')
|
2005-05-12 20:50:09 +00:00
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-02-02 21:08:12 +00:00
|
|
|
smartmon_read_tmp_files(system_mail_t)
|
2006-01-04 15:26:42 +00:00
|
|
|
')
|
|
|
|
|
2005-11-28 22:19:08 +00:00
|
|
|
# should break this up among sections:
|
2005-11-08 22:00:30 +00:00
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-10-10 18:11:46 +00:00
|
|
|
# why is mail delivered to a directory of type arpwatch_data_t?
|
2005-11-08 22:00:30 +00:00
|
|
|
arpwatch_search_data(mailserver_delivery)
|
2005-10-10 18:11:46 +00:00
|
|
|
arpwatch_manage_tmp_files(mta_user_agent)
|
|
|
|
ifdef(`hide_broken_symptoms', `
|
2006-02-02 21:08:12 +00:00
|
|
|
arpwatch_dontaudit_rw_packet_sockets(mta_user_agent)
|
2005-10-10 18:11:46 +00:00
|
|
|
')
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-11-28 22:19:08 +00:00
|
|
|
cron_read_system_job_tmp_files(mta_user_agent)
|
|
|
|
')
|
2005-10-10 18:11:46 +00:00
|
|
|
')
|
2006-01-11 15:28:14 +00:00
|
|
|
|
|
|
|
ifdef(`TODO',`
|
|
|
|
# for the start script to run make -C /etc/mail
|
|
|
|
allow initrc_t etc_mail_t:dir rw_dir_perms;
|
|
|
|
allow initrc_t etc_mail_t:file create_file_perms;
|
|
|
|
')
|