|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
policy_module(sendmail,1.0)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
########################################
|
|
Chris PeBenito |
650e75 |
#
|
|
Chris PeBenito |
650e75 |
# Declarations
|
|
Chris PeBenito |
650e75 |
#
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
246839 |
type sendmail_t;
|
|
Chris PeBenito |
c9428d |
mta_sendmail_mailserver(sendmail_t)
|
|
Chris PeBenito |
246839 |
mta_mailserver_delivery(sendmail_t)
|
|
Chris PeBenito |
246839 |
mta_mailserver_sender(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
type sendmail_log_t;
|
|
Chris PeBenito |
c9428d |
logging_log_file(sendmail_log_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
type sendmail_tmp_t;
|
|
Chris PeBenito |
c9428d |
files_tmp_file(sendmail_tmp_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
type sendmail_var_run_t;
|
|
Chris PeBenito |
c9428d |
files_pid_file(sendmail_var_run_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
########################################
|
|
Chris PeBenito |
650e75 |
#
|
|
Chris PeBenito |
650e75 |
# Sendmail local policy
|
|
Chris PeBenito |
650e75 |
#
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
allow sendmail_t self:capability { setuid setgid net_bind_service sys_nice chown sys_tty_config };
|
|
Chris PeBenito |
0a10b1 |
allow sendmail_t self:fifo_file rw_file_perms;
|
|
Chris PeBenito |
0a10b1 |
allow sendmail_t self:unix_stream_socket create_stream_socket_perms;
|
|
Chris PeBenito |
0a10b1 |
allow sendmail_t self:unix_dgram_socket create_socket_perms;
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
0a10b1 |
allow sendmail_t sendmail_log_t:file create_file_perms;
|
|
Chris PeBenito |
0a10b1 |
allow sendmail_t sendmail_log_t:dir { rw_dir_perms setattr };
|
|
Chris PeBenito |
c9428d |
logging_create_log(sendmail_t,sendmail_log_t,{ file dir })
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
0a10b1 |
allow sendmail_t sendmail_tmp_t:dir create_dir_perms;
|
|
Chris PeBenito |
0a10b1 |
allow sendmail_t sendmail_tmp_t:file create_file_perms;
|
|
Chris PeBenito |
c9428d |
files_create_tmp_files(sendmail_t, sendmail_tmp_t, { file dir })
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
allow sendmail_t sendmail_var_run_t:file { getattr create read write append setattr unlink };
|
|
Chris PeBenito |
c9428d |
files_create_pid(sendmail_t,sendmail_var_run_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
kernel_read_kernel_sysctl(sendmail_t)
|
|
Chris PeBenito |
246839 |
# for piping mail to a command
|
|
Chris PeBenito |
246839 |
kernel_read_system_state(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
0fd9dc |
corenet_tcp_sendrecv_all_if(sendmail_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_raw_sendrecv_all_if(sendmail_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_udp_sendrecv_all_if(sendmail_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_tcp_sendrecv_all_nodes(sendmail_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_raw_sendrecv_all_nodes(sendmail_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_udp_sendrecv_all_nodes(sendmail_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_tcp_sendrecv_all_ports(sendmail_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_udp_sendrecv_all_ports(sendmail_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_tcp_bind_all_nodes(sendmail_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_udp_bind_all_nodes(sendmail_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_tcp_bind_smtp_port(sendmail_t)
|
|
Chris PeBenito |
2705f9 |
corenet_tcp_connect_all_ports(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Karl MacMillan |
f0c985 |
dev_read_urand(sendmail_t)
|
|
Chris PeBenito |
b24f35 |
dev_read_sysfs(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
0fd9dc |
fs_getattr_all_fs(sendmail_t)
|
|
Chris PeBenito |
ab940a |
fs_search_auto_mountpoints(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
0fd9dc |
term_dontaudit_use_console(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
246839 |
# for piping mail to a command
|
|
Chris PeBenito |
246839 |
corecmd_exec_shell(sendmail_t)
|
|
Chris PeBenito |
246839 |
|
|
Chris PeBenito |
c9428d |
domain_use_wide_inherit_fd(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
8fd367 |
files_read_etc_files(sendmail_t)
|
|
Chris PeBenito |
c9428d |
files_search_spool(sendmail_t)
|
|
Chris PeBenito |
246839 |
# for piping mail to a command
|
|
Chris PeBenito |
246839 |
files_read_etc_runtime_files(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
ab940a |
init_use_fd(sendmail_t)
|
|
Chris PeBenito |
ab940a |
init_use_script_pty(sendmail_t)
|
|
Chris PeBenito |
ab940a |
# sendmail wants to read /var/run/utmp if the controlling tty is /dev/console
|
|
Chris PeBenito |
ab940a |
init_read_script_pid(sendmail_t)
|
|
Chris PeBenito |
ab940a |
init_dontaudit_write_script_pid(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
c9428d |
libs_use_ld_so(sendmail_t)
|
|
Chris PeBenito |
c9428d |
libs_use_shared_libs(sendmail_t)
|
|
Chris PeBenito |
650e75 |
# Read /usr/lib/sasl2/.*
|
|
Chris PeBenito |
c9428d |
libs_read_lib(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
ab940a |
logging_send_syslog_msg(sendmail_t)
|
|
Chris PeBenito |
ab940a |
|
|
Chris PeBenito |
650e75 |
miscfiles_read_localization(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
ab940a |
sysnet_read_config(sendmail_t)
|
|
Chris PeBenito |
ab940a |
|
|
Chris PeBenito |
b24f35 |
userdom_dontaudit_use_unpriv_user_fd(sendmail_t)
|
|
Chris PeBenito |
b24f35 |
userdom_dontaudit_search_sysadm_home_dir(sendmail_t)
|
|
Chris PeBenito |
b24f35 |
|
|
Chris PeBenito |
650e75 |
# Write to /etc/aliases and /etc/mail.
|
|
Chris PeBenito |
c9428d |
mta_rw_aliases(sendmail_t)
|
|
Chris PeBenito |
650e75 |
# Write to /var/spool/mail and /var/spool/mqueue.
|
|
Chris PeBenito |
c9428d |
mta_manage_queue(sendmail_t)
|
|
Chris PeBenito |
c9428d |
mta_manage_spool(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
142e9f |
ifdef(`targeted_policy',`
|
|
Chris PeBenito |
142e9f |
unconfined_domain_template(sendmail_t)
|
|
Chris PeBenito |
0fd9dc |
term_dontaudit_use_unallocated_tty(sendmail_t)
|
|
Chris PeBenito |
31908b |
term_dontaudit_use_generic_pty(sendmail_t)
|
|
Chris PeBenito |
c9428d |
files_dontaudit_read_root_file(sendmail_t)
|
|
Chris PeBenito |
650e75 |
')
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
ab940a |
optional_policy(`nis.te',`
|
|
Chris PeBenito |
ab940a |
nis_use_ypbind(sendmail_t)
|
|
Chris PeBenito |
ab940a |
')
|
|
Chris PeBenito |
ab940a |
|
|
Chris PeBenito |
493d6c |
optional_policy(`nscd.te',`
|
|
Chris PeBenito |
493d6c |
nscd_use_socket(sendmail_t)
|
|
Chris PeBenito |
493d6c |
')
|
|
Chris PeBenito |
493d6c |
|
|
Chris PeBenito |
04926d |
optional_policy(`postfix.te',`
|
|
Chris PeBenito |
04926d |
postfix_read_config(sendmail_t)
|
|
Chris PeBenito |
04926d |
postfix_search_spool(sendmail_t)
|
|
Chris PeBenito |
04926d |
')
|
|
Chris PeBenito |
04926d |
|
|
Chris PeBenito |
ae9e27 |
optional_policy(`selinuxutil.te',`
|
|
Chris PeBenito |
8fd367 |
seutil_sigchld_newrole(sendmail_t)
|
|
Chris PeBenito |
650e75 |
')
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
optional_policy(`udev.te', `
|
|
Chris PeBenito |
c9428d |
udev_read_db(sendmail_t)
|
|
Chris PeBenito |
650e75 |
')
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
ifdef(`TODO',`
|
|
Chris PeBenito |
650e75 |
optional_policy(`rhgb.te', `
|
|
Chris PeBenito |
ab940a |
rhgb_domain(sendmail_t)
|
|
Chris PeBenito |
650e75 |
')
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
allow sendmail_t etc_mail_t:dir rw_dir_perms;
|
|
Chris PeBenito |
650e75 |
allow sendmail_t etc_mail_t:file create_file_perms;
|
|
Chris PeBenito |
650e75 |
# for the start script to run make -C /etc/mail
|
|
Chris PeBenito |
650e75 |
allow initrc_t etc_mail_t:dir rw_dir_perms;
|
|
Chris PeBenito |
650e75 |
allow initrc_t etc_mail_t:file create_file_perms;
|
|
Chris PeBenito |
650e75 |
allow system_mail_t initrc_t:fd use;
|
|
Chris PeBenito |
650e75 |
allow system_mail_t initrc_t:fifo_file write;
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
# When sendmail runs as user_mail_domain, it needs some extra permissions
|
|
Chris PeBenito |
650e75 |
# to update /etc/mail/statistics.
|
|
Chris PeBenito |
650e75 |
allow user_mail_domain etc_mail_t:file rw_file_perms;
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
# Silently deny attempts to access /root.
|
|
Chris PeBenito |
650e75 |
dontaudit system_mail_t { staff_home_dir_t sysadm_home_dir_t}:dir { getattr search };
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
# Run procmail in its own domain, if defined.
|
|
Chris PeBenito |
650e75 |
ifdef(`procmail.te',`
|
|
Chris PeBenito |
c9428d |
corecmd_search_bin(sendmail_t)
|
|
Chris PeBenito |
ab940a |
procmail_domtrans(sendmail_t)
|
|
Chris PeBenito |
650e75 |
domain_auto_trans(system_mail_t, procmail_exec_t, procmail_t)
|
|
Chris PeBenito |
650e75 |
')
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
dontaudit sendmail_t admin_tty_type:chr_file { getattr ioctl };
|
|
Chris PeBenito |
650e75 |
') dnl end TODO
|