Chris PeBenito 17de1b
## <summary>TOR, the onion router</summary>
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Execute a domain transition to run TOR.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed to transition.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`tor_domtrans',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type tor_t, tor_exec_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 0bfccd
	domtrans_pattern($1, tor_exec_t, tor_t)
Chris PeBenito 17de1b
')
Chris PeBenito 7a5e2d
Chris PeBenito 7a5e2d
########################################
Chris PeBenito 7a5e2d
## <summary>
Chris PeBenito 7a5e2d
##	All of the rules required to administrate 
Chris PeBenito 7a5e2d
##	an tor environment
Chris PeBenito 7a5e2d
## </summary>
Chris PeBenito 7a5e2d
## <param name="domain">
Chris PeBenito 7a5e2d
##	<summary>
Chris PeBenito 7a5e2d
##	Domain allowed access.
Chris PeBenito 7a5e2d
##	</summary>
Chris PeBenito 7a5e2d
## </param>
Chris PeBenito e87221
## <param name="role">
Chris PeBenito e87221
##	<summary>
Chris PeBenito e87221
##	The role to be allowed to manage the tor domain.
Chris PeBenito e87221
##	</summary>
Chris PeBenito e87221
## </param>
Chris PeBenito 7a5e2d
## <rolecap/>
Chris PeBenito 7a5e2d
#
Chris PeBenito 7a5e2d
interface(`tor_admin',`
Chris PeBenito 7a5e2d
	gen_require(`
Chris PeBenito 8f3a0a
		type tor_t, tor_var_log_t, tor_etc_t;
Chris PeBenito 7a5e2d
		type tor_var_lib_t, tor_var_run_t;
Chris PeBenito e87221
		type tor_initrc_exec_t;
Chris PeBenito 7a5e2d
	')
Chris PeBenito 7a5e2d
Dominick Grift 819518
	allow $1 tor_t:process { ptrace signal_perms };
Chris PeBenito 7a5e2d
	ps_process_pattern($1, tor_t)
Chris PeBenito e87221
Chris PeBenito e87221
	init_labeled_script_domtrans($1, tor_initrc_exec_t)
Chris PeBenito e87221
	domain_system_change_exemption($1)
Chris PeBenito e87221
	role_transition $2 tor_initrc_exec_t system_r;
Chris PeBenito e87221
	allow $2 system_r;
Chris PeBenito 7a5e2d
Chris PeBenito 7a5e2d
	files_list_etc($1)
Chris PeBenito e87221
	admin_pattern($1, tor_etc_t)
Chris PeBenito 7a5e2d
Chris PeBenito 7a5e2d
	files_list_var_lib($1)
Chris PeBenito e87221
	admin_pattern($1, tor_var_lib_t)
Chris PeBenito e87221
Chris PeBenito e87221
	logging_list_logs($1)
Chris PeBenito e87221
	admin_pattern($1, tor_var_log_t)
Chris PeBenito 7a5e2d
Chris PeBenito 7a5e2d
	files_list_pids($1)
Chris PeBenito e87221
	admin_pattern($1, tor_var_run_t)
Chris PeBenito 7a5e2d
')