Chris PeBenito 17de1b
## <summary>A distributed, collaborative, spam detection and filtering network.</summary>
Chris PeBenito 17de1b
## <desc>
Chris PeBenito 17de1b
##	

Chris PeBenito 17de1b
##	A distributed, collaborative, spam detection and filtering network.
Chris PeBenito 17de1b
##	

Chris PeBenito 17de1b
##	

Chris PeBenito 17de1b
##	This policy will work with either the ATrpms provided config
Chris PeBenito 17de1b
##	file in /etc/razor, or with the default of dumping everything into
Chris PeBenito 17de1b
##	$HOME/.razor.
Chris PeBenito 17de1b
##	

Chris PeBenito 17de1b
## </desc>
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#######################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Template to create types and rules common to
Chris PeBenito 17de1b
##	all razor domains.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="prefix">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The prefix of the domain (e.g., user
Chris PeBenito 17de1b
##	is the prefix for user_t).
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
template(`razor_common_domain_template',`
Chris PeBenito 6b19be
	gen_require(`
Chris PeBenito 6b19be
		type razor_exec_t, razor_etc_t, razor_log_t, razor_var_lib_t;
Chris PeBenito 6b19be
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
Chris PeBenito 17de1b
	allow $1_t self:fd use;
Chris PeBenito c0868a
	allow $1_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 17de1b
	allow $1_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 17de1b
	allow $1_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 17de1b
	allow $1_t self:unix_dgram_socket sendto;
Chris PeBenito 17de1b
	allow $1_t self:unix_stream_socket connectto;
Chris PeBenito 17de1b
	allow $1_t self:shm create_shm_perms;
Chris PeBenito 17de1b
	allow $1_t self:sem create_sem_perms;
Chris PeBenito 17de1b
	allow $1_t self:msgq create_msgq_perms;
Chris PeBenito 17de1b
	allow $1_t self:msg { send receive };
Chris PeBenito 17de1b
	allow $1_t self:tcp_socket create_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# Read system config file
Chris PeBenito 17de1b
	allow $1_t razor_etc_t:dir list_dir_perms;
Chris PeBenito 17de1b
	allow $1_t razor_etc_t:file read_file_perms;
Chris PeBenito 17de1b
	allow $1_t razor_etc_t:lnk_file { getattr read };
Chris PeBenito 17de1b
Chris PeBenito c0868a
	manage_dirs_pattern($1_t,razor_log_t,razor_log_t)
Chris PeBenito c0868a
	manage_files_pattern($1_t,razor_log_t,razor_log_t)
Chris PeBenito c0868a
	manage_lnk_files_pattern($1_t,razor_log_t,razor_log_t)
Chris PeBenito 17de1b
	logging_log_filetrans($1_t,razor_log_t,file)
Chris PeBenito 17de1b
Chris PeBenito c0868a
	manage_dirs_pattern($1_t,razor_var_lib_t,razor_var_lib_t)
Chris PeBenito c0868a
	manage_files_pattern($1_t,razor_var_lib_t,razor_var_lib_t)
Chris PeBenito c0868a
	manage_lnk_files_pattern($1_t,razor_var_lib_t,razor_var_lib_t)
Chris PeBenito 17de1b
	files_search_var_lib($1_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# Razor is one executable and several symlinks
Chris PeBenito 17de1b
	allow $1_t razor_exec_t:{ file lnk_file } { getattr read };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	kernel_read_system_state($1_t)
Chris PeBenito 17de1b
	kernel_read_network_state($1_t)
Chris PeBenito 17de1b
	kernel_read_software_raid_state($1_t)
Chris PeBenito 17de1b
	kernel_getattr_core_if($1_t)
Chris PeBenito 17de1b
	kernel_getattr_message_if($1_t)
Chris PeBenito 17de1b
	kernel_read_kernel_sysctls($1_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	corecmd_exec_bin($1_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	corenet_non_ipsec_sendrecv($1_t)
Chris PeBenito 17de1b
	corenet_tcp_sendrecv_generic_if($1_t)
Chris PeBenito 17de1b
	corenet_raw_sendrecv_generic_if($1_t)
Chris PeBenito 17de1b
	corenet_tcp_sendrecv_all_nodes($1_t)
Chris PeBenito 17de1b
	corenet_raw_sendrecv_all_nodes($1_t)
Chris PeBenito 17de1b
	corenet_tcp_sendrecv_razor_port($1_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# mktemp and other randoms
Chris PeBenito 17de1b
	dev_read_rand($1_t)
Chris PeBenito 17de1b
	dev_read_urand($1_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	files_search_pids($1_t)
Chris PeBenito 17de1b
	# Allow access to various files in the /etc/directory including mtab
Chris PeBenito 17de1b
	# and nsswitch
Chris PeBenito 17de1b
	files_read_etc_files($1_t)
Chris PeBenito 17de1b
	files_read_etc_runtime_files($1_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	fs_search_auto_mountpoints($1_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	libs_use_ld_so($1_t)
Chris PeBenito 17de1b
	libs_use_shared_libs($1_t)
Chris PeBenito 17de1b
	libs_read_lib_files($1_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	miscfiles_read_localization($1_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	sysnet_read_config($1_t)
Chris PeBenito 17de1b
	sysnet_dns_name_resolve($1_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	userdom_use_unpriv_users_fds($1_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
		nis_use_ypbind($1_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#######################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito bbcd3c
##	The per role template for the razor module.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <desc>
Chris PeBenito 17de1b
##	

Chris PeBenito bbcd3c
##	The per role template for the razor module.
Chris PeBenito 17de1b
##	

Chris PeBenito 17de1b
##	

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

Chris PeBenito 17de1b
## </desc>
Chris PeBenito 17de1b
## <param name="userdomain_prefix">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The prefix of the user domain (e.g., user
Chris PeBenito 17de1b
##	is the prefix for user_t).
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
## <param name="user_domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The type of the user domain.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
## <param name="user_role">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The role associated with the user domain.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito bbcd3c
template(`razor_per_role_template',`
Chris PeBenito 6b19be
	gen_require(`
Chris PeBenito 6b19be
		type razor_exec_t;
Chris PeBenito 6b19be
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	type $1_razor_t;
Chris PeBenito 17de1b
	domain_type($1_razor_t)
Chris PeBenito 17de1b
	domain_entry_file($1_razor_t,razor_exec_t)
Chris PeBenito 17de1b
	razor_common_domain_template($1_razor)
Chris PeBenito 17de1b
	role $3 types $1_razor_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	type $1_razor_home_t alias $1_razor_rw_t;
Chris PeBenito 17de1b
	files_poly_member($1_razor_home_t)
Chris PeBenito 17de1b
	userdom_user_home_content($1,$1_razor_home_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	type $1_razor_tmp_t;
Chris PeBenito 17de1b
	files_tmp_file($1_razor_tmp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	##############################
Chris PeBenito 17de1b
	#
Chris PeBenito 17de1b
	# Local policy
Chris PeBenito 17de1b
	#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1_razor_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito c0868a
	manage_dirs_pattern($1_razor_t,$1_razor_home_t,$1_razor_home_t)
Chris PeBenito c0868a
	manage_files_pattern($1_razor_t,$1_razor_home_t,$1_razor_home_t)
Chris PeBenito c0868a
	manage_lnk_files_pattern($1_razor_t,$1_razor_home_t,$1_razor_home_t)
Chris PeBenito 17de1b
	userdom_user_home_dir_filetrans($1,$1_razor_t,$1_razor_home_t,dir)
Chris PeBenito 17de1b
Chris PeBenito c0868a
	manage_dirs_pattern($1_razor_t,$1_razor_tmp_t,$1_razor_tmp_t)
Chris PeBenito c0868a
	manage_files_pattern($1_razor_t,$1_razor_tmp_t,$1_razor_tmp_t)
Chris PeBenito 17de1b
	files_tmp_filetrans($1_razor_t, $1_razor_tmp_t, { file dir })
Chris PeBenito 17de1b
Chris PeBenito c0868a
	domtrans_pattern($2, razor_exec_t, $1_razor_t)
Chris PeBenito 17de1b
Chris PeBenito c0868a
	manage_dirs_pattern($2,$1_razor_home_t,$1_razor_home_t)
Chris PeBenito c0868a
	manage_files_pattern($2,$1_razor_home_t,$1_razor_home_t)
Chris PeBenito c0868a
	manage_lnk_files_pattern($2,$1_razor_home_t,$1_razor_home_t)
Chris PeBenito c0868a
	relabel_dirs_pattern($2,$1_razor_home_t,$1_razor_home_t)
Chris PeBenito c0868a
	relabel_files_pattern($2,$1_razor_home_t,$1_razor_home_t)
Chris PeBenito c0868a
	relabel_lnk_files_pattern($2,$1_razor_home_t,$1_razor_home_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	logging_send_syslog_msg($1_razor_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	userdom_search_user_home_dirs($1,$1_razor_t)
Chris PeBenito 17de1b
	# Allow razor to be run by hand.  Needed by any action other than
Chris PeBenito 17de1b
	# invocation from a spam filter.
Chris PeBenito 17de1b
	userdom_use_user_terminals($1,$1_razor_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	tunable_policy(`use_nfs_home_dirs',`
Chris PeBenito 17de1b
		fs_manage_nfs_dirs($1_razor_t)
Chris PeBenito 17de1b
		fs_manage_nfs_files($1_razor_t)
Chris PeBenito 17de1b
		fs_manage_nfs_symlinks($1_razor_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	tunable_policy(`use_samba_home_dirs',`
Chris PeBenito 17de1b
		fs_manage_cifs_dirs($1_razor_t)
Chris PeBenito 17de1b
		fs_manage_cifs_files($1_razor_t)
Chris PeBenito 17de1b
		fs_manage_cifs_symlinks($1_razor_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
		nscd_socket_use($1_razor_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Execute razor in the system razor domain.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`razor_domtrans',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type razor_t, razor_exec_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito c0868a
	domtrans_pattern($1, razor_exec_t, razor_t)
Chris PeBenito 17de1b
')