Chris PeBenito 4b76ea
policy_module(razor, 2.1.1)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Dan Walsh 3eaa99
ifdef(`distro_redhat',`
Dan Walsh 3eaa99
	gen_require(`
Dominick Grift 54590a
		type spamc_t, spamc_exec_t, spamd_log_t;
Dominick Grift 54590a
		type spamd_spool_t, spamd_var_lib_t, spamd_etc_t;
Dominick Grift 54590a
		type spamc_home_t, spamc_tmp_t;
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	typealias spamc_t alias razor_t;
Dan Walsh 3eaa99
	typealias spamc_exec_t alias razor_exec_t;
Dan Walsh 3eaa99
	typealias spamd_log_t alias razor_log_t;
Dan Walsh 3eaa99
	typealias spamd_var_lib_t alias razor_var_lib_t;
Dan Walsh 3eaa99
	typealias spamd_etc_t alias razor_etc_t;
Dan Walsh 3eaa99
	typealias spamc_home_t alias razor_home_t;
Dan Walsh 3eaa99
	typealias spamc_home_t alias { user_razor_home_t staff_razor_home_t sysadm_razor_home_t };
Dan Walsh 3eaa99
	typealias spamc_home_t alias { auditadm_razor_home_t secadm_razor_home_t };
Dan Walsh 3eaa99
	typealias spamc_tmp_t alias { user_razor_tmp_t staff_razor_tmp_t sysadm_razor_tmp_t };
Dan Walsh 3eaa99
	typealias spamc_tmp_t alias { auditadm_razor_tmp_t secadm_razor_tmp_t };
Dan Walsh 3eaa99
',`
Dominick Grift 1e2abe
	type razor_exec_t;
Dominick Grift 1e2abe
	corecmd_executable_file(razor_exec_t)
Dan Walsh 3eaa99
Dominick Grift 1e2abe
	type razor_etc_t;
Dominick Grift 1e2abe
	files_config_file(razor_etc_t)
Chris PeBenito 17de1b
Dominick Grift 1e2abe
	type razor_home_t;
Dominick Grift 1e2abe
	typealias razor_home_t alias { user_razor_home_t staff_razor_home_t sysadm_razor_home_t };
Dominick Grift 1e2abe
	typealias razor_home_t alias { auditadm_razor_home_t secadm_razor_home_t };
Dominick Grift 1e2abe
	userdom_user_home_content(razor_home_t)
Chris PeBenito 296273
Dominick Grift 1e2abe
	type razor_log_t;
Dominick Grift 1e2abe
	logging_log_file(razor_log_t)
Chris PeBenito 17de1b
Dominick Grift 1e2abe
	type razor_tmp_t;
Dominick Grift 1e2abe
	typealias razor_tmp_t alias { user_razor_tmp_t staff_razor_tmp_t sysadm_razor_tmp_t };
Dominick Grift 1e2abe
	typealias razor_tmp_t alias { auditadm_razor_tmp_t secadm_razor_tmp_t };
Dominick Grift 1e2abe
	files_tmp_file(razor_tmp_t)
Dominick Grift 1e2abe
	ubac_constrained(razor_tmp_t)
Chris PeBenito 296273
Dominick Grift 1e2abe
	type razor_var_lib_t;
Dominick Grift 1e2abe
	files_type(razor_var_lib_t)
Chris PeBenito 17de1b
Dominick Grift 1e2abe
	# these are here due to ordering issues:
Dominick Grift 1e2abe
	razor_common_domain_template(razor)
Dominick Grift 1e2abe
	typealias razor_t alias { user_razor_t staff_razor_t sysadm_razor_t };
Dominick Grift 1e2abe
	typealias razor_t alias { auditadm_razor_t secadm_razor_t };
Dominick Grift 1e2abe
	ubac_constrained(razor_t)
Chris PeBenito 296273
Dominick Grift 1e2abe
	razor_common_domain_template(system_razor)
Dominick Grift 1e2abe
	role system_r types system_razor_t;
Chris PeBenito 17de1b
Dominick Grift 1e2abe
	########################################
Dominick Grift 1e2abe
	#
Dominick Grift 1e2abe
	# System razor local policy
Dominick Grift 1e2abe
	#
Chris PeBenito 17de1b
Dominick Grift 1e2abe
	# this version of razor is invoked typically
Dominick Grift 1e2abe
	# via the system spam filter
Chris PeBenito 17de1b
Dominick Grift 1e2abe
	allow system_razor_t self:tcp_socket create_socket_perms;
Chris PeBenito 17de1b
Dominick Grift 1e2abe
	manage_dirs_pattern(system_razor_t, razor_etc_t, razor_etc_t)
Dominick Grift 1e2abe
	manage_files_pattern(system_razor_t, razor_etc_t, razor_etc_t)
Dominick Grift 1e2abe
	manage_lnk_files_pattern(system_razor_t, razor_etc_t, razor_etc_t)
Dominick Grift 1e2abe
	files_search_etc(system_razor_t)
Chris PeBenito 17de1b
Dominick Grift 1e2abe
	allow system_razor_t razor_log_t:file manage_file_perms;
Dominick Grift 1e2abe
	logging_log_filetrans(system_razor_t, razor_log_t, file)
Chris PeBenito 17de1b
Dominick Grift 1e2abe
	manage_files_pattern(system_razor_t, razor_var_lib_t, razor_var_lib_t)
Dominick Grift 1e2abe
	files_var_lib_filetrans(system_razor_t, razor_var_lib_t, file)
Chris PeBenito 296273
Dominick Grift 1e2abe
	corenet_all_recvfrom_unlabeled(system_razor_t)
Dominick Grift 1e2abe
	corenet_all_recvfrom_netlabel(system_razor_t)
Dominick Grift 1e2abe
	corenet_tcp_sendrecv_generic_if(system_razor_t)
Dominick Grift 1e2abe
	corenet_raw_sendrecv_generic_if(system_razor_t)
Dominick Grift 1e2abe
	corenet_tcp_sendrecv_generic_node(system_razor_t)
Dominick Grift 1e2abe
	corenet_raw_sendrecv_generic_node(system_razor_t)
Dominick Grift 1e2abe
	corenet_tcp_sendrecv_razor_port(system_razor_t)
Dominick Grift 1e2abe
	corenet_tcp_connect_razor_port(system_razor_t)
Dominick Grift 1e2abe
	corenet_sendrecv_razor_client_packets(system_razor_t)
Chris PeBenito 296273
Dominick Grift 1e2abe
	sysnet_read_config(system_razor_t)
Chris PeBenito 17de1b
Dominick Grift 1e2abe
	# cjp: this shouldn't be needed
Dominick Grift 1e2abe
	userdom_use_unpriv_users_fds(system_razor_t)
Chris PeBenito 296273
Dominick Grift 1e2abe
	optional_policy(`
Dominick Grift 1e2abe
		logging_send_syslog_msg(system_razor_t)
Dominick Grift 1e2abe
	')
Chris PeBenito 296273
Dominick Grift 1e2abe
	optional_policy(`
Dominick Grift 1e2abe
		nscd_socket_use(system_razor_t)
Dominick Grift 1e2abe
	')
Chris PeBenito 296273
Dominick Grift 1e2abe
	########################################
Dominick Grift 1e2abe
	#
Dominick Grift 1e2abe
	# User razor local policy
Dominick Grift 1e2abe
	#
Chris PeBenito 296273
Dominick Grift 1e2abe
	# Allow razor to be run by hand.  Needed by any action other than
Dominick Grift 1e2abe
	# invocation from a spam filter.
Chris PeBenito 296273
Dominick Grift 1e2abe
	allow razor_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 296273
Dominick Grift 1e2abe
	manage_dirs_pattern(razor_t, razor_home_t, razor_home_t)
Dominick Grift 1e2abe
	manage_files_pattern(razor_t, razor_home_t, razor_home_t)
Dominick Grift 1e2abe
	manage_lnk_files_pattern(razor_t, razor_home_t, razor_home_t)
Dominick Grift 1e2abe
	userdom_user_home_dir_filetrans(razor_t, razor_home_t, dir)
Chris PeBenito 296273
Dominick Grift 1e2abe
	manage_dirs_pattern(razor_t, razor_tmp_t, razor_tmp_t)
Dominick Grift 1e2abe
	manage_files_pattern(razor_t, razor_tmp_t, razor_tmp_t)
Dominick Grift 1e2abe
	files_tmp_filetrans(razor_t, razor_tmp_t, { file dir })
Dan Walsh 3eaa99
Dominick Grift 1e2abe
	auth_use_nsswitch(razor_t)
Chris PeBenito 296273
Dominick Grift 1e2abe
	logging_send_syslog_msg(razor_t)
Chris PeBenito 296273
Dominick Grift 1e2abe
	userdom_search_user_home_dirs(razor_t)
Dominick Grift 1e2abe
	userdom_use_user_terminals(razor_t)
Chris PeBenito 296273
Dominick Grift 1e2abe
	tunable_policy(`use_nfs_home_dirs',`
Dominick Grift 1e2abe
		fs_manage_nfs_dirs(razor_t)
Dominick Grift 1e2abe
		fs_manage_nfs_files(razor_t)
Dominick Grift 1e2abe
		fs_manage_nfs_symlinks(razor_t)
Dominick Grift 1e2abe
	')
Chris PeBenito 17de1b
Dominick Grift 1e2abe
	tunable_policy(`use_samba_home_dirs',`
Dominick Grift 1e2abe
		fs_manage_cifs_dirs(razor_t)
Dominick Grift 1e2abe
		fs_manage_cifs_files(razor_t)
Dominick Grift 1e2abe
		fs_manage_cifs_symlinks(razor_t)
Dominick Grift 1e2abe
	')
Dan Walsh 3eaa99
Dominick Grift 1e2abe
	optional_policy(`
Dominick Grift 1e2abe
		milter_manage_spamass_state(razor_t)
Dominick Grift 1e2abe
	')
Chris PeBenito 17de1b
')