Chris PeBenito 17de1b
Chris PeBenito d46cfe
policy_module(mta,1.7.1)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
attribute mta_user_agent;
Chris PeBenito 17de1b
attribute mailserver_delivery;
Chris PeBenito 17de1b
attribute mailserver_domain;
Chris PeBenito 17de1b
attribute mailserver_sender;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
attribute user_mail_domain;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type etc_aliases_t;
Chris PeBenito 17de1b
files_type(etc_aliases_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type etc_mail_t;
Chris PeBenito 17de1b
files_config_file(etc_mail_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type mqueue_spool_t;
Chris PeBenito 17de1b
files_type(mqueue_spool_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type mail_spool_t;
Chris PeBenito 17de1b
files_type(mail_spool_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type sendmail_exec_t;
Chris PeBenito d46cfe
application_executable_file(sendmail_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
mta_base_mail_template(system)
Chris PeBenito 17de1b
role system_r types system_mail_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# cjp: need to resolve this, but require{}
Chris PeBenito 17de1b
# does not work in the else part of the optional
Chris PeBenito 17de1b
#ifdef(`strict_policy',`
Chris PeBenito 17de1b
#	optional_policy(`',`
Chris PeBenito 17de1b
#		init_system_domain(system_mail_t,sendmail_exec_t)
Chris PeBenito 17de1b
#	')
Chris PeBenito 17de1b
#')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# System mail local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# newalias required this, not sure if it is needed in 'if' file
Chris PeBenito 17de1b
allow system_mail_t self:capability { dac_override };
Chris PeBenito 17de1b
Chris PeBenito c0868a
read_files_pattern(system_mail_t,etc_mail_t,etc_mail_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_system_state(system_mail_t)
Chris PeBenito 17de1b
kernel_read_network_state(system_mail_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
dev_read_rand(system_mail_t)
Chris PeBenito 17de1b
dev_read_urand(system_mail_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
init_use_script_ptys(system_mail_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
userdom_use_sysadm_terms(system_mail_t)
Chris PeBenito 6b19be
userdom_dontaudit_search_sysadm_home_dirs(system_mail_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`targeted_policy',`
Chris PeBenito 17de1b
	typealias system_mail_t alias sysadm_mail_t;
Chris PeBenito 17de1b
Chris PeBenito c0868a
	manage_dirs_pattern(system_mail_t,mail_spool_t,mail_spool_t)
Chris PeBenito c0868a
	manage_files_pattern(system_mail_t,mail_spool_t,mail_spool_t)
Chris PeBenito c0868a
	manage_lnk_files_pattern(system_mail_t,mail_spool_t,mail_spool_t)
Chris PeBenito c0868a
	manage_fifo_files_pattern(system_mail_t,mail_spool_t,mail_spool_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# for reading .forward - maybe we need a new type for it?
Chris PeBenito 17de1b
	# also for delivering mail to maildir
Chris PeBenito 17de1b
	userdom_manage_generic_user_home_content_dirs(mailserver_delivery)
Chris PeBenito 17de1b
	userdom_manage_generic_user_home_content_files(mailserver_delivery)
Chris PeBenito 17de1b
	userdom_manage_generic_user_home_content_symlinks(mailserver_delivery)
Chris PeBenito 17de1b
	userdom_manage_generic_user_home_content_sockets(mailserver_delivery)
Chris PeBenito 17de1b
	userdom_manage_generic_user_home_content_pipes(mailserver_delivery)
Chris PeBenito 17de1b
	userdom_generic_user_home_dir_filetrans_generic_user_home_content(mailserver_delivery,{ dir file lnk_file sock_file fifo_file })
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# cjp: another require-in-else to resolve
Chris PeBenito 17de1b
#	optional_policy(`',`
Chris PeBenito 17de1b
		corecmd_exec_all_executables(system_mail_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
		files_exec_etc_files(system_mail_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
		libs_exec_ld_so(system_mail_t)
Chris PeBenito 17de1b
		libs_exec_lib_files(system_mail_t)
Chris PeBenito 17de1b
#	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	apache_read_squirrelmail_data(system_mail_t)
Chris PeBenito 17de1b
	apache_append_squirrelmail_data(system_mail_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# apache should set close-on-exec
Chris PeBenito 17de1b
	apache_dontaudit_append_log(system_mail_t)
Chris PeBenito 17de1b
	apache_dontaudit_rw_stream_sockets(system_mail_t)
Chris PeBenito 17de1b
	apache_dontaudit_rw_tcp_sockets(system_mail_t)
Chris PeBenito 17de1b
	apache_dontaudit_rw_sys_script_stream_sockets(system_mail_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	arpwatch_manage_tmp_files(system_mail_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	ifdef(`hide_broken_symptoms', `
Chris PeBenito 17de1b
		arpwatch_dontaudit_rw_packet_sockets(system_mail_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	cron_read_system_job_tmp_files(system_mail_t)
Chris PeBenito 17de1b
	cron_dontaudit_write_pipes(system_mail_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	cvs_read_data(system_mail_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	logrotate_read_tmp_files(system_mail_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	logwatch_read_tmp_files(system_mail_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	nagios_read_tmp_files(system_mail_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito c0868a
	manage_dirs_pattern(system_mail_t,etc_aliases_t,etc_aliases_t)
Chris PeBenito c0868a
	manage_files_pattern(system_mail_t,etc_aliases_t,etc_aliases_t)
Chris PeBenito c0868a
	manage_lnk_files_pattern(system_mail_t,etc_aliases_t,etc_aliases_t)
Chris PeBenito c0868a
	manage_fifo_files_pattern(system_mail_t,etc_aliases_t,etc_aliases_t)
Chris PeBenito c0868a
	manage_sock_files_pattern(system_mail_t,etc_aliases_t,etc_aliases_t)
Chris PeBenito 17de1b
	files_etc_filetrans(system_mail_t,etc_aliases_t,{ file lnk_file sock_file fifo_file })
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	domain_use_interactive_fds(system_mail_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# postfix needs this for newaliases
Chris PeBenito 17de1b
	files_getattr_tmp_dirs(system_mail_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	postfix_exec_master(system_mail_t)
Chris PeBenito 17de1b
	postfix_read_config(system_mail_t)
Chris PeBenito 17de1b
	postfix_search_spool(system_mail_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	ifdef(`distro_redhat',`
Chris PeBenito 17de1b
		# compatability for old default main.cf
Chris PeBenito 17de1b
		postfix_config_filetrans(system_mail_t,etc_aliases_t,{ dir file lnk_file sock_file fifo_file })
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
		cron_rw_tcp_sockets(system_mail_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	qmail_domtrans_inject(system_mail_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	sxid_read_log(system_mail_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	userdom_dontaudit_use_unpriv_users_ptys(system_mail_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
		cron_dontaudit_append_system_job_tmp_files(system_mail_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	smartmon_read_tmp_files(system_mail_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# should break this up among sections:
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	# why is mail delivered to a directory of type arpwatch_data_t?
Chris PeBenito 17de1b
	arpwatch_search_data(mailserver_delivery)
Chris PeBenito 17de1b
	arpwatch_manage_tmp_files(mta_user_agent)
Chris PeBenito 17de1b
	ifdef(`hide_broken_symptoms', `
Chris PeBenito 17de1b
		arpwatch_dontaudit_rw_packet_sockets(mta_user_agent)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
		cron_read_system_job_tmp_files(mta_user_agent)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')