|
Chris PeBenito |
0fbfa5 |
#DESC Sendmail - Mail server
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Authors: Stephen Smalley <sds@epoch.ncsc.mil> and Timothy Fraser
|
|
Chris PeBenito |
0fbfa5 |
# X-Debian-Packages: sendmail sendmail-wide
|
|
Chris PeBenito |
0fbfa5 |
# Depends: mta.te
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
#################################
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Rules for the sendmail_t domain.
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# sendmail_t is the domain for the sendmail
|
|
Chris PeBenito |
0fbfa5 |
# daemon started by the init rc scripts.
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# etc_mail_t is the type of /etc/mail.
|
|
Chris PeBenito |
0fbfa5 |
type etc_mail_t, file_type, sysadmfile, usercanread;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
daemon_domain(sendmail, `, nscd_client_domain, mta_delivery_agent, mail_server_domain, mail_server_sender', nosysadm)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
tmp_domain(sendmail)
|
|
Chris PeBenito |
0fbfa5 |
logdir_domain(sendmail)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Use capabilities
|
|
Chris PeBenito |
0fbfa5 |
allow sendmail_t self:capability { setuid setgid net_bind_service sys_nice chown sys_tty_config };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Use the network.
|
|
Chris PeBenito |
0fbfa5 |
can_network(sendmail_t)
|
|
Chris PeBenito |
0fbfa5 |
can_ypbind(sendmail_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow sendmail_t self:unix_stream_socket create_stream_socket_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow sendmail_t self:unix_dgram_socket create_socket_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow sendmail_t self:fifo_file rw_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Bind to the SMTP port.
|
|
Chris PeBenito |
0fbfa5 |
allow sendmail_t smtp_port_t:tcp_socket name_bind;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow sendmail_t etc_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Write to /etc/aliases and /etc/mail.
|
|
Chris PeBenito |
0fbfa5 |
allow sendmail_t etc_aliases_t:file { setattr rw_file_perms };
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Need this transition to create /etc/aliases.db
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`distro_redhat', `
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`rpm.te', `
|
|
Chris PeBenito |
0fbfa5 |
domain_auto_trans(rpm_script_t, sendmail_exec_t, system_mail_t)
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow sendmail_t etc_mail_t:dir rw_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow sendmail_t etc_mail_t:file create_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
# for the start script to run make -C /etc/mail
|
|
Chris PeBenito |
0fbfa5 |
allow initrc_t etc_mail_t:dir rw_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow initrc_t etc_mail_t:file create_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow system_mail_t initrc_t:fd use;
|
|
Chris PeBenito |
0fbfa5 |
allow system_mail_t initrc_t:fifo_file write;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Write to /var/spool/mail and /var/spool/mqueue.
|
|
Chris PeBenito |
0fbfa5 |
allow sendmail_t var_spool_t:dir { getattr search };
|
|
Chris PeBenito |
0fbfa5 |
allow sendmail_t mail_spool_t:dir rw_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow sendmail_t mail_spool_t:file create_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow sendmail_t mqueue_spool_t:dir rw_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow sendmail_t mqueue_spool_t:file create_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow sendmail_t urandom_device_t:chr_file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Read /usr/lib/sasl2/.*
|
|
Chris PeBenito |
0fbfa5 |
allow sendmail_t lib_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# When sendmail runs as user_mail_domain, it needs some extra permissions
|
|
Chris PeBenito |
0fbfa5 |
# to update /etc/mail/statistics.
|
|
Chris PeBenito |
0fbfa5 |
allow user_mail_domain etc_mail_t:file rw_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Silently deny attempts to access /root.
|
|
Chris PeBenito |
0fbfa5 |
dontaudit system_mail_t { staff_home_dir_t sysadm_home_dir_t}:dir { getattr search };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Run procmail in its own domain, if defined.
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`procmail.te',`
|
|
Chris PeBenito |
0fbfa5 |
domain_auto_trans(sendmail_t, procmail_exec_t, procmail_t)
|
|
Chris PeBenito |
0fbfa5 |
domain_auto_trans(system_mail_t, procmail_exec_t, procmail_t)
|
|
Chris PeBenito |
0fbfa5 |
allow sendmail_t bin_t:dir { getattr search };
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
read_sysctl(sendmail_t)
|
|
Chris PeBenito |
0fbfa5 |
read_sysctl(system_mail_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow system_mail_t etc_mail_t:dir { getattr search };
|
|
Chris PeBenito |
0fbfa5 |
allow system_mail_t etc_runtime_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
allow system_mail_t proc_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow system_mail_t proc_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
allow system_mail_t proc_t:lnk_file read;
|
|
Chris PeBenito |
0fbfa5 |
dontaudit system_mail_t proc_net_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow system_mail_t fs_t:filesystem getattr;
|
|
Chris PeBenito |
0fbfa5 |
allow system_mail_t self:dir { getattr search };
|
|
Chris PeBenito |
0fbfa5 |
allow system_mail_t var_t:dir getattr;
|
|
Chris PeBenito |
0fbfa5 |
allow system_mail_t var_spool_t:dir getattr;
|
|
Chris PeBenito |
0fbfa5 |
dontaudit system_mail_t userpty_type:chr_file { getattr read write };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# sendmail -q
|
|
Chris PeBenito |
0fbfa5 |
allow system_mail_t mqueue_spool_t:dir rw_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow system_mail_t mqueue_spool_t:file create_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`crond.te', `
|
|
Chris PeBenito |
0fbfa5 |
dontaudit system_mail_t system_crond_tmp_t:file append;
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
dontaudit sendmail_t admin_tty_type:chr_file { getattr ioctl };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# sendmail wants to read /var/run/utmp if the controlling tty is /dev/console
|
|
Chris PeBenito |
0fbfa5 |
allow sendmail_t initrc_var_run_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
dontaudit sendmail_t initrc_var_run_t:file { lock write };
|
|
Chris PeBenito |
0fbfa5 |
|