1900668638
The latest revision of the labeled policy patches which enable both labeled and unlabeled policy support for NetLabel. This revision takes into account Chris' feedback from the first version and reduces the number of interface calls in each domain down to two at present: one for unlabeled access, one for NetLabel access. The older, transport layer specific interfaces, are still present for use by third-party modules but are not used in the default policy modules. trunk: Use netmsg initial SID for MLS-only Netlabel packets, from Paul Moore. This patch changes the policy to use the netmsg initial SID as the "base" SID/context for NetLabel packets which only have MLS security attributes. Currently we use the unlabeled initial SID which makes it very difficult to distinquish between actual unlabeled packets and those packets which have MLS security attributes.
164 lines
4.4 KiB
Plaintext
164 lines
4.4 KiB
Plaintext
|
|
policy_module(sendmail,1.4.3)
|
|
|
|
########################################
|
|
#
|
|
# Declarations
|
|
#
|
|
|
|
type sendmail_log_t;
|
|
logging_log_file(sendmail_log_t)
|
|
|
|
type sendmail_tmp_t;
|
|
files_tmp_file(sendmail_tmp_t)
|
|
|
|
type sendmail_var_run_t;
|
|
files_pid_file(sendmail_var_run_t)
|
|
|
|
type sendmail_t;
|
|
mta_sendmail_mailserver(sendmail_t)
|
|
mta_mailserver_delivery(sendmail_t)
|
|
mta_mailserver_sender(sendmail_t)
|
|
|
|
########################################
|
|
#
|
|
# Sendmail local policy
|
|
#
|
|
|
|
allow sendmail_t self:capability { setuid setgid net_bind_service sys_nice chown sys_tty_config };
|
|
allow sendmail_t self:process signal;
|
|
allow sendmail_t self:fifo_file rw_fifo_file_perms;
|
|
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:tcp_socket create_stream_socket_perms;
|
|
allow sendmail_t self:udp_socket create_socket_perms;
|
|
allow sendmail_t self:netlink_route_socket r_netlink_socket_perms;
|
|
|
|
allow sendmail_t sendmail_log_t:dir setattr;
|
|
manage_files_pattern(sendmail_t,sendmail_log_t,sendmail_log_t)
|
|
logging_log_filetrans(sendmail_t,sendmail_log_t,{ file dir })
|
|
|
|
manage_dirs_pattern(sendmail_t,sendmail_tmp_t,sendmail_tmp_t)
|
|
manage_files_pattern(sendmail_t,sendmail_tmp_t,sendmail_tmp_t)
|
|
files_tmp_filetrans(sendmail_t, sendmail_tmp_t, { file dir })
|
|
|
|
allow sendmail_t sendmail_var_run_t:file manage_file_perms;
|
|
files_pid_filetrans(sendmail_t,sendmail_var_run_t,file)
|
|
|
|
kernel_read_kernel_sysctls(sendmail_t)
|
|
# for piping mail to a command
|
|
kernel_read_system_state(sendmail_t)
|
|
|
|
corenet_all_recvfrom_unlabeled(sendmail_t)
|
|
corenet_all_recvfrom_netlabel(sendmail_t)
|
|
corenet_tcp_sendrecv_all_if(sendmail_t)
|
|
corenet_tcp_sendrecv_all_nodes(sendmail_t)
|
|
corenet_tcp_sendrecv_all_ports(sendmail_t)
|
|
corenet_tcp_bind_all_nodes(sendmail_t)
|
|
corenet_tcp_bind_smtp_port(sendmail_t)
|
|
corenet_tcp_connect_all_ports(sendmail_t)
|
|
corenet_sendrecv_smtp_server_packets(sendmail_t)
|
|
corenet_sendrecv_smtp_client_packets(sendmail_t)
|
|
|
|
dev_read_urand(sendmail_t)
|
|
dev_read_sysfs(sendmail_t)
|
|
|
|
fs_getattr_all_fs(sendmail_t)
|
|
fs_search_auto_mountpoints(sendmail_t)
|
|
|
|
term_dontaudit_use_console(sendmail_t)
|
|
|
|
# for piping mail to a command
|
|
corecmd_exec_shell(sendmail_t)
|
|
|
|
domain_use_interactive_fds(sendmail_t)
|
|
|
|
files_read_etc_files(sendmail_t)
|
|
files_search_spool(sendmail_t)
|
|
# for piping mail to a command
|
|
files_read_etc_runtime_files(sendmail_t)
|
|
|
|
init_use_fds(sendmail_t)
|
|
init_use_script_ptys(sendmail_t)
|
|
# sendmail wants to read /var/run/utmp if the controlling tty is /dev/console
|
|
init_read_utmp(sendmail_t)
|
|
init_dontaudit_write_utmp(sendmail_t)
|
|
|
|
libs_use_ld_so(sendmail_t)
|
|
libs_use_shared_libs(sendmail_t)
|
|
# Read /usr/lib/sasl2/.*
|
|
libs_read_lib_files(sendmail_t)
|
|
|
|
logging_send_syslog_msg(sendmail_t)
|
|
|
|
miscfiles_read_localization(sendmail_t)
|
|
|
|
sysnet_dns_name_resolve(sendmail_t)
|
|
sysnet_read_config(sendmail_t)
|
|
|
|
userdom_dontaudit_use_unpriv_user_fds(sendmail_t)
|
|
userdom_dontaudit_search_sysadm_home_dirs(sendmail_t)
|
|
|
|
mta_read_config(sendmail_t)
|
|
mta_etc_filetrans_aliases(sendmail_t)
|
|
# Write to /etc/aliases and /etc/mail.
|
|
mta_rw_aliases(sendmail_t)
|
|
# Write to /var/spool/mail and /var/spool/mqueue.
|
|
mta_manage_queue(sendmail_t)
|
|
mta_manage_spool(sendmail_t)
|
|
|
|
ifdef(`targeted_policy',`
|
|
term_dontaudit_use_unallocated_ttys(sendmail_t)
|
|
term_dontaudit_use_generic_ptys(sendmail_t)
|
|
files_dontaudit_read_root_files(sendmail_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
clamav_search_lib(sendmail_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
nis_use_ypbind(sendmail_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
nscd_socket_use(sendmail_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
postfix_exec_master(sendmail_t)
|
|
postfix_read_config(sendmail_t)
|
|
postfix_search_spool(sendmail_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
procmail_domtrans(sendmail_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
seutil_sigchld_newrole(sendmail_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
udev_read_db(sendmail_t)
|
|
')
|
|
|
|
ifdef(`TODO',`
|
|
allow sendmail_t etc_mail_t:dir rw_dir_perms;
|
|
allow sendmail_t etc_mail_t:file manage_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 manage_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 };
|
|
|
|
dontaudit sendmail_t admin_tty_type:chr_file { getattr ioctl };
|
|
') dnl end TODO
|