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">
Chris PeBenito 78f17e
## <summary>
Chris PeBenito 78f17e
##	Domain allowed to transition.
Chris PeBenito 78f17e
## </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
Chris PeBenito 0bfccd
	domtrans_pattern($1, apcupsd_exec_t, apcupsd_t)
Chris PeBenito 78f17e
')
Chris PeBenito 78f17e
Chris PeBenito 78f17e
########################################
Chris PeBenito 78f17e
## <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">
Chris PeBenito 78f17e
## 	<summary>
Chris PeBenito 78f17e
##	Domain allowed to transition.
Chris PeBenito 78f17e
## 	</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">
Chris PeBenito 72f82c
## <summary>
Chris PeBenito 72f82c
##	Domain allowed to transition.
Chris PeBenito 72f82c
## </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
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(`
Chris PeBenito 6073ea
		type apcupsd_t, apcupsd_tmp_t;
Chris PeBenito e87221
		type apcupsd_log_t, apcupsd_lock_t;
Chris PeBenito e87221
		type 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
Chris PeBenito e87221
	init_labeled_script_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
')