Chris PeBenito 04926d
## <summary>Postfix email server</summary>
Chris PeBenito 04926d
Chris PeBenito 04926d
########################################
Chris PeBenito 04926d
## <summary>
Chris PeBenito 04926d
##	Postfix stub interface.  No access allowed.
Chris PeBenito 04926d
## </summary>
Chris PeBenito 04926d
## <param name="domain" optional="true">
Chris PeBenito 04926d
##	N/A
Chris PeBenito 04926d
## </param>
Chris PeBenito 04926d
#
Chris PeBenito 04926d
interface(`postfix_stub',`
Chris PeBenito 04926d
	gen_require(`
Chris PeBenito 04926d
		type postfix_master_t;
Chris PeBenito 04926d
	')
Chris PeBenito 04926d
')
Chris PeBenito 04926d
Chris PeBenito 04926d
template(`postfix_domain_template',`
Chris PeBenito 04926d
	type postfix_$1_t;
Chris PeBenito 04926d
	type postfix_$1_exec_t;
Chris PeBenito 04926d
	domain_type(postfix_$1_t)
Chris PeBenito 04926d
	domain_entry_file(postfix_$1_t,postfix_$1_exec_t)
Chris PeBenito 04926d
	role system_r types postfix_$1_t;
Chris PeBenito 04926d
Chris PeBenito 04926d
	dontaudit postfix_$1_t self:capability sys_tty_config;
Chris PeBenito 04926d
	allow postfix_$1_t self:process { signal_perms setpgid };
Chris PeBenito 04926d
	allow postfix_$1_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 04926d
	allow postfix_$1_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 04926d
	allow postfix_$1_t self:unix_stream_socket connectto;
Chris PeBenito 04926d
Chris PeBenito 04926d
	allow postfix_master_t postfix_$1_t:process signal;
Chris PeBenito 04926d
Chris PeBenito 04926d
	allow postfix_$1_t postfix_etc_t:dir r_dir_perms;
Chris PeBenito 04926d
	allow postfix_$1_t postfix_etc_t:file r_file_perms;
Chris PeBenito 04926d
Chris PeBenito 04926d
	can_exec(postfix_$1_t, postfix_$1_exec_t)
Chris PeBenito 04926d
Chris PeBenito 04926d
	allow postfix_$1_t postfix_exec_t:file rx_file_perms;
Chris PeBenito 04926d
	# cjp: ???
Chris PeBenito 04926d
	allow postfix_$1_t postfix_exec_t:dir r_dir_perms;
Chris PeBenito 04926d
Chris PeBenito 04926d
	allow postfix_$1_t postfix_master_t:process sigchld;
Chris PeBenito 04926d
Chris PeBenito 04926d
	allow postfix_$1_t postfix_spool_t:dir r_dir_perms;
Chris PeBenito 04926d
Chris PeBenito 04926d
	allow postfix_$1_t postfix_var_run_t:file manage_file_perms;
Chris PeBenito 04926d
	files_create_pid(postfix_$1_t,postfix_var_run_t)
Chris PeBenito 04926d
Chris PeBenito 04926d
	kernel_read_system_state(postfix_$1_t)
Chris PeBenito 04926d
	kernel_read_network_state(postfix_$1_t)
Chris PeBenito 04926d
	kernel_read_all_sysctl(postfix_$1_t)
Chris PeBenito 04926d
Chris PeBenito 04926d
	dev_read_sysfs(postfix_$1_t)
Chris PeBenito 04926d
	dev_read_rand(postfix_$1_t)
Chris PeBenito 04926d
	dev_read_urand(postfix_$1_t)
Chris PeBenito 04926d
Chris PeBenito 04926d
	fs_search_auto_mountpoints(postfix_$1_t)
Chris PeBenito 04926d
	fs_getattr_xattr_fs(postfix_$1_t)
Chris PeBenito 04926d
Chris PeBenito 04926d
	term_dontaudit_use_console(postfix_$1_t)
Chris PeBenito 04926d
Chris PeBenito 04926d
	corecmd_list_bin(postfix_$1_t)
Chris PeBenito 04926d
	corecmd_list_sbin(postfix_$1_t)
Chris PeBenito 04926d
	corecmd_read_bin_symlink(postfix_$1_t)
Chris PeBenito 04926d
	corecmd_read_sbin_symlink(postfix_$1_t)
Chris PeBenito 04926d
	corecmd_exec_shell(postfix_$1_t)
Chris PeBenito 04926d
Chris PeBenito 04926d
	files_read_etc_files(postfix_$1_t)
Chris PeBenito 04926d
	files_read_etc_runtime_files(postfix_$1_t)
Chris PeBenito 88dd38
	files_read_usr_symlinks(postfix_$1_t)
Chris PeBenito 04926d
	files_search_spool(postfix_$1_t)
Chris PeBenito 04926d
	files_getattr_tmp_dir(postfix_$1_t)
Chris PeBenito 04926d
Chris PeBenito 04926d
	init_use_fd(postfix_$1_t)
Chris PeBenito 04926d
	init_sigchld(postfix_$1_t)
Chris PeBenito 04926d
Chris PeBenito 04926d
	libs_use_ld_so(postfix_$1_t)
Chris PeBenito 04926d
	libs_use_shared_libs(postfix_$1_t)
Chris PeBenito 04926d
Chris PeBenito 04926d
	logging_send_syslog_msg(postfix_$1_t)
Chris PeBenito 04926d
Chris PeBenito 04926d
	miscfiles_read_localization(postfix_$1_t)
Chris PeBenito 04926d
	miscfiles_read_certs(postfix_$1_t)
Chris PeBenito 04926d
Chris PeBenito 04926d
	userdom_dontaudit_use_unpriv_user_fd(postfix_$1_t)
Chris PeBenito 04926d
Chris PeBenito 04926d
	ifdef(`targeted_policy', `
Chris PeBenito 04926d
		term_dontaudit_use_unallocated_tty(postfix_$1_t)
Chris PeBenito 04926d
		term_dontaudit_use_generic_pty(postfix_$1_t)
Chris PeBenito 04926d
		files_dontaudit_read_root_file(postfix_$1_t)
Chris PeBenito 04926d
	')
Chris PeBenito 04926d
Chris PeBenito 132880
	optional_policy(`nscd',`
Chris PeBenito 30705b
		nscd_use_socket(postfix_$1_t)
Chris PeBenito 30705b
	')
Chris PeBenito 30705b
Chris PeBenito 132880
	optional_policy(`udev',`
Chris PeBenito 04926d
		udev_read_db(postfix_$1_t)
Chris PeBenito 04926d
	')
Chris PeBenito 04926d
')
Chris PeBenito 04926d
Chris PeBenito 04926d
template(`postfix_server_domain_template',`
Chris PeBenito 04926d
	postfix_domain_template($1)
Chris PeBenito 04926d
Chris PeBenito 04926d
	allow postfix_$1_t self:capability { setuid setgid dac_override };
Chris PeBenito 04926d
	allow postfix_$1_t postfix_master_t:unix_stream_socket { connectto rw_stream_socket_perms };
Chris PeBenito 04926d
	allow postfix_$1_t self:tcp_socket create_socket_perms;
Chris PeBenito 04926d
	allow postfix_$1_t self:udp_socket create_socket_perms;
Chris PeBenito 04926d
Chris PeBenito 04926d
	domain_auto_trans(postfix_master_t, postfix_$1_exec_t, postfix_$1_t)
Chris PeBenito 30705b
	allow postfix_master_t postfix_$1_t:fd use;
Chris PeBenito 30705b
	allow postfix_$1_t postfix_master_t:fd use;
Chris PeBenito 30705b
	allow postfix_$1_t postfix_master_t:fifo_file rw_file_perms;
Chris PeBenito 30705b
	allow postfix_$1_t postfix_master_t:process sigchld;
Chris PeBenito 04926d
Chris PeBenito 04926d
	corenet_tcp_sendrecv_all_if(postfix_$1_t)
Chris PeBenito 04926d
	corenet_udp_sendrecv_all_if(postfix_$1_t)
Chris PeBenito 04926d
	corenet_raw_sendrecv_all_if(postfix_$1_t)
Chris PeBenito 04926d
	corenet_tcp_sendrecv_all_nodes(postfix_$1_t)
Chris PeBenito 04926d
	corenet_udp_sendrecv_all_nodes(postfix_$1_t)
Chris PeBenito 04926d
	corenet_raw_sendrecv_all_nodes(postfix_$1_t)
Chris PeBenito 04926d
	corenet_tcp_sendrecv_all_ports(postfix_$1_t)
Chris PeBenito 04926d
	corenet_udp_sendrecv_all_ports(postfix_$1_t)
Chris PeBenito bd7037
	corenet_non_ipsec_sendrecv(postfix_$1_t)
Chris PeBenito 04926d
	corenet_tcp_bind_all_nodes(postfix_$1_t)
Chris PeBenito 04926d
	corenet_udp_bind_all_nodes(postfix_$1_t)
Chris PeBenito 04926d
	corenet_tcp_connect_all_ports(postfix_$1_t)
Chris PeBenito 04926d
Chris PeBenito 04926d
	sysnet_read_config(postfix_$1_t)
Chris PeBenito 04926d
Chris PeBenito 132880
	optional_policy(`nis',`
Chris PeBenito 04926d
		nis_use_ypbind(postfix_$1_t)
Chris PeBenito 04926d
	')
Chris PeBenito 04926d
')
Chris PeBenito 04926d
Chris PeBenito 04926d
template(`postfix_user_domain_template',`
Chris PeBenito fc0e8c
	gen_require(`
Chris PeBenito fc0e8c
		attribute postfix_user_domains, postfix_user_domtrans;
Chris PeBenito fc0e8c
	')
Chris PeBenito fc0e8c
Chris PeBenito 04926d
	postfix_domain_template($1)
Chris PeBenito 04926d
Chris PeBenito fc0e8c
	typeattribute postfix_$1_t postfix_user_domains;
Chris PeBenito fc0e8c
Chris PeBenito 04926d
	allow postfix_$1_t self:capability dac_override;
Chris PeBenito 04926d
Chris PeBenito fc0e8c
	domain_auto_trans(postfix_user_domtrans, postfix_$1_exec_t, postfix_$1_t)
Chris PeBenito fc0e8c
	allow postfix_user_domtrans postfix_$1_t:fd use;
Chris PeBenito fc0e8c
	allow postfix_$1_t postfix_user_domtrans:fd use;
Chris PeBenito fc0e8c
	allow postfix_$1_t postfix_user_domtrans:fifo_file rw_file_perms;
Chris PeBenito fc0e8c
	allow postfix_$1_t postfix_user_domtrans:process sigchld;
Chris PeBenito 04926d
Chris PeBenito fc0e8c
	domain_use_wide_inherit_fd(postfix_$1_t)
Chris PeBenito fc0e8c
')
Chris PeBenito 04926d
Chris PeBenito fc0e8c
template(`postfix_per_userdomain_template',`
Chris PeBenito fc0e8c
	gen_require(`
Chris PeBenito fc0e8c
		attribute postfix_user_domains;
Chris PeBenito fc0e8c
	')
Chris PeBenito fc0e8c
Chris PeBenito fc0e8c
	# cjp: perhaps this should actually be $3
Chris PeBenito fc0e8c
	# instead of just sysadm_r?
Chris PeBenito fc0e8c
	#role sysadm_r types postfix_user_domains;
Chris PeBenito fc0e8c
Chris PeBenito fc0e8c
	allow postfix_user_domains $2:process sigchld;
Chris PeBenito fc0e8c
	allow postfix_user_domains $2:fifo_file { write getattr };
Chris PeBenito fc0e8c
	allow postfix_user_domains $2:fd use;
Chris PeBenito 04926d
')
Chris PeBenito 04926d
Chris PeBenito 04926d
template(`postfix_public_domain_template',`
Chris PeBenito 04926d
	postfix_server_domain_template($1)
Chris PeBenito 04926d
Chris PeBenito 04926d
	allow postfix_$1_t postfix_public_t:dir search;
Chris PeBenito 04926d
')
Chris PeBenito 04926d
Chris PeBenito 04926d
########################################
Chris PeBenito 04926d
## <summary>
Chris PeBenito 04926d
##	Read postfix configuration files.
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(`postfix_read_config',`
Chris PeBenito 04926d
	gen_require(`
Chris PeBenito 04926d
		type postfix_etc_t;
Chris PeBenito 04926d
	')
Chris PeBenito 04926d
Chris PeBenito 04926d
	allow $1 postfix_etc_t:dir { getattr read search };
Chris PeBenito 04926d
	allow $1 postfix_etc_t:file { read getattr };
Chris PeBenito 04926d
	allow $1 postfix_etc_t:lnk_file { getattr read };
Chris PeBenito 04926d
	files_search_etc($1)
Chris PeBenito 04926d
')
Chris PeBenito 04926d
Chris PeBenito 04926d
########################################
Chris PeBenito 04926d
## <summary>
Chris PeBenito 1504ff
##	Create files with the specified type in
Chris PeBenito 1504ff
##	the postfix configuration directories.
Chris PeBenito 1504ff
## </summary>
Chris PeBenito 1504ff
## <param name="domain">
Chris PeBenito 1504ff
##	Domain allowed access.
Chris PeBenito 1504ff
## </param>
Chris PeBenito 1504ff
## <param name="private type">
Chris PeBenito 1504ff
##	The type of the object to be created.
Chris PeBenito 1504ff
## </param>
Chris PeBenito 1504ff
## <param name="object" optional="true">
Chris PeBenito 1504ff
##	The object class of the object being created.  If
Chris PeBenito 1504ff
##	no class is specified, file will be used.
Chris PeBenito 1504ff
## </param>
Chris PeBenito 1504ff
#
Chris PeBenito 1504ff
interface(`postfix_create_config',`
Chris PeBenito 1504ff
	gen_require(`
Chris PeBenito 1504ff
		type postfix_etc_t;
Chris PeBenito 1504ff
	')
Chris PeBenito 1504ff
Chris PeBenito 1504ff
	files_search_etc($1)
Chris PeBenito 1504ff
	allow $1 postfix_etc_t:dir rw_dir_perms;
Chris PeBenito 1504ff
Chris PeBenito 1504ff
	ifelse(`$3',`',`
Chris PeBenito 1504ff
		type_transition $1 postfix_etc_t:file $2;
Chris PeBenito 1504ff
	',`
Chris PeBenito 1504ff
		type_transition $1 postfix_etc_t:$3 $2;
Chris PeBenito 1504ff
	')
Chris PeBenito 1504ff
')
Chris PeBenito 1504ff
Chris PeBenito 1504ff
########################################
Chris PeBenito 1504ff
## <summary>
Chris PeBenito 3e6c81
##	Do not audit attempts to read and
Chris PeBenito 3e6c81
##	write postfix local delivery
Chris PeBenito 3e6c81
##	TCP sockets.
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(`postfix_dontaudit_rw_local_tcp_socket',`
Chris PeBenito 3e6c81
	gen_require(`
Chris PeBenito 3e6c81
		type postfix_local_t;
Chris PeBenito 3e6c81
	')
Chris PeBenito 3e6c81
Chris PeBenito 3e6c81
	dontaudit $1 postfix_local_t:tcp_socket { read write };
Chris PeBenito 3e6c81
')
Chris PeBenito 3e6c81
Chris PeBenito 3e6c81
########################################
Chris PeBenito 3e6c81
## <summary>
Chris PeBenito 3e6c81
##	Do not audit attempts to use
Chris PeBenito 3e6c81
##	postfix master process file
Chris PeBenito 3e6c81
##	file descriptors.
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(`postfix_dontaudit_use_fd',`
Chris PeBenito 3e6c81
	gen_require(`
Chris PeBenito 3e6c81
		type postfix_master_t;
Chris PeBenito 3e6c81
	')
Chris PeBenito 3e6c81
Chris PeBenito 3e6c81
	dontaudit $1 postfix_master_t:fd use;
Chris PeBenito 3e6c81
')
Chris PeBenito 3e6c81
Chris PeBenito 3e6c81
########################################
Chris PeBenito 3e6c81
## <summary>
Chris PeBenito 88dd38
##	Execute postfix_map in the postfix_map domain.
Chris PeBenito 88dd38
## </summary>
Chris PeBenito 88dd38
## <param name="domain">
Chris PeBenito 88dd38
##	Domain allowed access.
Chris PeBenito 88dd38
## </param>
Chris PeBenito 88dd38
#
Chris PeBenito 88dd38
interface(`postfix_domtrans_map',`
Chris PeBenito 88dd38
	gen_require(`
Chris PeBenito 88dd38
		type postfix_map_t, postfix_map_exec_t;
Chris PeBenito 88dd38
	')
Chris PeBenito 88dd38
Chris PeBenito 88dd38
	domain_auto_trans($1,postfix_map_exec_t,postfix_map_t)
Chris PeBenito 88dd38
Chris PeBenito 88dd38
	allow $1 postfix_map_t:fd use;
Chris PeBenito 88dd38
	allow postfix_map_t $1:fd use;
Chris PeBenito 88dd38
	allow postfix_map_t $1:fifo_file rw_file_perms;
Chris PeBenito 88dd38
	allow postfix_map_t $1:process sigchld;
Chris PeBenito 88dd38
')
Chris PeBenito 88dd38
Chris PeBenito 88dd38
########################################
Chris PeBenito 88dd38
## <summary>
Chris PeBenito 88dd38
##	Execute postfix_map in the postfix_map domain, and
Chris PeBenito 88dd38
##	allow the specified role the postfix_map domain.
Chris PeBenito 88dd38
## </summary>
Chris PeBenito 88dd38
## <param name="domain">
Chris PeBenito 88dd38
##	Domain allowed access.
Chris PeBenito 88dd38
## </param>
Chris PeBenito 88dd38
## <param name="role">
Chris PeBenito 88dd38
##	The role to be allowed the postfix_map domain.
Chris PeBenito 88dd38
## </param>
Chris PeBenito 88dd38
## <param name="terminal">
Chris PeBenito 88dd38
##	The type of the terminal allow the postfix_map domain to use.
Chris PeBenito 88dd38
## </param>
Chris PeBenito 88dd38
#
Chris PeBenito 88dd38
interface(`postfix_run_map',`
Chris PeBenito 88dd38
	gen_require(`
Chris PeBenito 88dd38
		type postfix_map_t;
Chris PeBenito 88dd38
	')
Chris PeBenito 88dd38
Chris PeBenito 88dd38
	postfix_domtrans_map($1)
Chris PeBenito 88dd38
	role $2 types postfix_map_t;
Chris PeBenito 88dd38
	allow postfix_map_t $3:chr_file rw_term_perms;
Chris PeBenito 88dd38
')
Chris PeBenito 88dd38
Chris PeBenito 88dd38
########################################
Chris PeBenito 88dd38
## <summary>
Chris PeBenito 04926d
##	Execute the master postfix program in the
Chris PeBenito 04926d
##	postfix_master domain.
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(`postfix_domtrans_master',`
Chris PeBenito 04926d
	gen_require(`
Chris PeBenito 04926d
		type postfix_master_t, postfix_master_exec_t;
Chris PeBenito 04926d
	')
Chris PeBenito 04926d
Chris PeBenito 04926d
	domain_auto_trans($1,postfix_master_exec_t,postfix_master_t)
Chris PeBenito 04926d
Chris PeBenito 04926d
	allow $1 postfix_master_t:fd use;
Chris PeBenito 04926d
	allow postfix_master_t $1:fd use;
Chris PeBenito 04926d
	allow postfix_master_t $1:fifo_file rw_file_perms;
Chris PeBenito 04926d
	allow postfix_master_t $1:process sigchld;
Chris PeBenito 04926d
')
Chris PeBenito 04926d
Chris PeBenito 04926d
########################################
Chris PeBenito 04926d
## <summary>
Chris PeBenito 1504ff
##	Execute the master postfix program in the
Chris PeBenito 1504ff
##	caller domain.
Chris PeBenito 1504ff
## </summary>
Chris PeBenito 1504ff
## <param name="domain">
Chris PeBenito 1504ff
##	Domain allowed access.
Chris PeBenito 1504ff
## </param>
Chris PeBenito 1504ff
#
Chris PeBenito 1504ff
interface(`postfix_exec_master',`
Chris PeBenito 1504ff
	gen_require(`
Chris PeBenito 1504ff
		type postfix_master_exec_t;
Chris PeBenito 1504ff
	')
Chris PeBenito 1504ff
Chris PeBenito 1504ff
	can_exec($1,postfix_master_exec_t)
Chris PeBenito 1504ff
')
Chris PeBenito 1504ff
Chris PeBenito 1504ff
########################################
Chris PeBenito 1504ff
## <summary>
Chris PeBenito 04926d
##	Search postfix mail spool directories.
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(`postfix_search_spool',`
Chris PeBenito 04926d
	gen_require(`
Chris PeBenito 04926d
		type postfix_spool_t;
Chris PeBenito 04926d
	')
Chris PeBenito 04926d
Chris PeBenito 04926d
	allow $1 postfix_spool_t:dir search_dir_perms;
Chris PeBenito 04926d
	files_search_spool($1)
Chris PeBenito 04926d
')
Chris PeBenito 04926d
Chris PeBenito 04926d
########################################
Chris PeBenito 04926d
## <summary>
Chris PeBenito 04926d
##	List postfix mail spool directories.
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(`postfix_list_spool',`
Chris PeBenito 04926d
	gen_require(`
Chris PeBenito 04926d
		type postfix_spool_t;
Chris PeBenito 04926d
	')
Chris PeBenito 04926d
Chris PeBenito 04926d
	allow $1 postfix_spool_t:dir list_dir_perms;
Chris PeBenito 04926d
	files_search_spool($1)
Chris PeBenito 04926d
')
Chris PeBenito fc0e8c
Chris PeBenito fc0e8c
########################################
Chris PeBenito fc0e8c
## <summary>
Chris PeBenito fc0e8c
##	Execute postfix user mail programs
Chris PeBenito fc0e8c
##	in their respective domains.
Chris PeBenito fc0e8c
## </summary>
Chris PeBenito fc0e8c
## <param name="domain">
Chris PeBenito fc0e8c
##	Domain allowed access.
Chris PeBenito fc0e8c
## </param>
Chris PeBenito fc0e8c
#
Chris PeBenito fc0e8c
interface(`postfix_domtrans_user_mail_handler',`
Chris PeBenito fc0e8c
	gen_require(`
Chris PeBenito fc0e8c
		attribute postfix_user_domtrans;
Chris PeBenito fc0e8c
	')
Chris PeBenito fc0e8c
Chris PeBenito fc0e8c
	typeattribute $1 postfix_user_domtrans;
Chris PeBenito fc0e8c
')