|
Chris PeBenito |
650e75 |
# Copyright (C) 2005 Tresys Technology, LLC
|
|
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 |
650e75 |
type sendmail_t; # , nscd_client_domain, mta_delivery_agent, mail_server_sender', nosysadm)
|
|
Chris PeBenito |
650e75 |
mta_make_sendmail_mailserver_domain(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
type sendmail_log_t;
|
|
Chris PeBenito |
650e75 |
logging_make_log_file(sendmail_log_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
type sendmail_tmp_t;
|
|
Chris PeBenito |
650e75 |
files_make_temporary_file(sendmail_tmp_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
type sendmail_var_run_t;
|
|
Chris PeBenito |
650e75 |
files_make_daemon_runtime_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 |
650e75 |
allow sendmail_t self:fifo_file { getattr read write append ioctl lock };
|
|
Chris PeBenito |
650e75 |
allow sendmail_t self:unix_stream_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown listen accept };
|
|
Chris PeBenito |
650e75 |
allow sendmail_t self:unix_dgram_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown };
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
allow sendmail_t sendmail_log_t:file { create ioctl read getattr lock write setattr append link unlink rename };
|
|
Chris PeBenito |
650e75 |
allow sendmail_t sendmail_log_t:dir { getattr search read lock ioctl add_name remove_name write setattr };
|
|
Chris PeBenito |
650e75 |
logging_create_private_log(sendmail_t,sendmail_log_t,{ file dir })
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
allow sendmail_t sendmail_tmp_t:dir { create read getattr lock setattr ioctl link unlink rename search add_name remove_name reparent write rmdir };
|
|
Chris PeBenito |
650e75 |
allow sendmail_t sendmail_tmp_t:file { create ioctl read getattr lock write setattr append link unlink rename };
|
|
Chris PeBenito |
650e75 |
files_create_private_tmp_data(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 |
650e75 |
files_create_daemon_runtime_data(sendmail_t,sendmail_var_run_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
kernel_read_kernel_sysctl(sendmail_t)
|
|
Chris PeBenito |
650e75 |
kernel_read_hardware_state(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
corenetwork_network_tcp_on_all_interfaces(sendmail_t)
|
|
Chris PeBenito |
650e75 |
corenetwork_network_raw_on_all_interfaces(sendmail_t)
|
|
Chris PeBenito |
650e75 |
corenetwork_network_udp_on_all_interfaces(sendmail_t)
|
|
Chris PeBenito |
650e75 |
corenetwork_network_tcp_on_all_nodes(sendmail_t)
|
|
Chris PeBenito |
650e75 |
corenetwork_network_raw_on_all_nodes(sendmail_t)
|
|
Chris PeBenito |
650e75 |
corenetwork_network_udp_on_all_nodes(sendmail_t)
|
|
Chris PeBenito |
650e75 |
corenetwork_network_tcp_on_all_ports(sendmail_t)
|
|
Chris PeBenito |
650e75 |
corenetwork_network_udp_on_all_ports(sendmail_t)
|
|
Chris PeBenito |
650e75 |
corenetwork_bind_tcp_on_all_nodes(sendmail_t)
|
|
Chris PeBenito |
650e75 |
corenetwork_bind_udp_on_all_nodes(sendmail_t)
|
|
Chris PeBenito |
650e75 |
corenetwork_bind_tcp_on_smtp_port(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
devices_get_pseudorandom_data(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
filesystem_get_all_filesystems_attributes(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
terminal_ignore_use_console(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
init_use_file_descriptors(sendmail_t)
|
|
Chris PeBenito |
650e75 |
init_script_use_pseudoterminal(sendmail_t)
|
|
Chris PeBenito |
650e75 |
# sendmail wants to read /var/run/utmp if the controlling tty is /dev/console
|
|
Chris PeBenito |
650e75 |
init_script_read_runtime_data(sendmail_t)
|
|
Chris PeBenito |
650e75 |
init_script_ignore_write_runtime_data(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
domain_use_widely_inheritable_file_descriptors(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
files_read_general_system_config(sendmail_t)
|
|
Chris PeBenito |
650e75 |
files_search_system_spool_directory(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
logging_send_system_log_message(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
libraries_use_dynamic_loader(sendmail_t)
|
|
Chris PeBenito |
650e75 |
libraries_read_shared_libraries(sendmail_t)
|
|
Chris PeBenito |
650e75 |
# Read /usr/lib/sasl2/.*
|
|
Chris PeBenito |
650e75 |
libraries_read_library_resources(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
miscfiles_read_localization(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
# Write to /etc/aliases and /etc/mail.
|
|
Chris PeBenito |
650e75 |
mta_modify_mail_aliases(sendmail_t)
|
|
Chris PeBenito |
650e75 |
# Write to /var/spool/mail and /var/spool/mqueue.
|
|
Chris PeBenito |
650e75 |
mta_manage_mail_queue(sendmail_t)
|
|
Chris PeBenito |
650e75 |
mta_manage_mail_spool(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
sysnetwork_read_network_config(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
tunable_policy(`targeted_policy', `
|
|
Chris PeBenito |
650e75 |
terminal_ignore_use_general_physical_terminal(sendmail_t)
|
|
Chris PeBenito |
650e75 |
terminal_ignore_use_general_pseudoterminal(sendmail_t)
|
|
Chris PeBenito |
650e75 |
files_ignore_read_rootfs_file(sendmail_t)
|
|
Chris PeBenito |
650e75 |
')
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
optional_policy(`selinux.te',`
|
|
Chris PeBenito |
650e75 |
selinux_newrole_sigchld(sendmail_t)
|
|
Chris PeBenito |
650e75 |
')
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
optional_policy(`udev.te', `
|
|
Chris PeBenito |
650e75 |
udev_read_database(sendmail_t)
|
|
Chris PeBenito |
650e75 |
')
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
ifdef(`TODO',`
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
optional_policy(`rhgb.te', `
|
|
Chris PeBenito |
650e75 |
allow sendmail_t rhgb_t:process sigchld;
|
|
Chris PeBenito |
650e75 |
allow sendmail_t rhgb_t:fd use;
|
|
Chris PeBenito |
650e75 |
allow sendmail_t rhgb_t:fifo_file { read write };
|
|
Chris PeBenito |
650e75 |
')
|
|
Chris PeBenito |
650e75 |
allow sendmail_t proc_t:dir r_dir_perms;
|
|
Chris PeBenito |
650e75 |
allow sendmail_t proc_t:lnk_file read;
|
|
Chris PeBenito |
650e75 |
dontaudit sendmail_t unpriv_userdomain:fd use;
|
|
Chris PeBenito |
650e75 |
allow sendmail_t autofs_t:dir { search getattr };
|
|
Chris PeBenito |
650e75 |
dontaudit sendmail_t sysadm_home_dir_t:dir search;
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
can_ypbind(sendmail_t)
|
|
Chris PeBenito |
650e75 |
|
|
Chris PeBenito |
650e75 |
#
|
|
Chris PeBenito |
650e75 |
# Need this transition to create /etc/aliases.db
|
|
Chris PeBenito |
650e75 |
#
|
|
Chris PeBenito |
650e75 |
ifdef(`distro_redhat', `
|
|
Chris PeBenito |
650e75 |
ifdef(`rpm.te', `
|
|
Chris PeBenito |
650e75 |
domain_auto_trans(rpm_script_t, sendmail_exec_t, system_mail_t)
|
|
Chris PeBenito |
650e75 |
')
|
|
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 |
650e75 |
corecommands_search_general_programs_directory(sendmail_t)
|
|
Chris PeBenito |
650e75 |
procmail_transition(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
|