Dominick Grift ddf821
## <summary>libcg is a library that abstracts the control group file system in Linux.</summary>
Dominick Grift ddf821
Dominick Grift ddf821
########################################
Dominick Grift ddf821
## <summary>
Dominick Grift ddf821
##	Execute a domain transition to run
Dominick Grift 61d7ee
##	CG Clear.
Dominick Grift 61d7ee
## </summary>
Dominick Grift 61d7ee
## <param name="domain">
Dominick Grift 61d7ee
## <summary>
Dominick Grift 61d7ee
##	Domain allowed to transition.
Dominick Grift 61d7ee
## </summary>
Dominick Grift 61d7ee
## </param>
Dominick Grift 61d7ee
#
Dominick Grift 61d7ee
interface(`cgroup_domtrans_cgclear',`
Dominick Grift 61d7ee
	gen_require(`
Dominick Grift 61d7ee
		type cgclear_t, cgclear_exec_t;
Dominick Grift 61d7ee
	')
Dominick Grift 61d7ee
Dominick Grift 61d7ee
	domtrans_pattern($1, cgclear_exec_t, cgclear_t)
Dominick Grift 61d7ee
	corecmd_search_bin($1)
Dominick Grift 61d7ee
')
Dominick Grift 61d7ee
Dominick Grift 61d7ee
########################################
Dominick Grift 61d7ee
## <summary>
Dominick Grift 61d7ee
##	Execute a domain transition to run
Dominick Grift ddf821
##	CG config parser.
Dominick Grift ddf821
## </summary>
Dominick Grift ddf821
## <param name="domain">
Dominick Grift ddf821
## <summary>
Dominick Grift ddf821
##	Domain allowed to transition.
Dominick Grift ddf821
## </summary>
Dominick Grift ddf821
## </param>
Dominick Grift ddf821
#
Chris PeBenito 53f9ab
interface(`cgroup_domtrans_cgconfig',`
Dominick Grift ddf821
	gen_require(`
Chris PeBenito 53f9ab
		type cgconfig_t, cgconfig_exec_t;
Dominick Grift ddf821
	')
Dominick Grift ddf821
Chris PeBenito 53f9ab
	domtrans_pattern($1, cgconfig_exec_t, cgconfig_t)
Dominick Grift ddf821
	corecmd_search_bin($1)
Dominick Grift ddf821
')
Dominick Grift ddf821
Dominick Grift ddf821
########################################
Dominick Grift ddf821
## <summary>
Dominick Grift ddf821
##	Execute a domain transition to run
Dominick Grift ddf821
##	CG config parser.
Dominick Grift ddf821
## </summary>
Dominick Grift ddf821
## <param name="domain">
Dominick Grift ddf821
##	<summary>
Dominick Grift ddf821
##	Domain allowed to transition.
Dominick Grift ddf821
##	</summary>
Dominick Grift ddf821
## </param>
Dominick Grift ddf821
#
Chris PeBenito 53f9ab
interface(`cgroup_initrc_domtrans_cgconfig',`
Dominick Grift ddf821
	gen_require(`
Dominick Grift ddf821
		type cgconfig_initrc_exec_t;
Dominick Grift ddf821
	')
Dominick Grift ddf821
Dominick Grift ddf821
	init_labeled_script_domtrans($1, cgconfig_initrc_exec_t)
Dominick Grift ddf821
')
Dominick Grift ddf821
Dominick Grift ddf821
########################################
Dominick Grift ddf821
## <summary>
Dominick Grift ddf821
##	Execute a domain transition to run
Dominick Grift ddf821
##	CG rules engine daemon.
Dominick Grift ddf821
## </summary>
Dominick Grift ddf821
## <param name="domain">
Dominick Grift ddf821
## <summary>
Dominick Grift ddf821
##	Domain allowed to transition.
Dominick Grift ddf821
## </summary>
Dominick Grift ddf821
## </param>
Dominick Grift ddf821
#
Dominick Grift ddf821
interface(`cgroup_domtrans_cgred',`
Dominick Grift ddf821
	gen_require(`
Dominick Grift ddf821
		type cgred_t, cgred_exec_t;
Dominick Grift ddf821
	')
Dominick Grift ddf821
Dominick Grift ddf821
	domtrans_pattern($1, cgred_exec_t, cgred_t)
Dominick Grift ddf821
	corecmd_search_bin($1)
Dominick Grift ddf821
')
Dominick Grift ddf821
Dominick Grift ddf821
########################################
Dominick Grift ddf821
## <summary>
Dominick Grift ddf821
##	Execute a domain transition to run
Dominick Grift ddf821
## 	CG rules engine daemon.
Dominick Grift ddf821
##	domain.
Dominick Grift ddf821
## </summary>
Dominick Grift ddf821
## <param name="domain">
Dominick Grift ddf821
##	<summary>
Dominick Grift ddf821
##	Domain allowed to transition.
Dominick Grift ddf821
##	</summary>
Dominick Grift ddf821
## </param>
Dominick Grift ddf821
#
Dominick Grift ddf821
interface(`cgroup_initrc_domtrans_cgred',`
Dominick Grift ddf821
	gen_require(`
Dominick Grift ddf821
		type cgred_initrc_exec_t;
Dominick Grift ddf821
	')
Dominick Grift ddf821
Dominick Grift ddf821
	init_labeled_script_domtrans($1, cgred_initrc_exec_t)
Dominick Grift ddf821
')
Dominick Grift ddf821
Dominick Grift ddf821
########################################
Dominick Grift ddf821
## <summary>
Dominick Grift 61d7ee
##	Execute a domain transition to
Dominick Grift 61d7ee
##	run CG Clear and allow the
Dominick Grift 61d7ee
##	specified role the CG Clear
Dominick Grift 61d7ee
##	domain.
Dominick Grift 61d7ee
## </summary>
Dominick Grift 61d7ee
## <param name="domain">
Dominick Grift 61d7ee
##	<summary>
Dominick Grift 61d7ee
##	Domain allowed to transition.
Dominick Grift 61d7ee
##	</summary>
Dominick Grift 61d7ee
## </param>
Dominick Grift 61d7ee
## <param name="role">
Dominick Grift 61d7ee
##	<summary>
Dominick Grift 61d7ee
##	Role allowed access.
Dominick Grift 61d7ee
##	</summary>
Dominick Grift 61d7ee
## </param>
Dominick Grift 61d7ee
## <rolecap/>
Dominick Grift 61d7ee
#
Dominick Grift 61d7ee
interface(`cgroup_run_cgclear',`
Dominick Grift 61d7ee
	gen_require(`
Dominick Grift 61d7ee
		type cgclear_t;
Dominick Grift 61d7ee
	')
Dominick Grift 61d7ee
Dominick Grift 61d7ee
	cgroup_domtrans_cgclear($1)
Dominick Grift 61d7ee
	role $2 types cgclear_t;
Dominick Grift 61d7ee
')
Dominick Grift 61d7ee
Dominick Grift 61d7ee
########################################
Dominick Grift 61d7ee
## <summary>
Dominick Grift ddf821
##	Connect to CG rules engine daemon
Dominick Grift ddf821
##	over unix stream sockets.
Dominick Grift ddf821
## </summary>
Dominick Grift ddf821
## <param name="domain">
Dominick Grift ddf821
##	<summary>
Dominick Grift ddf821
##	Domain allowed access.
Dominick Grift ddf821
##	</summary>
Dominick Grift ddf821
## </param>
Dominick Grift ddf821
#
Dominick Grift 61d7ee
interface(`cgroup_stream_connect_cgred', `
Dominick Grift ddf821
	gen_require(`
Dominick Grift ddf821
		type cgred_var_run_t, cgred_t;
Dominick Grift ddf821
	')
Dominick Grift ddf821
Dominick Grift ddf821
	stream_connect_pattern($1, cgred_var_run_t, cgred_var_run_t, cgred_t)
Dominick Grift ddf821
	files_search_pids($1)
Dominick Grift ddf821
')
Dominick Grift ddf821
Dominick Grift ddf821
########################################
Dominick Grift ddf821
## <summary>
Chris PeBenito 04dcd7
##	All of the rules required to administrate
Dominick Grift ddf821
##	an cgroup environment.
Dominick Grift ddf821
## </summary>
Dominick Grift ddf821
## <param name="domain">
Dominick Grift ddf821
##	<summary>
Dominick Grift ddf821
##	Domain allowed access.
Dominick Grift ddf821
##	</summary>
Dominick Grift ddf821
## </param>
Dominick Grift ddf821
## <param name="role">
Dominick Grift ddf821
##	<summary>
Dominick Grift ddf821
##	Role allowed access.
Dominick Grift ddf821
##	</summary>
Dominick Grift ddf821
## </param>
Dominick Grift ddf821
## <rolecap/>
Dominick Grift ddf821
#
Dominick Grift ddf821
interface(`cgroup_admin',`
Dominick Grift ddf821
	gen_require(`
Chris PeBenito 53f9ab
		type cgred_t, cgconfig_t, cgred_var_run_t;
Dominick Grift ddf821
		type cgconfig_etc_t, cgconfig_initrc_exec_t, cgred_initrc_exec_t;
Chris PeBenito 00ca40
		type cgrules_etc_t, cgclear_t;
Dominick Grift ddf821
	')
Dominick Grift ddf821
Dominick Grift 61d7ee
	allow $1 cgclear_t:process { ptrace signal_perms };
Dominick Grift 61d7ee
	ps_process_pattern($1, cgclear_t)
Dominick Grift ddf821
Dominick Grift 61d7ee
	allow $1 cgconfig_t:process { ptrace signal_perms };
Dominick Grift 61d7ee
	ps_process_pattern($1, cgconfig_t)
Dominick Grift 61d7ee
Dominick Grift 61d7ee
	allow $1 cgred_t:process { ptrace signal_perms };
Dominick Grift 61d7ee
	ps_process_pattern($1, cgred_t)
Dominick Grift ddf821
Dominick Grift ddf821
	admin_pattern($1, cgconfig_etc_t)
Dominick Grift 7e5463
	admin_pattern($1, cgrules_etc_t)
Dominick Grift ddf821
	files_search_etc($1)
Dominick Grift ddf821
Dominick Grift ddf821
	admin_pattern($1, cgred_var_run_t)
Dominick Grift ddf821
	files_search_pids($1)
Dominick Grift ddf821
Chris PeBenito 53f9ab
	cgroup_initrc_domtrans_cgconfig($1)
Dominick Grift ddf821
	domain_system_change_exemption($1)
Dominick Grift ddf821
	role_transition $2 cgconfig_initrc_exec_t system_r;
Dominick Grift ddf821
	allow $2 system_r;
Dominick Grift ddf821
Dominick Grift ddf821
	cgroup_initrc_domtrans_cgred($1)
Dominick Grift ddf821
	role_transition $2 cgred_initrc_exec_t system_r;
Dominick Grift 61d7ee
Dominick Grift 61d7ee
	cgroup_run_cgclear($1, $2)
Dominick Grift ddf821
')