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 296273
	type $1_t;
Chris PeBenito 296273
	domain_type($1_t)
Chris PeBenito 296273
	domain_entry_file($1_t, razor_exec_t)
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 0bfccd
	manage_dirs_pattern($1_t, razor_log_t, razor_log_t)
Chris PeBenito 0bfccd
	manage_files_pattern($1_t, razor_log_t, razor_log_t)
Chris PeBenito 0bfccd
	manage_lnk_files_pattern($1_t, razor_log_t, razor_log_t)
Chris PeBenito 0bfccd
	logging_log_filetrans($1_t, razor_log_t, file)
Chris PeBenito 0bfccd
Chris PeBenito 0bfccd
	manage_dirs_pattern($1_t, razor_var_lib_t, razor_var_lib_t)
Chris PeBenito 0bfccd
	manage_files_pattern($1_t, razor_var_lib_t, razor_var_lib_t)
Chris PeBenito 0bfccd
	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 82d277
	allow $1_t razor_exec_t:file read_file_perms;
Chris PeBenito 82d277
	allow $1_t razor_exec_t:lnk_file read_lnk_file_perms;
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 190066
	corenet_all_recvfrom_unlabeled($1_t)
Chris PeBenito 190066
	corenet_all_recvfrom_netlabel($1_t)
Chris PeBenito 17de1b
	corenet_tcp_sendrecv_generic_if($1_t)
Chris PeBenito 17de1b
	corenet_raw_sendrecv_generic_if($1_t)
Chris PeBenito c12621
	corenet_tcp_sendrecv_generic_node($1_t)
Chris PeBenito c12621
	corenet_raw_sendrecv_generic_node($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_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
	optional_policy(`
Chris PeBenito 17de1b
		nis_use_ypbind($1_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 296273
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 296273
##	Role access for razor
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 296273
## <param name="role">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 296273
##	Role allowed access
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 296273
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 296273
##	User domain for the role
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 296273
interface(`razor_role',`
Chris PeBenito 6b19be
	gen_require(`
Chris PeBenito 296273
		type razor_t, razor_exec_t, razor_home_t;
Chris PeBenito 6b19be
	')
Chris PeBenito 17de1b
Chris PeBenito 296273
	role $1 types razor_t;
Chris PeBenito 17de1b
Chris PeBenito 296273
	# Transition from the user domain to the derived domain.
Chris PeBenito 296273
	domtrans_pattern($2, razor_exec_t, razor_t)
Chris PeBenito 17de1b
Chris PeBenito 296273
	# allow ps to show razor and allow the user to kill it 
Chris PeBenito 296273
	ps_process_pattern($2, razor_t)
Chris PeBenito 296273
	allow $2 razor_t:process signal;
Chris PeBenito 17de1b
Chris PeBenito 296273
	manage_dirs_pattern($2, razor_home_t, razor_home_t)
Chris PeBenito 296273
	manage_files_pattern($2, razor_home_t, razor_home_t)
Chris PeBenito 296273
	manage_lnk_files_pattern($2, razor_home_t, razor_home_t)
Chris PeBenito 296273
	relabel_dirs_pattern($2, razor_home_t, razor_home_t)
Chris PeBenito 296273
	relabel_files_pattern($2, razor_home_t, razor_home_t)
Chris PeBenito 296273
	relabel_lnk_files_pattern($2, razor_home_t, razor_home_t)
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
')