Chris PeBenito 6b9383
Chris PeBenito d3d270
policy_module(mta,1.2.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 04926d
attribute user_mail_domain;
Chris PeBenito 04926d
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 9bbc75
files_config_file(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 08cd98
mta_base_mail_template(system)
Chris PeBenito 075c4f
role system_r types system_mail_t;
Chris PeBenito 075c4f
Chris PeBenito 12ae75
# cjp: need to resolve this, but require{}
Chris PeBenito 12ae75
# does not work in the else part of the optional
Chris PeBenito 08cd98
#ifdef(`strict_policy',`
Chris PeBenito 132880
#	optional_policy(`sendmail',`',`
Chris PeBenito 12ae75
#		init_system_domain(system_mail_t,sendmail_exec_t)
Chris PeBenito 12ae75
#	')
Chris PeBenito 12ae75
#')
Chris PeBenito 7bba9d
Chris PeBenito 075c4f
########################################
Chris PeBenito 075c4f
#
Chris PeBenito 075c4f
# System mail local policy
Chris PeBenito 075c4f
#
Chris PeBenito 075c4f
Don Miner f13da8
allow system_mail_t etc_mail_t:dir { getattr search };
Chris PeBenito e8d0a6
allow system_mail_t etc_mail_t:file r_file_perms;
Chris PeBenito e8d0a6
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 98a8ea
dev_read_rand(system_mail_t)
Karl MacMillan f0c985
dev_read_urand(system_mail_t)
Chris PeBenito 075c4f
Chris PeBenito 93727e
fs_read_eventpollfs(system_mail_t)
Chris PeBenito 93727e
Chris PeBenito c9428d
init_use_script_pty(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 fe9d17
	typealias system_mail_t alias sysadm_mail_t;
Chris PeBenito fe9d17
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 88dd38
	# for reading .forward - maybe we need a new type for it?
Chris PeBenito 88dd38
	# also for delivering mail to maildir
Chris PeBenito 88dd38
	# cjp: fix this to generic_user interfaces
Chris PeBenito 88dd38
	userdom_manage_user_home_subdirs(user,mailserver_delivery)
Chris PeBenito 88dd38
	userdom_manage_user_home_subdir_files(user,mailserver_delivery)
Chris PeBenito 88dd38
	userdom_manage_user_home_subdir_symlinks(user,mailserver_delivery)
Chris PeBenito 88dd38
	userdom_manage_user_home_subdir_pipes(user,mailserver_delivery)
Chris PeBenito 88dd38
	userdom_manage_user_home_subdir_sockets(user,mailserver_delivery)
Chris PeBenito 88dd38
	userdom_create_user_home(user,mailserver_delivery,{ dir file lnk_file fifo_file sock_file })
Chris PeBenito 88dd38
Chris PeBenito af4752
# cjp: another require-in-else to resolve
Chris PeBenito 132880
#	optional_policy(`postfix',`',`
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_exec_ld_so(system_mail_t)
Chris PeBenito 246839
		libs_exec_lib_files(system_mail_t)
Chris PeBenito af4752
#	')
Chris PeBenito 246839
')
Chris PeBenito 246839
Chris PeBenito 132880
optional_policy(`apache',`
Chris PeBenito e749cd
	apache_read_squirrelmail_data(system_mail_t)
Chris PeBenito e749cd
	apache_append_squirrelmail_data(system_mail_t)
Chris PeBenito e749cd
Chris PeBenito e749cd
	# apache should set close-on-exec
Chris PeBenito e749cd
	apache_dontaudit_append_log(system_mail_t)
Chris PeBenito e749cd
	apache_dontaudit_rw_stream_socket(system_mail_t)
Chris PeBenito e749cd
	apache_dontaudit_rw_tcp_socket(system_mail_t)
Chris PeBenito e749cd
	apache_dontaudit_rw_sys_script_stream_socket(system_mail_t)
Chris PeBenito e749cd
')
Chris PeBenito e749cd
Chris PeBenito 132880
optional_policy(`arpwatch',`
Chris PeBenito 1504ff
	arpwatch_manage_tmp_files(system_mail_t)
Chris PeBenito 1504ff
Chris PeBenito 1504ff
	ifdef(`hide_broken_symptoms', `
Chris PeBenito 1504ff
		arpwatch_dontaudit_rw_packet_socket(system_mail_t)
Chris PeBenito 1504ff
	')
Chris PeBenito e8d0a6
')
Chris PeBenito e8d0a6
Chris PeBenito 132880
optional_policy(`cron',`
Chris PeBenito 246839
	cron_read_system_job_tmp_files(system_mail_t)
Chris PeBenito a77e65
	cron_dontaudit_write_pipe(system_mail_t)
Chris PeBenito 246839
')
Chris PeBenito 246839
Chris PeBenito 132880
optional_policy(`cvs',`
Chris PeBenito 93070c
	cvs_read_data(system_mail_t)
Chris PeBenito 93070c
')
Chris PeBenito 93070c
Chris PeBenito 132880
optional_policy(`logrotate',`
Chris PeBenito 246839
	logrotate_read_tmp_files(system_mail_t)
Chris PeBenito 246839
')
Chris PeBenito 246839
Chris PeBenito 020cbe
optional_policy(`logwatch',`
Chris PeBenito 020cbe
	logwatch_read_tmp_files(system_mail_t)
Chris PeBenito 020cbe
')
Chris PeBenito 020cbe
Chris PeBenito 132880
optional_policy(`postfix',`
Chris PeBenito 04926d
	allow system_mail_t etc_aliases_t:dir create_dir_perms;
Chris PeBenito 04926d
	allow system_mail_t etc_aliases_t:file create_file_perms;
Chris PeBenito 04926d
	allow system_mail_t etc_aliases_t:lnk_file create_lnk_perms;
Chris PeBenito 04926d
	allow system_mail_t etc_aliases_t:sock_file create_file_perms;
Chris PeBenito 04926d
	allow system_mail_t etc_aliases_t:fifo_file create_file_perms;
Chris PeBenito 9d5949
	files_filetrans_etc(system_mail_t,etc_aliases_t,{ file lnk_file sock_file fifo_file })
Chris PeBenito 04926d
Chris PeBenito d3f715
	domain_use_wide_inherit_fd(system_mail_t)
Chris PeBenito d3f715
Chris PeBenito 1504ff
	# postfix needs this for newaliases
Chris PeBenito 1504ff
	files_getattr_tmp_dir(system_mail_t)
Chris PeBenito 725926
Chris PeBenito 1504ff
	postfix_exec_master(system_mail_t)
Chris PeBenito 7bba9d
Chris PeBenito 1504ff
	ifdef(`distro_redhat',`
Chris PeBenito 1504ff
		# compatability for old default main.cf
Chris PeBenito 9d5949
		postfix_filetrans_config(system_mail_t,etc_aliases_t,{ dir file lnk_file sock_file fifo_file })
Chris PeBenito 1504ff
	')
Chris PeBenito 1504ff
Chris PeBenito 1504ff
	optional_policy(`cron',`
Chris PeBenito 1504ff
		cron_crw_tcp_socket(system_mail_t)
Chris PeBenito 1504ff
	')
Chris PeBenito 246839
')
Chris PeBenito 246839
Chris PeBenito 132880
optional_policy(`sendmail',`
Chris PeBenito 1504ff
	userdom_dontaudit_use_unpriv_user_pty(system_mail_t)
Chris PeBenito df00b2
Chris PeBenito 1504ff
	optional_policy(`cron',`
Chris PeBenito 1504ff
		cron_dontaudit_append_system_job_tmp_files(system_mail_t)
Chris PeBenito df00b2
	')
Chris PeBenito 7bba9d
')
Chris PeBenito 075c4f
Chris PeBenito 871b68
optional_policy(`smartmon',`
Chris PeBenito 871b68
	smartmon_read_tmp(system_mail_t)
Chris PeBenito 871b68
')
Chris PeBenito 871b68
Chris PeBenito 1504ff
# should break this up among sections:
Chris PeBenito 725926
Chris PeBenito 132880
optional_policy(`arpwatch',`
Chris PeBenito 4483ee
	# why is mail delivered to a directory of type arpwatch_data_t?
Chris PeBenito 725926
	arpwatch_search_data(mailserver_delivery)
Chris PeBenito 4483ee
	arpwatch_manage_tmp_files(mta_user_agent)
Chris PeBenito 4483ee
	ifdef(`hide_broken_symptoms', `
Chris PeBenito 4483ee
		arpwatch_dontaudit_rw_packet_socket(mta_user_agent)
Chris PeBenito 4483ee
	')
Chris PeBenito 1504ff
	optional_policy(`cron',`
Chris PeBenito 1504ff
		cron_read_system_job_tmp_files(mta_user_agent)
Chris PeBenito 1504ff
	')
Chris PeBenito 4483ee
')
Chris PeBenito a77e65
Chris PeBenito a77e65
ifdef(`TODO',`
Chris PeBenito a77e65
# for the start script to run make -C /etc/mail
Chris PeBenito a77e65
allow initrc_t etc_mail_t:dir rw_dir_perms;
Chris PeBenito a77e65
allow initrc_t etc_mail_t:file create_file_perms;
Chris PeBenito a77e65
')