2005-05-16 21:11:26 +00:00
|
|
|
|
|
|
|
policy_module(sendmail,1.0)
|
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
|
|
|
type sendmail_t; # , nscd_client_domain, mta_delivery_agent, mail_server_sender', nosysadm)
|
2005-06-13 17:35:46 +00:00
|
|
|
mta_sendmail_mailserver(sendmail_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
|
|
|
|
type sendmail_log_t;
|
2005-06-13 17:35:46 +00:00
|
|
|
logging_log_file(sendmail_log_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
|
|
|
|
type sendmail_tmp_t;
|
2005-06-13 17:35:46 +00:00
|
|
|
files_tmp_file(sendmail_tmp_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
|
|
|
|
type sendmail_var_run_t;
|
2005-06-13 17:35:46 +00:00
|
|
|
files_pid_file(sendmail_var_run_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Sendmail local policy
|
|
|
|
#
|
|
|
|
|
|
|
|
allow sendmail_t self:capability { setuid setgid net_bind_service sys_nice chown sys_tty_config };
|
2005-06-09 15:32:23 +00:00
|
|
|
allow sendmail_t self:fifo_file rw_file_perms;
|
|
|
|
allow sendmail_t self:unix_stream_socket create_stream_socket_perms;
|
|
|
|
allow sendmail_t self:unix_dgram_socket create_socket_perms;
|
2005-05-16 21:11:26 +00:00
|
|
|
|
2005-06-09 15:32:23 +00:00
|
|
|
allow sendmail_t sendmail_log_t:file create_file_perms;
|
|
|
|
allow sendmail_t sendmail_log_t:dir { rw_dir_perms setattr };
|
2005-06-13 17:35:46 +00:00
|
|
|
logging_create_log(sendmail_t,sendmail_log_t,{ file dir })
|
2005-05-16 21:11:26 +00:00
|
|
|
|
2005-06-09 15:32:23 +00:00
|
|
|
allow sendmail_t sendmail_tmp_t:dir create_dir_perms;
|
|
|
|
allow sendmail_t sendmail_tmp_t:file create_file_perms;
|
2005-06-13 17:35:46 +00:00
|
|
|
files_create_tmp_files(sendmail_t, sendmail_tmp_t, { file dir })
|
2005-05-16 21:11:26 +00:00
|
|
|
|
|
|
|
allow sendmail_t sendmail_var_run_t:file { getattr create read write append setattr unlink };
|
2005-06-13 17:35:46 +00:00
|
|
|
files_create_pid(sendmail_t,sendmail_var_run_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
|
|
|
|
kernel_read_kernel_sysctl(sendmail_t)
|
2005-06-14 19:56:46 +00:00
|
|
|
dev_read_sysfs(sendmail_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
corenet_tcp_sendrecv_all_if(sendmail_t)
|
|
|
|
corenet_raw_sendrecv_all_if(sendmail_t)
|
|
|
|
corenet_udp_sendrecv_all_if(sendmail_t)
|
|
|
|
corenet_tcp_sendrecv_all_nodes(sendmail_t)
|
|
|
|
corenet_raw_sendrecv_all_nodes(sendmail_t)
|
|
|
|
corenet_udp_sendrecv_all_nodes(sendmail_t)
|
|
|
|
corenet_tcp_sendrecv_all_ports(sendmail_t)
|
|
|
|
corenet_udp_sendrecv_all_ports(sendmail_t)
|
|
|
|
corenet_tcp_bind_all_nodes(sendmail_t)
|
|
|
|
corenet_udp_bind_all_nodes(sendmail_t)
|
|
|
|
corenet_tcp_bind_smtp_port(sendmail_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
|
2005-06-13 16:22:32 +00:00
|
|
|
dev_read_urand(sendmail_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
fs_getattr_all_fs(sendmail_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
term_dontaudit_use_console(sendmail_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
init_use_fd(sendmail_t)
|
|
|
|
init_use_script_pty(sendmail_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
# sendmail wants to read /var/run/utmp if the controlling tty is /dev/console
|
2005-06-13 17:35:46 +00:00
|
|
|
init_read_script_pid(sendmail_t)
|
|
|
|
init_dontaudit_write_script_pid(sendmail_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
domain_use_wide_inherit_fd(sendmail_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
files_read_generic_etc_files(sendmail_t)
|
|
|
|
files_search_spool(sendmail_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
logging_send_syslog_msg(sendmail_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
libs_use_ld_so(sendmail_t)
|
|
|
|
libs_use_shared_libs(sendmail_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
# Read /usr/lib/sasl2/.*
|
2005-06-13 17:35:46 +00:00
|
|
|
libs_read_lib(sendmail_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
|
|
|
|
miscfiles_read_localization(sendmail_t)
|
|
|
|
|
|
|
|
# Write to /etc/aliases and /etc/mail.
|
2005-06-13 17:35:46 +00:00
|
|
|
mta_rw_aliases(sendmail_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
# Write to /var/spool/mail and /var/spool/mqueue.
|
2005-06-13 17:35:46 +00:00
|
|
|
mta_manage_queue(sendmail_t)
|
|
|
|
mta_manage_spool(sendmail_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
sysnet_read_config(sendmail_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
|
2005-06-08 13:12:00 +00:00
|
|
|
ifdef(`targeted_policy', `
|
2005-06-10 01:01:13 +00:00
|
|
|
term_dontaudit_use_unallocated_tty(sendmail_t)
|
2005-06-13 20:27:32 +00:00
|
|
|
term_dontaudit_use_generic_pty(sendmail_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
files_dontaudit_read_root_file(sendmail_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
optional_policy(`selinux.te',`
|
2005-06-14 20:48:34 +00:00
|
|
|
seutil_newrole_sigchld(sendmail_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
optional_policy(`udev.te', `
|
2005-06-13 17:35:46 +00:00
|
|
|
udev_read_db(sendmail_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
ifdef(`TODO',`
|
|
|
|
|
|
|
|
optional_policy(`rhgb.te', `
|
|
|
|
allow sendmail_t rhgb_t:process sigchld;
|
|
|
|
allow sendmail_t rhgb_t:fd use;
|
|
|
|
allow sendmail_t rhgb_t:fifo_file { read write };
|
|
|
|
')
|
|
|
|
allow sendmail_t proc_t:dir r_dir_perms;
|
|
|
|
allow sendmail_t proc_t:lnk_file read;
|
|
|
|
dontaudit sendmail_t unpriv_userdomain:fd use;
|
|
|
|
allow sendmail_t autofs_t:dir { search getattr };
|
|
|
|
dontaudit sendmail_t sysadm_home_dir_t:dir search;
|
|
|
|
|
|
|
|
can_ypbind(sendmail_t)
|
|
|
|
|
|
|
|
#
|
|
|
|
# Need this transition to create /etc/aliases.db
|
|
|
|
#
|
|
|
|
ifdef(`distro_redhat', `
|
|
|
|
ifdef(`rpm.te', `
|
|
|
|
domain_auto_trans(rpm_script_t, sendmail_exec_t, system_mail_t)
|
|
|
|
')
|
|
|
|
')
|
|
|
|
|
|
|
|
allow sendmail_t etc_mail_t:dir rw_dir_perms;
|
|
|
|
allow sendmail_t etc_mail_t:file create_file_perms;
|
|
|
|
# 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;
|
|
|
|
allow system_mail_t initrc_t:fd use;
|
|
|
|
allow system_mail_t initrc_t:fifo_file write;
|
|
|
|
|
|
|
|
# When sendmail runs as user_mail_domain, it needs some extra permissions
|
|
|
|
# to update /etc/mail/statistics.
|
|
|
|
allow user_mail_domain etc_mail_t:file rw_file_perms;
|
|
|
|
|
|
|
|
# Silently deny attempts to access /root.
|
|
|
|
dontaudit system_mail_t { staff_home_dir_t sysadm_home_dir_t}:dir { getattr search };
|
|
|
|
|
|
|
|
# Run procmail in its own domain, if defined.
|
|
|
|
ifdef(`procmail.te',`
|
2005-06-13 17:35:46 +00:00
|
|
|
corecmd_search_bin(sendmail_t)
|
2005-05-16 21:11:26 +00:00
|
|
|
procmail_transition(sendmail_t)
|
|
|
|
domain_auto_trans(system_mail_t, procmail_exec_t, procmail_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
dontaudit sendmail_t admin_tty_type:chr_file { getattr ioctl };
|
|
|
|
') dnl end TODO
|