Chris PeBenito 4bf4ed
## <summary>Policy common to all email tranfer agents.</summary>
Chris PeBenito 6b9383
Chris PeBenito 12ae75
########################################
Chris PeBenito 12ae75
## <summary>
Chris PeBenito 12ae75
##	MTA stub interface.  No access allowed.
Chris PeBenito 12ae75
## </summary>
Chris PeBenito 12ae75
## <param name="domain" optional="true">
Chris PeBenito 12ae75
##	N/A
Chris PeBenito 12ae75
## </param>
Chris PeBenito 12ae75
#
Chris PeBenito 12ae75
interface(`mta_stub',`
Chris PeBenito 12ae75
	gen_require(`
Chris PeBenito 12ae75
		type sendmail_exec_t;
Chris PeBenito 12ae75
	')
Chris PeBenito 12ae75
')
Chris PeBenito 12ae75
Chris PeBenito 6b9383
#######################################
Chris PeBenito 451c1e
## <summary>
Chris PeBenito 451c1e
##	The per user domain template for the mta module.
Chris PeBenito 451c1e
## </summary>
Chris PeBenito 451c1e
## <desc>
Chris PeBenito 451c1e
##	

Chris PeBenito 451c1e
##	This template creates a derived domain which is
Chris PeBenito 451c1e
##	a email transfer agent, which sends mail on
Chris PeBenito 451c1e
##	behalf of the user.
Chris PeBenito 451c1e
##	

Chris PeBenito 451c1e
##	

Chris PeBenito 451c1e
##	This template is invoked automatically for each user, and
Chris PeBenito 451c1e
##	generally does not need to be invoked directly
Chris PeBenito 451c1e
##	by policy writers.
Chris PeBenito 451c1e
##	

Chris PeBenito 451c1e
## </desc>
Chris PeBenito 451c1e
## <param name="userdomain_prefix">
Chris PeBenito 451c1e
##	The prefix of the user domain (e.g., user
Chris PeBenito 451c1e
##	is the prefix for user_t).
Chris PeBenito 451c1e
## </param>
Chris PeBenito 451c1e
## <param name="user_domain">
Chris PeBenito 451c1e
##	The type of the user domain.
Chris PeBenito 451c1e
## </param>
Chris PeBenito 451c1e
## <param name="user_role">
Chris PeBenito 451c1e
##	The role associated with the user domain.
Chris PeBenito 451c1e
## </param>
Chris PeBenito 6b9383
#
Chris PeBenito 199895
template(`mta_per_userdomain_template',`
Chris PeBenito 0efe52
	gen_require(`
Chris PeBenito 04926d
		attribute mailserver_domain, mta_user_agent, user_mail_domain;
Chris PeBenito 0efe52
		type sendmail_exec_t;
Chris PeBenito 0efe52
	')
Chris PeBenito 0efe52
Chris PeBenito 04926d
	type $1_mail_t, user_mail_domain;
Chris PeBenito c9428d
	domain_type($1_mail_t)
Chris PeBenito 451c1e
	role $3 types $1_mail_t;
Chris PeBenito 6b9383
Chris PeBenito 0c73cd
	type $1_mail_tmp_t;
Chris PeBenito c9428d
	files_tmp_file($1_mail_tmp_t)
Chris PeBenito 6b9383
Chris PeBenito 0c73cd
	##############################
Chris PeBenito 0c73cd
	#
Chris PeBenito 0c73cd
	# $1_mail_t local policy
Chris PeBenito 0c73cd
	#
Chris PeBenito 075c4f
Chris PeBenito 0c73cd
	allow $1_mail_t self:capability { setuid setgid chown };
Chris PeBenito 0a10b1
	allow $1_mail_t self:process { signal_perms setrlimit };
Chris PeBenito 0a10b1
	allow $1_mail_t self:tcp_socket create_socket_perms;
Chris PeBenito 075c4f
Chris PeBenito 0c73cd
	# re-exec itself
Chris PeBenito 0a10b1
	can_exec($1_mail_t, sendmail_exec_t)
Chris PeBenito 0a10b1
	allow $1_mail_t sendmail_exec_t:lnk_file r_file_perms;
Chris PeBenito 075c4f
Chris PeBenito 0c73cd
	# Transition from the user domain to the derived domain.
Chris PeBenito 451c1e
	domain_auto_trans($2, sendmail_exec_t, $1_mail_t)
Chris PeBenito 451c1e
	allow $2 sendmail_exec_t:lnk_file { getattr read };
Chris PeBenito 075c4f
Chris PeBenito 451c1e
	allow $2 $1_mail_t:fd use;
Chris PeBenito 451c1e
	allow $1_mail_t $2:fd use;
Chris PeBenito 451c1e
	allow $1_mail_t $2:fifo_file rw_file_perms;
Chris PeBenito 451c1e
	allow $1_mail_t $2:process sigchld;
Chris PeBenito 075c4f
Chris PeBenito 246839
	# For when the user wants to send mail via port 25 localhost
Chris PeBenito 246839
	kernel_tcp_recvfrom($2)
Chris PeBenito 246839
	allow $2 mailserver_domain:tcp_socket { connectto recvfrom };
Chris PeBenito 246839
	allow mailserver_domain $2:tcp_socket { acceptfrom recvfrom };
Chris PeBenito 246839
Chris PeBenito 0c73cd
	kernel_read_kernel_sysctl($1_mail_t)
Chris PeBenito 075c4f
Chris PeBenito 0fd9dc
	corenet_tcp_sendrecv_all_if($1_mail_t)
Chris PeBenito 0fd9dc
	corenet_raw_sendrecv_all_if($1_mail_t)
Chris PeBenito 0fd9dc
	corenet_tcp_sendrecv_all_nodes($1_mail_t)
Chris PeBenito 0fd9dc
	corenet_raw_sendrecv_all_nodes($1_mail_t)
Chris PeBenito 0fd9dc
	corenet_tcp_sendrecv_all_ports($1_mail_t)
Chris PeBenito 0fd9dc
	corenet_tcp_bind_all_nodes($1_mail_t)
Chris PeBenito cff75c
	corenet_tcp_connect_all_ports($1_mail_t)
Chris PeBenito 075c4f
Chris PeBenito c9428d
	domain_use_wide_inherit_fd($1_mail_t)
Chris PeBenito 075c4f
Chris PeBenito c9428d
	libs_use_ld_so($1_mail_t)
Chris PeBenito c9428d
	libs_use_shared_libs($1_mail_t)
Chris PeBenito 075c4f
Chris PeBenito c9428d
	corecmd_exec_bin($1_mail_t)
Chris PeBenito b24f35
	corecmd_search_sbin($1_mail_t)
Chris PeBenito 075c4f
Chris PeBenito 8fd367
	files_read_etc_files($1_mail_t)
Chris PeBenito b24f35
	files_search_spool($1_mail_t)
Chris PeBenito 246839
	# It wants to check for nscd
Chris PeBenito 246839
	files_dontaudit_search_pids($1_mail_t)
Chris PeBenito 6b9383
Chris PeBenito c9428d
	logging_send_syslog_msg($1_mail_t)
Chris PeBenito 075c4f
Chris PeBenito 0c73cd
	miscfiles_read_localization($1_mail_t)
Chris PeBenito 075c4f
Chris PeBenito c9428d
	sysnet_read_config($1_mail_t)
Chris PeBenito 98a8ea
	sysnet_dns_name_resolve($1_mail_t)
Chris PeBenito 075c4f
Chris PeBenito 451c1e
	userdom_use_user_terminals($1,$1_mail_t)
Chris PeBenito 246839
	# Write to the user domain tty. cjp: why?
Chris PeBenito 246839
	userdom_use_user_terminals($1,mta_user_agent)
Chris PeBenito 88dd38
	# Create dead.letter in user home directories.
Chris PeBenito 88dd38
	userdom_manage_user_home_subdir_files($1,$1_mail_t)
Chris PeBenito 88dd38
	userdom_create_user_home($1,$1_mail_t,file)
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
	userdom_manage_user_home_subdirs($1,mailserver_delivery)
Chris PeBenito 88dd38
	userdom_manage_user_home_subdir_files($1,mailserver_delivery)
Chris PeBenito 88dd38
	userdom_manage_user_home_subdir_symlinks($1,mailserver_delivery)
Chris PeBenito 88dd38
	userdom_manage_user_home_subdir_pipes($1,mailserver_delivery)
Chris PeBenito 88dd38
	userdom_manage_user_home_subdir_sockets($1,mailserver_delivery)
Chris PeBenito 88dd38
	userdom_create_user_home($1,mailserver_delivery,{ dir file lnk_file fifo_file sock_file })
Chris PeBenito 451c1e
Chris PeBenito b24f35
	tunable_policy(`use_samba_home_dirs',`
Chris PeBenito b24f35
		fs_manage_cifs_files($1_mail_t)
Chris PeBenito b24f35
		fs_manage_cifs_symlinks($1_mail_t)
Chris PeBenito b24f35
	')
Chris PeBenito b24f35
Chris PeBenito ab940a
	optional_policy(`nis.te',`
Chris PeBenito ab940a
		nis_use_ypbind($1_mail_t)
Chris PeBenito ab940a
	')
Chris PeBenito ab940a
Chris PeBenito 493d6c
	optional_policy(`nscd.te',`
Chris PeBenito 493d6c
		nscd_use_socket($1_mail_t)
Chris PeBenito 493d6c
	')
Chris PeBenito 493d6c
Chris PeBenito 04926d
	optional_policy(`postfix.te',`
Chris PeBenito 04926d
		allow $1_mail_t self:capability dac_override;
Chris PeBenito 04926d
		postfix_read_config($1_mail_t)
Chris PeBenito 04926d
		postfix_list_spool($1_mail_t)
Chris PeBenito 04926d
	')
Chris PeBenito 04926d
Chris PeBenito 12ae75
	ifdef(`TODO',`
Chris PeBenito 0c73cd
	optional_policy(`procmail.te',`
Chris PeBenito 0c73cd
		procmail_execute($1_mail_t)
Chris PeBenito 0c73cd
	')
Chris PeBenito 075c4f
Chris PeBenito 0c73cd
	# Read user temporary files.
Chris PeBenito 0c73cd
	allow $1_mail_t $1_tmp_t:file r_file_perms;
Chris PeBenito 0c73cd
	dontaudit $1_mail_t $1_tmp_t:file append;
Chris PeBenito b24f35
	ifdef(`postfix.te',`
Chris PeBenito 0c73cd
		# postfix seems to need write access if the file handle is opened read/write
Chris PeBenito 0c73cd
		allow $1_mail_t $1_tmp_t:file write;
Chris PeBenito 0c73cd
	')
Chris PeBenito 075c4f
Chris PeBenito 246839
	# cjp: why?
Chris PeBenito 0a10b1
	allow mta_user_agent $1_tmp_t:file r_file_perms;
Chris PeBenito 075c4f
Chris PeBenito 0c73cd
	# Inherit and use descriptors from gnome-pty-helper.
Chris PeBenito 0c73cd
	ifdef(`gnome-pty-helper.te', `allow $1_mail_t $1_gph_t:fd use;')
Chris PeBenito 075c4f
Chris PeBenito 0c73cd
	# if you do not want to allow dead.letter then use the following instead
Chris PeBenito 0c73cd
	#allow $1_mail_t { $1_home_dir_t $1_home_t }:dir r_dir_perms;
Chris PeBenito 0c73cd
	#allow $1_mail_t $1_home_t:file r_file_perms;
Chris PeBenito 075c4f
Chris PeBenito 0c73cd
	ifdef(`qmail.te', `
Chris PeBenito 0c73cd
		allow $1_mail_t qmail_etc_t:dir search;
Chris PeBenito 0c73cd
		allow $1_mail_t qmail_etc_t:{ file lnk_file } read;
Chris PeBenito 0c73cd
	')
Chris PeBenito 075c4f
Chris PeBenito 0c73cd
	') dnl end TODO
Chris PeBenito 6b9383
')
Chris PeBenito 6b9383
Chris PeBenito 075c4f
#######################################
Chris PeBenito 075c4f
#
Chris PeBenito c9428d
# mta_mailserver(domain,entrypointtype)
Chris PeBenito 075c4f
#
Chris PeBenito 199895
interface(`mta_mailserver',`
Chris PeBenito 5e6f9e
	gen_require(`
Chris PeBenito 5e6f9e
		attribute mailserver_domain;
Chris PeBenito 5e6f9e
	')
Chris PeBenito 0c73cd
Chris PeBenito 246839
	# For when the user wants to send mail via port 25 localhost
Chris PeBenito 246839
	kernel_tcp_recvfrom($1)
Chris PeBenito 246839
Chris PeBenito c9428d
	init_daemon_domain($1,$2)
Chris PeBenito 0c73cd
	typeattribute $1 mailserver_domain;
Chris PeBenito 075c4f
')
Chris PeBenito 075c4f
Chris PeBenito e5f806
########################################
Chris PeBenito e5f806
## <summary>
Chris PeBenito e5f806
##	Modified mailserver interface for
Chris PeBenito e5f806
##	sendmail daemon use.
Chris PeBenito e5f806
## </summary>
Chris PeBenito e5f806
## <desc>
Chris PeBenito e5f806
##	

Chris PeBenito e5f806
##	A modified MTA mail server interface for
Chris PeBenito e5f806
##	the sendmail program.  It's design does
Chris PeBenito e5f806
##	not fit well with policy, and using the
Chris PeBenito e5f806
##	regular interface causes a type_transition
Chris PeBenito e5f806
##	conflict if direct running of init scripts
Chris PeBenito e5f806
##	is enabled.
Chris PeBenito e5f806
##	

Chris PeBenito e5f806
##	

Chris PeBenito e5f806
##	This interface should most likely only be used
Chris PeBenito e5f806
##	by the sendmail policy.
Chris PeBenito e5f806
##	

Chris PeBenito e5f806
## </desc>
Chris PeBenito e5f806
## <param name="domain">
Chris PeBenito e5f806
##	The type to be used for the mail server.
Chris PeBenito e5f806
## </param>
Chris PeBenito e5f806
## <param name="entry_point">
Chris PeBenito e5f806
##	The type to be used for the domain entry point program.
Chris PeBenito e5f806
## </param>
Chris PeBenito 199895
interface(`mta_sendmail_mailserver',`
Chris PeBenito 5e6f9e
	gen_require(`
Chris PeBenito e5f806
		attribute mailserver_domain;
Chris PeBenito 5e6f9e
		type sendmail_exec_t;
Chris PeBenito 5e6f9e
	')
Chris PeBenito 0c73cd
Chris PeBenito 246839
	# For when the user wants to send mail via port 25 localhost
Chris PeBenito 246839
	kernel_tcp_recvfrom($1)
Chris PeBenito 246839
Chris PeBenito e5f806
	init_system_domain($1,sendmail_exec_t)
Chris PeBenito e5f806
	typeattribute $1 mailserver_domain;
Chris PeBenito 7bba9d
')
Chris PeBenito 7bba9d
Chris PeBenito 7bba9d
#######################################
Chris PeBenito 246839
## <summary>
Chris PeBenito 246839
##	Make a type a mailserver type used
Chris PeBenito 246839
##	for sending mail.
Chris PeBenito 246839
## </summary>
Chris PeBenito 246839
## <param name="domain">
Chris PeBenito 246839
##	Mail server domain type used for sending mail.
Chris PeBenito 246839
## </param>
Chris PeBenito 246839
#
Chris PeBenito 246839
interface(`mta_mailserver_sender',`
Chris PeBenito 246839
	gen_require(`
Chris PeBenito 246839
		attribute mailserver_sender;
Chris PeBenito 246839
	')
Chris PeBenito 246839
Chris PeBenito 246839
	typeattribute $1 mailserver_sender;
Chris PeBenito 246839
')
Chris PeBenito 246839
Chris PeBenito 246839
#######################################
Chris PeBenito 246839
## <summary>
Chris PeBenito 246839
##	Make a type a mailserver type used
Chris PeBenito 246839
##	for delivering mail to local users.
Chris PeBenito 246839
## </summary>
Chris PeBenito 246839
## <param name="domain">
Chris PeBenito 246839
##	Mail server domain type used for delivering mail.
Chris PeBenito 246839
## </param>
Chris PeBenito 246839
#
Chris PeBenito 246839
interface(`mta_mailserver_delivery',`
Chris PeBenito 246839
	gen_require(`
Chris PeBenito 246839
		attribute mailserver_delivery;
Chris PeBenito 88dd38
		type mail_spool_t;
Chris PeBenito 246839
	')
Chris PeBenito 246839
Chris PeBenito 246839
	typeattribute $1 mailserver_delivery;
Chris PeBenito 799a0b
Chris PeBenito 88dd38
	allow $1 mail_spool_t:dir ra_dir_perms;
Chris PeBenito 88dd38
	allow $1 mail_spool_t:file { create ioctl read getattr lock append };
Chris PeBenito 88dd38
	allow $1 mail_spool_t:lnk_file { create read getattr };
Chris PeBenito 88dd38
Chris PeBenito 29ce00
	optional_policy(`dovecot.te',`
Chris PeBenito 29ce00
		dovecot_manage_spool($1)
Chris PeBenito 29ce00
	')
Chris PeBenito 29ce00
Chris PeBenito 799a0b
	optional_policy(`mailman.te',`
Chris PeBenito 799a0b
		# so MTA can access /var/lib/mailman/mail/wrapper
Chris PeBenito 799a0b
		files_search_var_lib($1)
Chris PeBenito 799a0b
Chris PeBenito 799a0b
		mailman_domtrans($1)
Chris PeBenito 799a0b
		mailman_read_data_symlinks($1)
Chris PeBenito 799a0b
	')
Chris PeBenito 246839
')
Chris PeBenito 246839
Chris PeBenito 246839
#######################################
Chris PeBenito 246839
## <summary>
Chris PeBenito 246839
##	Make a type a mailserver type used
Chris PeBenito 246839
##	for sending mail on behalf of local
Chris PeBenito 246839
##	users to the local mail spool.
Chris PeBenito 246839
## </summary>
Chris PeBenito 246839
## <param name="domain">
Chris PeBenito 246839
##	Mail server domain type used for sending local mail.
Chris PeBenito 246839
## </param>
Chris PeBenito 246839
#
Chris PeBenito 246839
interface(`mta_mailserver_user_agent',`
Chris PeBenito 246839
	gen_require(`
Chris PeBenito e749cd
		attribute mta_user_agent;
Chris PeBenito 246839
	')
Chris PeBenito 246839
Chris PeBenito e749cd
	typeattribute $1 mta_user_agent;
Chris PeBenito e749cd
Chris PeBenito e749cd
	optional_policy(`apache.te',`
Chris PeBenito e749cd
		# apache should set close-on-exec
Chris PeBenito e749cd
		apache_dontaudit_rw_stream_socket($1)
Chris PeBenito e749cd
		apache_dontaudit_rw_sys_script_stream_socket($1)
Chris PeBenito e749cd
	')
Chris PeBenito 246839
')
Chris PeBenito 246839
Chris PeBenito 246839
#######################################
Chris PeBenito 7bba9d
#
Chris PeBenito c6a3a2
# mta_send_mail(domain)
Chris PeBenito 075c4f
#
Chris PeBenito 199895
interface(`mta_send_mail',`
Chris PeBenito 5e6f9e
	gen_require(`
Chris PeBenito 88dd38
		attribute mta_user_agent;
Chris PeBenito 5e6f9e
		type system_mail_t, sendmail_exec_t;
Chris PeBenito 5e6f9e
	')
Chris PeBenito 0c73cd
Chris PeBenito 0a10b1
	allow $1 sendmail_exec_t:lnk_file r_file_perms;
Chris PeBenito 0a10b1
	domain_auto_trans($1, sendmail_exec_t, system_mail_t)
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	allow $1 system_mail_t:fd use;
Chris PeBenito 0c73cd
	allow system_mail_t $1:fd use;
Chris PeBenito 0c73cd
	allow system_mail_t $1:fifo_file rw_file_perms;
Chris PeBenito 0c73cd
	allow system_mail_t $1:process sigchld;
Chris PeBenito 953541
Chris PeBenito 953541
	allow mta_user_agent $1:fd use;
Chris PeBenito 953541
	allow mta_user_agent $1:process sigchld;
Chris PeBenito 953541
	allow mta_user_agent $1:fifo_file { read write };
Chris PeBenito 075c4f
')
Chris PeBenito 075c4f
Chris PeBenito 075c4f
#######################################
Chris PeBenito 075c4f
#
Chris PeBenito c9428d
# mta_exec(domain)
Chris PeBenito 075c4f
#
Chris PeBenito 199895
interface(`mta_exec',`
Chris PeBenito 5e6f9e
	gen_require(`
Chris PeBenito 5e6f9e
		type sendmail_exec_t;
Chris PeBenito 5e6f9e
	')
Chris PeBenito 0c73cd
Chris PeBenito 0a10b1
	can_exec($1, sendmail_exec_t)
Chris PeBenito 075c4f
')
Chris PeBenito 075c4f
Chris PeBenito daa0e0
########################################
Chris PeBenito f7ebea
## <summary>
Chris PeBenito f932d8
##	Read mail server configuration.
Chris PeBenito f932d8
## </summary>
Chris PeBenito f932d8
## <param name="domain">
Chris PeBenito f932d8
##	The type of the process performing this action.
Chris PeBenito f932d8
## </param>
Chris PeBenito f932d8
#
Chris PeBenito f932d8
interface(`mta_read_config',`
Chris PeBenito f932d8
	gen_require(`
Chris PeBenito f932d8
		type etc_mail_t;
Chris PeBenito f932d8
	')
Chris PeBenito f932d8
Chris PeBenito f932d8
	files_search_etc($1)
Chris PeBenito 30705b
	allow $1 etc_mail_t:dir list_dir_perms;
Chris PeBenito 30705b
	allow $1 etc_mail_t:file r_file_perms;
Chris PeBenito 30705b
	allow $1 etc_mail_t:lnk_file { getattr read };
Chris PeBenito f932d8
')
Chris PeBenito f932d8
Chris PeBenito f932d8
########################################
Chris PeBenito f932d8
## <summary>
Chris PeBenito 414e41
##	Read mail address aliases.
Chris PeBenito f7ebea
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito daa0e0
#
Chris PeBenito 199895
interface(`mta_read_aliases',`
Chris PeBenito 5e6f9e
	gen_require(`
Chris PeBenito 5e6f9e
		type etc_aliases_t;
Chris PeBenito 5e6f9e
		class file r_file_perms;
Chris PeBenito 5e6f9e
	')
Chris PeBenito 0c73cd
Chris PeBenito 5e6f9e
	files_search_etc($1)
Chris PeBenito 0a10b1
	allow $1 etc_aliases_t:file r_file_perms;
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito 7bba9d
#######################################
Chris PeBenito 7bba9d
#
Chris PeBenito c9428d
# mta_rw_aliases(domain)
Chris PeBenito 7bba9d
#
Chris PeBenito 199895
interface(`mta_rw_aliases',`
Chris PeBenito 5e6f9e
	gen_require(`
Chris PeBenito 5e6f9e
		type etc_aliases_t;
Chris PeBenito 5e6f9e
		class file { rw_file_perms setattr };
Chris PeBenito 5e6f9e
	')
Chris PeBenito 0c73cd
Chris PeBenito 5e6f9e
	files_search_etc($1)
Chris PeBenito 04926d
	allow $1 etc_aliases_t:file { rw_file_perms setattr };
Chris PeBenito 7bba9d
')
Chris PeBenito 7bba9d
Chris PeBenito 7bba9d
#######################################
Chris PeBenito a42ca7
## <summary>
Chris PeBenito 799a0b
##	Do not audit attempts to read and write TCP
Chris PeBenito 799a0b
##	sockets of mail delivery domains.
Chris PeBenito 799a0b
## </summary>
Chris PeBenito 799a0b
## <param name="domain">
Chris PeBenito 799a0b
##	Mail server domain.
Chris PeBenito 799a0b
## </param>
Chris PeBenito 799a0b
#
Chris PeBenito 799a0b
interface(`mta_dontaudit_rw_delivery_tcp_socket',`
Chris PeBenito 799a0b
	gen_require(`
Chris PeBenito 77f6e2
		attribute mailserver_delivery;
Chris PeBenito 799a0b
	')
Chris PeBenito 799a0b
Chris PeBenito 799a0b
	dontaudit $1 mailserver_delivery:tcp_socket { read write };
Chris PeBenito 799a0b
')
Chris PeBenito 799a0b
Chris PeBenito 799a0b
#######################################
Chris PeBenito 799a0b
## <summary>
Chris PeBenito 799a0b
##	Connect to all mail servers over TCP.
Chris PeBenito 799a0b
## </summary>
Chris PeBenito 799a0b
## <param name="domain">
Chris PeBenito 799a0b
##	Mail server domain.
Chris PeBenito 799a0b
## </param>
Chris PeBenito 799a0b
#
Chris PeBenito 799a0b
interface(`mta_tcp_connect_all_mailservers',`
Chris PeBenito 799a0b
	gen_require(`
Chris PeBenito 799a0b
		attribute mailserver_domain;
Chris PeBenito 799a0b
	')
Chris PeBenito 799a0b
Chris PeBenito 799a0b
	allow $1 mailserver_domain:tcp_socket { connectto recvfrom };
Chris PeBenito 799a0b
	allow mailserver_domain $1:tcp_socket { acceptfrom recvfrom };
Chris PeBenito 799a0b
	kernel_tcp_recvfrom($1)
Chris PeBenito 799a0b
')
Chris PeBenito 799a0b
Chris PeBenito 799a0b
#######################################
Chris PeBenito 799a0b
## <summary>
Chris PeBenito a42ca7
##	Do not audit attempts to read a symlink
Chris PeBenito a42ca7
##	in the mail spool.
Chris PeBenito a42ca7
## </summary>
Chris PeBenito a42ca7
## <param name="domain">
Chris PeBenito a42ca7
##	Domain allowed access.
Chris PeBenito a42ca7
## </param>
Chris PeBenito a42ca7
#
Chris PeBenito a42ca7
interface(`mta_dontaudit_read_spool_symlink',`
Chris PeBenito a42ca7
	gen_require(`
Chris PeBenito a42ca7
		type mail_spool_t;
Chris PeBenito a42ca7
		class lnk_file read;
Chris PeBenito a42ca7
	')
Chris PeBenito a42ca7
Chris PeBenito a42ca7
	dontaudit $1 mail_spool_t:lnk_file read;
Chris PeBenito a42ca7
')
Chris PeBenito a42ca7
Chris PeBenito a42ca7
#######################################
Chris PeBenito 7bba9d
#
Chris PeBenito c9428d
# mta_getattr_spool(domain)
Chris PeBenito 4bf4ed
#
Chris PeBenito 199895
interface(`mta_getattr_spool',`
Chris PeBenito 5e6f9e
	gen_require(`
Chris PeBenito 5e6f9e
		type mail_spool_t;
Chris PeBenito 5e6f9e
		class dir r_dir_perms;
Chris PeBenito 5e6f9e
		class file getattr;
Chris PeBenito 5e6f9e
		class lnk_file read;
Chris PeBenito 5e6f9e
	')
Chris PeBenito 0c73cd
Chris PeBenito c9428d
	files_search_spool($1)
Chris PeBenito 0c73cd
	allow $1 mail_spool_t:dir r_dir_perms;
Chris PeBenito 0c73cd
	allow $1 mail_spool_t:lnk_file read;
Chris PeBenito 0c73cd
	allow $1 mail_spool_t:file getattr;
Chris PeBenito 4bf4ed
')
Chris PeBenito 4bf4ed
Chris PeBenito 4bf4ed
#######################################
Chris PeBenito 4bf4ed
#
Chris PeBenito c9428d
# mta_rw_spool(domain)
Chris PeBenito b16c6b
#
Chris PeBenito 199895
interface(`mta_rw_spool',`
Chris PeBenito 5e6f9e
	gen_require(`
Chris PeBenito 5e6f9e
		type mail_spool_t;
Chris PeBenito 5e6f9e
		class dir r_dir_perms;
Chris PeBenito b24f35
		class lnk_file { getattr read };
Chris PeBenito 5e6f9e
		class file { rw_file_perms setattr };
Chris PeBenito 5e6f9e
	')
Chris PeBenito 0c73cd
Chris PeBenito c9428d
	files_search_spool($1)
Chris PeBenito 5e6f9e
	allow $1 mail_spool_t:dir r_dir_perms;
Chris PeBenito b24f35
	allow $1 mail_spool_t:lnk_file { getattr read };
Chris PeBenito 0a10b1
	allow $1 mail_spool_t:file { rw_file_perms setattr };
Chris PeBenito b16c6b
')
Chris PeBenito b16c6b
Chris PeBenito b16c6b
#######################################
Chris PeBenito 246839
## <summary>
Chris PeBenito 246839
##	Create, read, and write the mail spool.
Chris PeBenito 246839
## </summary>
Chris PeBenito 246839
## <param name="domain">
Chris PeBenito 246839
##	Domain allowed access.
Chris PeBenito 246839
## </param>
Chris PeBenito 246839
#
Chris PeBenito 246839
interface(`mta_append_spool',`
Chris PeBenito 246839
	gen_require(`
Chris PeBenito 246839
		type mail_spool_t;
Chris PeBenito 246839
		class dir ra_dir_perms;
Chris PeBenito 246839
		class lnk_file { getattr read };
Chris PeBenito 246839
		class file create_file_perms;
Chris PeBenito 246839
	')
Chris PeBenito 246839
Chris PeBenito 246839
	files_search_spool($1)
Chris PeBenito 246839
	allow $1 mail_spool_t:dir ra_dir_perms;
Chris PeBenito 246839
	allow $1 mail_spool_t:lnk_file { getattr read };
Chris PeBenito 246839
	allow $1 mail_spool_t:file create_file_perms;
Chris PeBenito 246839
')
Chris PeBenito 246839
Chris PeBenito 246839
#######################################
Chris PeBenito 04926d
## <summary>
Chris PeBenito 04926d
##	Delete from the mail spool.
Chris PeBenito 04926d
## </summary>
Chris PeBenito 04926d
## <param name="domain">
Chris PeBenito 04926d
##	Domain allowed access.
Chris PeBenito 04926d
## </param>
Chris PeBenito 04926d
#
Chris PeBenito 04926d
interface(`mta_delete_spool',`
Chris PeBenito 04926d
	gen_require(`
Chris PeBenito 04926d
		type mail_spool_t;
Chris PeBenito 04926d
	')
Chris PeBenito 04926d
Chris PeBenito 04926d
	files_search_spool($1)
Chris PeBenito 04926d
	allow $1 mail_spool_t:dir { list_dir_perms write remove_name };
Chris PeBenito 04926d
	allow $1 mail_spool_t:file unlink;
Chris PeBenito 04926d
')
Chris PeBenito 04926d
Chris PeBenito 04926d
#######################################
Chris PeBenito b16c6b
#
Chris PeBenito c9428d
# mta_manage_spool(domain)
Chris PeBenito 7bba9d
#
Chris PeBenito 199895
interface(`mta_manage_spool',`
Chris PeBenito 5e6f9e
	gen_require(`
Chris PeBenito 5e6f9e
		type mail_spool_t;
Chris PeBenito 5e6f9e
	')
Chris PeBenito 0c73cd
Chris PeBenito c9428d
	files_search_spool($1)
Chris PeBenito 9bbc75
	allow $1 mail_spool_t:dir manage_dir_perms;
Chris PeBenito 9bbc75
	allow $1 mail_spool_t:lnk_file create_lnk_perms;
Chris PeBenito 9bbc75
	allow $1 mail_spool_t:file manage_file_perms;
Chris PeBenito 7bba9d
')
Chris PeBenito 7bba9d
Chris PeBenito 7bba9d
#######################################
Chris PeBenito 3e6c81
## <summary>
Chris PeBenito 3e6c81
##	Do not audit attempts to read and
Chris PeBenito 3e6c81
##	write the mail queue.
Chris PeBenito 3e6c81
## </summary>
Chris PeBenito 3e6c81
## <param name="domain">
Chris PeBenito 3e6c81
##	Domain to not audit.
Chris PeBenito 3e6c81
## </param>
Chris PeBenito 3e6c81
#
Chris PeBenito 3e6c81
interface(`mta_dontaudit_rw_queue',`
Chris PeBenito 3e6c81
	gen_require(`
Chris PeBenito 3e6c81
		type mqueue_spool_t;
Chris PeBenito 3e6c81
	')
Chris PeBenito 3e6c81
Chris PeBenito 3e6c81
	dontaudit $1 mqueue_spool_t:file { getattr read write };
Chris PeBenito 3e6c81
')
Chris PeBenito 3e6c81
Chris PeBenito 3e6c81
#######################################
Chris PeBenito 7bba9d
#
Chris PeBenito c9428d
# mta_manage_queue(domain)
Chris PeBenito 7bba9d
#
Chris PeBenito 199895
interface(`mta_manage_queue',`
Chris PeBenito 5e6f9e
	gen_require(`
Chris PeBenito 5e6f9e
		type mqueue_spool_t;
Chris PeBenito 5e6f9e
		class dir rw_dir_perms;
Chris PeBenito 5e6f9e
		class file create_file_perms;
Chris PeBenito 5e6f9e
	')
Chris PeBenito 0c73cd
Chris PeBenito b24f35
	files_search_spool($1)
Chris PeBenito 0a10b1
	allow $1 mqueue_spool_t:dir rw_dir_perms;
Chris PeBenito 0a10b1
	allow $1 mqueue_spool_t:file create_file_perms;
Chris PeBenito 7bba9d
')
Chris PeBenito 04926d
Chris PeBenito 04926d
#######################################
Chris PeBenito 04926d
## <summary>
Chris PeBenito 04926d
##	Read sendmail binary.
Chris PeBenito ef5ca0
## </summary>
Chris PeBenito 04926d
## <param name="domain">
Chris PeBenito 04926d
##	Domain allowed access.
Chris PeBenito 04926d
## </param>
Chris PeBenito 04926d
#
Chris PeBenito 04926d
# cjp: added for postfix
Chris PeBenito 04926d
interface(`mta_read_sendmail_bin',`
Chris PeBenito 04926d
	gen_require(`
Chris PeBenito 60789e
		type sendmail_exec_t;
Chris PeBenito 04926d
	')
Chris PeBenito 04926d
Chris PeBenito 04926d
	allow $1 sendmail_exec_t:file r_file_perms;
Chris PeBenito 04926d
')
Chris PeBenito 04926d
Chris PeBenito 04926d
#######################################
Chris PeBenito 04926d
## <summary>
Chris PeBenito 04926d
##	Read and write unix domain stream sockets
Chris PeBenito 04926d
##	of user mail domains.
Chris PeBenito 04926d
## </summary>
Chris PeBenito 04926d
## <param name="domain">
Chris PeBenito 04926d
##	Domain allowed access.
Chris PeBenito 04926d
## </param>
Chris PeBenito 04926d
#
Chris PeBenito 04926d
interface(`mta_rw_user_mail_stream_socket',`
Chris PeBenito 04926d
	gen_require(`
Chris PeBenito 04926d
		attribute user_mail_domain;
Chris PeBenito 04926d
	')
Chris PeBenito 04926d
Chris PeBenito 04926d
	allow $1 user_mail_domain:unix_stream_socket rw_socket_perms;
Chris PeBenito 04926d
')