Chris PeBenito 6b9383
Chris PeBenito 6b9383
policy_module(mta,1.0)
Chris PeBenito 6b9383
Chris PeBenito 075c4f
########################################
Chris PeBenito 075c4f
#
Chris PeBenito 075c4f
# Declarations
Chris PeBenito 075c4f
#
Chris PeBenito 075c4f
Chris PeBenito 246839
attribute mta_user_agent;
Chris PeBenito 246839
attribute mailserver_delivery;
Chris PeBenito 246839
attribute mailserver_domain;
Chris PeBenito 246839
attribute mailserver_sender;
Chris PeBenito 246839
Chris PeBenito 6b9383
type etc_aliases_t;
Chris PeBenito 8fd367
files_type(etc_aliases_t)
Chris PeBenito 6b9383
Chris PeBenito 6b9383
type etc_mail_t;
Chris PeBenito 8fd367
files_type(etc_mail_t)
Chris PeBenito 6b9383
Chris PeBenito 6b9383
type mqueue_spool_t;
Chris PeBenito 8fd367
files_type(mqueue_spool_t)
Chris PeBenito 6b9383
Chris PeBenito 6b9383
type mail_spool_t;
Chris PeBenito 8fd367
files_type(mail_spool_t)
Chris PeBenito 075c4f
Chris PeBenito 075c4f
type sendmail_exec_t;
Chris PeBenito 8fd367
files_type(sendmail_exec_t)
Chris PeBenito 075c4f
Chris PeBenito 246839
type system_mail_t;
Chris PeBenito c9428d
domain_type(system_mail_t)
Chris PeBenito 075c4f
role system_r types system_mail_t;
Chris PeBenito 075c4f
Chris PeBenito 254bbc
ifdef(`targeted_policy',`',`
Chris PeBenito df00b2
	optional_policy(`sendmail.te',`
Chris PeBenito df00b2
		domain_entry_file(system_mail_t,sendmail_exec_t)
Chris PeBenito df00b2
	',`
Chris PeBenito df00b2
		init_system_domain(system_mail_t,sendmail_exec_t)
Chris PeBenito df00b2
	')
Chris PeBenito df00b2
')
Chris PeBenito 7bba9d
Chris PeBenito 075c4f
########################################
Chris PeBenito 075c4f
#
Chris PeBenito 075c4f
# System mail local policy
Chris PeBenito 075c4f
#
Chris PeBenito 075c4f
Chris PeBenito 075c4f
allow system_mail_t self:capability { setuid setgid chown };
Chris PeBenito 0fd9dc
allow system_mail_t self:process { signal_perms setrlimit };
Chris PeBenito 075c4f
Chris PeBenito 0a10b1
allow system_mail_t self:tcp_socket create_socket_perms;
Chris PeBenito 075c4f
Chris PeBenito 075c4f
# re-exec itself
Chris PeBenito 0a10b1
can_exec(system_mail_t, sendmail_exec_t)
Chris PeBenito 0a10b1
allow system_mail_t sendmail_exec_t:lnk_file r_file_perms;
Chris PeBenito 075c4f
Chris PeBenito 075c4f
kernel_read_kernel_sysctl(system_mail_t)
Chris PeBenito 075c4f
kernel_read_system_state(system_mail_t)
Chris PeBenito 075c4f
kernel_read_network_state(system_mail_t)
Chris PeBenito 075c4f
Chris PeBenito 0fd9dc
corenet_tcp_sendrecv_all_if(system_mail_t)
Chris PeBenito 0fd9dc
corenet_raw_sendrecv_all_if(system_mail_t)
Chris PeBenito 0fd9dc
corenet_tcp_sendrecv_all_nodes(system_mail_t)
Chris PeBenito 0fd9dc
corenet_raw_sendrecv_all_nodes(system_mail_t)
Chris PeBenito 0fd9dc
corenet_tcp_bind_all_nodes(system_mail_t)
Chris PeBenito 0fd9dc
corenet_tcp_sendrecv_all_ports(system_mail_t)
Chris PeBenito 075c4f
Karl MacMillan f0c985
dev_read_urand(system_mail_t)
Chris PeBenito 075c4f
Chris PeBenito 0fd9dc
fs_getattr_xattr_fs(system_mail_t)
Chris PeBenito 075c4f
Chris PeBenito c9428d
init_use_script_pty(system_mail_t)
Chris PeBenito 075c4f
Chris PeBenito 8fd367
files_read_etc_files(system_mail_t)
Chris PeBenito 246839
files_read_etc_runtime_files(system_mail_t)
Chris PeBenito 246839
files_search_spool(system_mail_t)
Chris PeBenito 075c4f
# It wants to check for nscd
Chris PeBenito c9428d
files_dontaudit_search_pids(system_mail_t)
Chris PeBenito 075c4f
Chris PeBenito c9428d
corecmd_exec_bin(system_mail_t)
Chris PeBenito 246839
corecmd_search_sbin(system_mail_t)
Chris PeBenito 075c4f
Chris PeBenito c9428d
libs_use_ld_so(system_mail_t)
Chris PeBenito c9428d
libs_use_shared_libs(system_mail_t)
Chris PeBenito 075c4f
Chris PeBenito c9428d
logging_send_syslog_msg(system_mail_t)
Chris PeBenito 075c4f
Chris PeBenito 075c4f
miscfiles_read_localization(system_mail_t)
Chris PeBenito 075c4f
Chris PeBenito c9428d
sysnet_read_config(system_mail_t)
Chris PeBenito 075c4f
Chris PeBenito 246839
userdom_use_sysadm_terms(system_mail_t)
Chris PeBenito 246839
Chris PeBenito 246839
ifdef(`targeted_policy',`
Chris PeBenito 246839
	allow system_mail_t etc_mail_t:file r_file_perms;
Chris PeBenito 246839
Chris PeBenito 246839
	allow system_mail_t mail_spool_t:dir create_dir_perms;
Chris PeBenito 246839
	allow system_mail_t mail_spool_t:file create_file_perms;
Chris PeBenito 246839
	allow system_mail_t mail_spool_t:lnk_file create_lnk_perms;
Chris PeBenito 246839
	allow system_mail_t mail_spool_t:fifo_file rw_file_perms;
Chris PeBenito 246839
Chris PeBenito 246839
	allow system_mail_t mqueue_spool_t:dir create_dir_perms;
Chris PeBenito 246839
	allow system_mail_t mqueue_spool_t:file create_file_perms;
Chris PeBenito 246839
	allow system_mail_t mqueue_spool_t:lnk_file create_lnk_perms;
Chris PeBenito 246839
Chris PeBenito 246839
	optional_policy(`postfix.te',`',`
Chris PeBenito 246839
		corecmd_exec_bin(system_mail_t)
Chris PeBenito 246839
		corecmd_exec_sbin(system_mail_t)
Chris PeBenito 246839
Chris PeBenito 246839
		domain_exec_all_entry_files(system_mail_t)
Chris PeBenito 246839
Chris PeBenito 246839
		files_exec_etc_files(system_mail_t)
Chris PeBenito 246839
Chris PeBenito 246839
		libs_use_ld_so(system_mail_t)
Chris PeBenito 246839
		libs_use_shared_libs(system_mail_t)
Chris PeBenito 246839
		libs_exec_ld_so(system_mail_t)
Chris PeBenito 246839
		libs_exec_lib_files(system_mail_t)
Chris PeBenito 246839
	')
Chris PeBenito 246839
')
Chris PeBenito 246839
Chris PeBenito 075c4f
tunable_policy(`use_dns',`
Chris PeBenito 0a10b1
	allow system_mail_t self:udp_socket create_socket_perms;
Chris PeBenito 0fd9dc
	corenet_udp_sendrecv_all_if(system_mail_t)
Chris PeBenito 0fd9dc
	corenet_udp_sendrecv_all_nodes(system_mail_t)
Chris PeBenito 0fd9dc
	corenet_udp_bind_all_nodes(system_mail_t)
Chris PeBenito 0fd9dc
	corenet_udp_sendrecv_dns_port(system_mail_t)
Chris PeBenito 075c4f
')
Chris PeBenito 075c4f
Chris PeBenito 246839
optional_policy(`cron.te',`
Chris PeBenito 246839
	cron_read_system_job_tmp_files(system_mail_t)
Chris PeBenito 246839
')
Chris PeBenito 246839
Chris PeBenito 246839
optional_policy(`logrotate.te',`
Chris PeBenito 246839
	logrotate_read_tmp_files(system_mail_t)
Chris PeBenito 246839
')
Chris PeBenito 246839
Chris PeBenito ab940a
optional_policy(`nis.te',`
Chris PeBenito ab940a
	nis_use_ypbind(system_mail_t)
Chris PeBenito ab940a
')
Chris PeBenito ab940a
Chris PeBenito 493d6c
optional_policy(`nscd.te',`
Chris PeBenito 493d6c
	nscd_use_socket(system_mail_t)
Chris PeBenito 493d6c
')
Chris PeBenito 493d6c
Chris PeBenito 075c4f
optional_policy(`procmail.te',`
Chris PeBenito ab940a
	procmail_exec(system_mail_t)
Chris PeBenito 075c4f
')
Chris PeBenito 075c4f
Chris PeBenito 7bba9d
optional_policy(`sendmail.te',`
Chris PeBenito df00b2
	allow system_mail_t etc_mail_t:dir { getattr search };
Chris PeBenito 7bba9d
Chris PeBenito df00b2
	# sendmail -q 
Chris PeBenito df00b2
	allow system_mail_t mqueue_spool_t:dir rw_dir_perms;
Chris PeBenito df00b2
	allow system_mail_t mqueue_spool_t:file create_file_perms;
Chris PeBenito 246839
')
Chris PeBenito 246839
Chris PeBenito 246839
ifdef(`TODO',`
Chris PeBenito 246839
optional_policy(`sendmail.te',`
Chris PeBenito 246839
	allow system_mail_t { var_t var_spool_t }:dir getattr;
Chris PeBenito 246839
	dontaudit system_mail_t userpty_type:chr_file { getattr read write };
Chris PeBenito df00b2
Chris PeBenito df00b2
	optional_policy(`crond.te', `
Chris PeBenito df00b2
		dontaudit system_mail_t system_crond_tmp_t:file append;
Chris PeBenito df00b2
	')
Chris PeBenito 7bba9d
')
Chris PeBenito 075c4f
Chris PeBenito 246839
ifdef(`targeted_policy',`
Chris PeBenito df00b2
	allow system_mail_t { var_t var_spool_t }:dir getattr;
Chris PeBenito df00b2
',`
Chris PeBenito df00b2
	# allow the sysadmin to do "mail someone < /home/user/whatever"
Chris PeBenito df00b2
	allow sysadm_mail_t user_home_dir_type:dir search;
Chris PeBenito df00b2
	r_dir_file(sysadm_mail_t, user_home_type)
Chris PeBenito 7bba9d
')
Chris PeBenito 075c4f
Chris PeBenito 246839
allow system_mail_t privmail:fd use;
Chris PeBenito 246839
allow system_mail_t privmail:process sigchld;
Chris PeBenito 246839
allow system_mail_t privmail:fifo_file { read write };
Chris PeBenito 075c4f
Chris PeBenito 246839
optional_policy(`arpwatch.te',`
Chris PeBenito 246839
	allow system_mail_t arpwatch_tmp_t:file rw_file_perms;
Chris PeBenito 075c4f
Chris PeBenito 246839
	ifdef(`hide_broken_symptoms', `
Chris PeBenito 246839
		dontaudit system_mail_t arpwatch_t:packet_socket { read write };
Chris PeBenito 246839
	')
Chris PeBenito 075c4f
')
Chris PeBenito 075c4f
Chris PeBenito 246839
optional_policy(`qmail.te',`
Chris PeBenito 246839
	allow system_mail_t qmail_etc_t:dir search;
Chris PeBenito 246839
	allow system_mail_t qmail_etc_t:{ file lnk_file } read;
Chris PeBenito 96ce00
')
Chris PeBenito 075c4f
') dnl end TODO