selinux-policy/mls/domains/program/sendmail.te
2005-11-22 19:28:03 +00:00

137 lines
4.8 KiB
Plaintext

#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.
#
daemon_base_domain(sendmail_launch)
allow sendmail_launch_t { etc_t proc_t etc_runtime_t self }:file { getattr read };
allow sendmail_launch_t { bin_t sbin_t etc_t }:lnk_file { getattr read };
allow sendmail_launch_t { bin_t sbin_t }:dir search;
can_exec(sendmail_launch_t, { etc_t bin_t sbin_t shell_exec_t })
access_terminal(sendmail_launch_t, sysadm)
ifdef(`consoletype.te', `
domain_auto_trans(sendmail_launch_t, consoletype_exec_t, consoletype_t)
')
read_locale(sendmail_launch_t)
r_dir_file(sendmail_launch_t, etc_mail_t)
allow sendmail_launch_t self:fifo_file rw_file_perms;
allow sendmail_launch_t self:capability { chown kill sys_nice };
allow sendmail_launch_t self:unix_stream_socket create_stream_socket_perms;
can_ps(sendmail_launch_t, sendmail_t)
dontaudit sendmail_launch_t domain:dir search;
allow sendmail_launch_t sendmail_t:process signal;
ifdef(`distro_redhat', `
lock_domain(sendmail_launch)
')
dontaudit sendmail_launch_t mnt_t:dir search;
allow sendmail_launch_t devpts_t:dir search;
file_type_auto_trans(sendmail_launch_t, var_run_t, sendmail_var_run_t, file)
daemon_core_rules(sendmail, `, nscd_client_domain, mta_delivery_agent, mail_server_domain, mail_server_sender')
# stuff from daemon_domain and daemon_base_domain because we can not have an
# automatic transition from initrc_t
rhgb_domain(sendmail_t)
read_sysctl(sendmail_t)
domain_auto_trans(sendmail_launch_t, sendmail_exec_t, sendmail_t)
allow sendmail_t privfd:fd use;
allow { sendmail_t sendmail_launch_t } var_t:dir { getattr search };
var_run_domain(sendmail)
allow sendmail_t { ttyfile devtty_t }:chr_file rw_file_perms;
dontaudit { sendmail_t sendmail_launch_t } sysadm_home_dir_t:dir search;
read_locale(sendmail_t)
allow sendmail_t fs_t:filesystem getattr;
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;
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 };
allow sendmail_t etc_mail_t:dir rw_dir_perms;
allow sendmail_t etc_mail_t:file create_file_perms;
# 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 rw_file_perms;
# 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 };