selinux-policy/strict/domains/program/sendmail.te

113 lines
3.7 KiB
Plaintext
Raw Normal View History

2005-04-29 17:45:15 +00:00
#DESC Sendmail - Mail server
#
# Authors: Stephen Smalley <sds@epoch.ncsc.mil> and Timothy Fraser
# X-Debian-Packages: sendmail sendmail-wide
# Depends: mta.te
#
#################################
#
# Rules for the sendmail_t domain.
#
# sendmail_t is the domain for the sendmail
# daemon started by the init rc scripts.
#
# etc_mail_t is the type of /etc/mail.
type etc_mail_t, file_type, sysadmfile, usercanread;
daemon_domain(sendmail, `, nscd_client_domain, mta_delivery_agent, mail_server_domain, mail_server_sender', nosysadm)
tmp_domain(sendmail)
logdir_domain(sendmail)
# Use capabilities
allow sendmail_t self:capability { setuid setgid net_bind_service sys_nice chown sys_tty_config };
# Use the network.
can_network(sendmail_t)
allow sendmail_t port_type:tcp_socket name_connect;
2005-04-29 17:45:15 +00:00
can_ypbind(sendmail_t)
allow sendmail_t self:unix_stream_socket create_stream_socket_perms;
allow sendmail_t self:unix_dgram_socket create_socket_perms;
allow sendmail_t self:fifo_file rw_file_perms;
# Bind to the SMTP port.
allow sendmail_t smtp_port_t:tcp_socket name_bind;
allow sendmail_t etc_t:file { getattr read };
# Write to /etc/aliases and /etc/mail.
allow sendmail_t etc_aliases_t:file { setattr rw_file_perms };
#
# 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;
# Write to /var/spool/mail and /var/spool/mqueue.
allow sendmail_t var_spool_t:dir { getattr search };
allow sendmail_t mail_spool_t:dir rw_dir_perms;
allow sendmail_t mail_spool_t:file create_file_perms;
allow sendmail_t mqueue_spool_t:dir rw_dir_perms;
allow sendmail_t mqueue_spool_t:file create_file_perms;
allow sendmail_t urandom_device_t:chr_file { getattr read };
# Read /usr/lib/sasl2/.*
allow sendmail_t lib_t:file { getattr read };
# 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',`
domain_auto_trans(sendmail_t, procmail_exec_t, procmail_t)
domain_auto_trans(system_mail_t, procmail_exec_t, procmail_t)
allow sendmail_t bin_t:dir { getattr search };
')
read_sysctl(sendmail_t)
read_sysctl(system_mail_t)
allow system_mail_t etc_mail_t:dir { getattr search };
allow system_mail_t etc_runtime_t:file { getattr read };
allow system_mail_t proc_t:dir search;
allow system_mail_t proc_t:file { getattr read };
allow system_mail_t proc_t:lnk_file read;
dontaudit system_mail_t proc_net_t:dir search;
allow system_mail_t fs_t:filesystem getattr;
allow system_mail_t self:dir { getattr search };
allow system_mail_t var_t:dir getattr;
allow system_mail_t var_spool_t:dir getattr;
dontaudit system_mail_t userpty_type:chr_file { getattr read write };
# sendmail -q
allow system_mail_t mqueue_spool_t:dir rw_dir_perms;
allow system_mail_t mqueue_spool_t:file create_file_perms;
ifdef(`crond.te', `
dontaudit system_mail_t system_crond_tmp_t:file append;
')
dontaudit sendmail_t admin_tty_type:chr_file { getattr ioctl };
# sendmail wants to read /var/run/utmp if the controlling tty is /dev/console
allow sendmail_t initrc_var_run_t:file { getattr read };
dontaudit sendmail_t initrc_var_run_t:file { lock write };