Chris PeBenito 78f17e
## <summary>APC UPS monitoring daemon</summary>
Chris PeBenito 78f17e
Chris PeBenito 78f17e
########################################
Chris PeBenito 78f17e
## <summary>
Chris PeBenito 78f17e
##	Execute a domain transition to run apcupsd.
Chris PeBenito 78f17e
## </summary>
Chris PeBenito 78f17e
## <param name="domain">
Dominick Grift c5eae5
##	<summary>
Chris PeBenito 78f17e
##	Domain allowed to transition.
Dominick Grift c5eae5
##	</summary>
Chris PeBenito 78f17e
## </param>
Chris PeBenito 78f17e
#
Chris PeBenito 78f17e
interface(`apcupsd_domtrans',`
Chris PeBenito 78f17e
	gen_require(`
Chris PeBenito 78f17e
		type apcupsd_t, apcupsd_exec_t;
Chris PeBenito 78f17e
	')
Chris PeBenito 78f17e
Dominick Grift eda641
	corecmd_search_bin($1)
Chris PeBenito 0bfccd
	domtrans_pattern($1, apcupsd_exec_t, apcupsd_t)
Chris PeBenito 78f17e
')
Chris PeBenito 78f17e
Chris PeBenito 78f17e
########################################
Chris PeBenito 78f17e
## <summary>
Dominick Grift eda641
##	Execute apcupsd server in the apcupsd domain.
Dominick Grift eda641
## </summary>
Dominick Grift eda641
## <param name="domain">
Dominick Grift eda641
##	<summary>
Dominick Grift 288845
##	Domain allowed to transition.
Dominick Grift eda641
##	</summary>
Dominick Grift eda641
## </param>
Dominick Grift eda641
#
Dominick Grift eda641
interface(`apcupsd_initrc_domtrans',`
Dominick Grift eda641
	gen_require(`
Dominick Grift eda641
		type apcupsd_initrc_exec_t;
Dominick Grift eda641
	')
Dominick Grift eda641
Dominick Grift eda641
	init_labeled_script_domtrans($1, apcupsd_initrc_exec_t)
Dominick Grift eda641
')
Dominick Grift eda641
Dominick Grift eda641
########################################
Dominick Grift eda641
## <summary>
Chris PeBenito 78f17e
##	Read apcupsd PID files.
Chris PeBenito 78f17e
## </summary>
Chris PeBenito 78f17e
## <param name="domain">
Chris PeBenito 78f17e
##	<summary>
Chris PeBenito 78f17e
##	Domain allowed access.
Chris PeBenito 78f17e
##	</summary>
Chris PeBenito 78f17e
## </param>
Chris PeBenito 78f17e
#
Chris PeBenito 78f17e
interface(`apcupsd_read_pid_files',`
Chris PeBenito 78f17e
	gen_require(`
Chris PeBenito 78f17e
		type apcupsd_var_run_t;
Chris PeBenito 78f17e
	')
Chris PeBenito 78f17e
Chris PeBenito 78f17e
	files_search_pids($1)
Chris PeBenito 78f17e
	allow $1 apcupsd_var_run_t:file read_file_perms;
Chris PeBenito 78f17e
')
Chris PeBenito 78f17e
Chris PeBenito 78f17e
########################################
Chris PeBenito 78f17e
## <summary>
Chris PeBenito 78f17e
##	Allow the specified domain to read apcupsd's log files.
Chris PeBenito 78f17e
## </summary>
Chris PeBenito 78f17e
## <param name="domain">
Chris PeBenito 78f17e
##	<summary>
Chris PeBenito 78f17e
##	Domain allowed access.
Chris PeBenito 78f17e
##	</summary>
Chris PeBenito 78f17e
## </param>
Chris PeBenito 78f17e
## <rolecap/>
Chris PeBenito 78f17e
#
Chris PeBenito 78f17e
interface(`apcupsd_read_log',`
Chris PeBenito 78f17e
	gen_require(`
Chris PeBenito 78f17e
		type apcupsd_log_t;
Chris PeBenito 78f17e
	')
Chris PeBenito 78f17e
Chris PeBenito 78f17e
	logging_search_logs($1)
Chris PeBenito 78f17e
	allow $1 apcupsd_log_t:dir list_dir_perms;
Chris PeBenito 82d277
	allow $1 apcupsd_log_t:file read_file_perms;
Chris PeBenito 78f17e
')
Chris PeBenito 78f17e
Chris PeBenito 78f17e
########################################
Chris PeBenito 78f17e
## <summary>
Chris PeBenito 78f17e
##	Allow the specified domain to append
Chris PeBenito 78f17e
##	apcupsd log files.
Chris PeBenito 78f17e
## </summary>
Chris PeBenito 78f17e
## <param name="domain">
Dominick Grift c5eae5
##	<summary>
Dominick Grift 288845
##	Domain allowed access.
Dominick Grift c5eae5
##	</summary>
Chris PeBenito 78f17e
## </param>
Chris PeBenito 78f17e
#
Chris PeBenito 78f17e
interface(`apcupsd_append_log',`
Chris PeBenito 78f17e
	gen_require(`
Chris PeBenito b34db7
		type apcupsd_log_t;
Chris PeBenito 78f17e
	')
Chris PeBenito 78f17e
Chris PeBenito 78f17e
	logging_search_logs($1)
Chris PeBenito 78f17e
	allow $1 apcupsd_log_t:dir list_dir_perms;
Chris PeBenito 82d277
	allow $1 apcupsd_log_t:file append_file_perms;
Chris PeBenito 78f17e
')
Chris PeBenito 72f82c
Chris PeBenito 72f82c
########################################
Chris PeBenito 72f82c
## <summary>
Chris PeBenito 72f82c
##	Execute a domain transition to run httpd_apcupsd_cgi_script.
Chris PeBenito 72f82c
## </summary>
Chris PeBenito 72f82c
## <param name="domain">
Dominick Grift c5eae5
##	<summary>
Chris PeBenito 72f82c
##	Domain allowed to transition.
Dominick Grift c5eae5
##	</summary>
Chris PeBenito 72f82c
## </param>
Chris PeBenito 72f82c
#
Chris PeBenito 859135
interface(`apcupsd_cgi_script_domtrans',`
Chris PeBenito 72f82c
	gen_require(`
Chris PeBenito 72f82c
		type httpd_apcupsd_cgi_script_t, httpd_apcupsd_cgi_script_exec_t;
Chris PeBenito 72f82c
	')
Chris PeBenito 72f82c
Dominick Grift eda641
	optional_policy(`
Dominick Grift eda641
		apache_search_sys_content($1)
Dominick Grift eda641
	')
Dominick Grift eda641
Dominick Grift eda641
	files_search_var($1)
Chris PeBenito 0bfccd
	domtrans_pattern($1, httpd_apcupsd_cgi_script_exec_t, httpd_apcupsd_cgi_script_t)
Chris PeBenito 72f82c
')
Chris PeBenito e87221
Chris PeBenito e87221
########################################
Chris PeBenito e87221
## <summary>
Chris PeBenito e87221
##	All of the rules required to administrate 
Chris PeBenito e87221
##	an apcupsd environment
Chris PeBenito e87221
## </summary>
Chris PeBenito e87221
## <param name="domain">
Chris PeBenito e87221
##	<summary>
Chris PeBenito e87221
##	Domain allowed access.
Chris PeBenito e87221
##	</summary>
Chris PeBenito e87221
## </param>
Chris PeBenito e87221
## <param name="role">
Chris PeBenito e87221
##	<summary>
Chris PeBenito e87221
##	The role to be allowed to manage the apcupsd domain.
Chris PeBenito e87221
##	</summary>
Chris PeBenito e87221
## </param>
Chris PeBenito e87221
## <rolecap/>
Chris PeBenito e87221
#
Chris PeBenito e87221
interface(`apcupsd_admin',`
Chris PeBenito e87221
	gen_require(`
Dominick Grift 6bb4d4
		type apcupsd_t, apcupsd_tmp_t, apcupsd_log_t;
Dominick Grift 6bb4d4
		type apcupsd_lock_t, apcupsd_var_run_t, apcupsd_initrc_exec_t;
Chris PeBenito e87221
	')
Chris PeBenito e87221
Chris PeBenito e87221
	allow $1 apcupsd_t:process { ptrace signal_perms };
Chris PeBenito e87221
	ps_process_pattern($1, apcupsd_t)
Chris PeBenito e87221
Dominick Grift eda641
	apcupsd_initrc_domtrans($1, apcupsd_initrc_exec_t)
Chris PeBenito e87221
	domain_system_change_exemption($1)
Chris PeBenito e87221
	role_transition $2 apcupsd_initrc_exec_t system_r;
Chris PeBenito e87221
	allow $2 system_r;
Chris PeBenito e87221
Chris PeBenito e87221
	files_list_var($1)
Chris PeBenito e87221
	admin_pattern($1, apcupsd_lock_t)
Chris PeBenito e87221
Chris PeBenito e87221
	logging_list_logs($1)
Chris PeBenito e87221
	admin_pattern($1, apcupsd_log_t)
Chris PeBenito e87221
Chris PeBenito e87221
	files_list_tmp($1)
Chris PeBenito e87221
	admin_pattern($1, apcupsd_tmp_t)
Chris PeBenito e87221
Chris PeBenito e87221
	files_list_pids($1)
Chris PeBenito e87221
	admin_pattern($1, apcupsd_var_run_t)
Chris PeBenito e87221
')