Dominick Grift 95626ad
policy_module(apcupsd, 1.8.3)
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
########################################
Chris PeBenito 9401ae1
#
Chris PeBenito 9401ae1
# Declarations
Chris PeBenito 9401ae1
#
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
type apcupsd_t;
Chris PeBenito 9401ae1
type apcupsd_exec_t;
Chris PeBenito 9401ae1
init_daemon_domain(apcupsd_t, apcupsd_exec_t)
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
type apcupsd_lock_t;
Chris PeBenito 9401ae1
files_lock_file(apcupsd_lock_t)
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
type apcupsd_initrc_exec_t;
Chris PeBenito 9401ae1
init_script_file(apcupsd_initrc_exec_t)
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
type apcupsd_log_t;
Chris PeBenito 9401ae1
logging_log_file(apcupsd_log_t)
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
type apcupsd_tmp_t;
Chris PeBenito 9401ae1
files_tmp_file(apcupsd_tmp_t)
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
type apcupsd_var_run_t;
Chris PeBenito 9401ae1
files_pid_file(apcupsd_var_run_t)
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
########################################
Chris PeBenito 9401ae1
#
Dominick Grift 6cd9f59
# Local policy
Chris PeBenito 9401ae1
#
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
allow apcupsd_t self:capability { dac_override setgid sys_tty_config };
Chris PeBenito 9401ae1
allow apcupsd_t self:process signal;
Chris PeBenito 9401ae1
allow apcupsd_t self:fifo_file rw_file_perms;
Chris PeBenito 9401ae1
allow apcupsd_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 9401ae1
allow apcupsd_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
allow apcupsd_t apcupsd_lock_t:file manage_file_perms;
Chris PeBenito 9401ae1
files_lock_filetrans(apcupsd_t, apcupsd_lock_t, file)
Chris PeBenito 9401ae1
Dominick Grift 6cd9f59
append_files_pattern(apcupsd_t, apcupsd_log_t, apcupsd_log_t)
Dominick Grift 6cd9f59
create_files_pattern(apcupsd_t, apcupsd_log_t, apcupsd_log_t)
Dominick Grift 6cd9f59
setattr_files_pattern(apcupsd_t, apcupsd_log_t, apcupsd_log_t)
Dominick Grift 6cd9f59
logging_log_filetrans(apcupsd_t, apcupsd_log_t, file)
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
manage_files_pattern(apcupsd_t, apcupsd_tmp_t, apcupsd_tmp_t)
Chris PeBenito 9401ae1
files_tmp_filetrans(apcupsd_t, apcupsd_tmp_t, file)
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
manage_files_pattern(apcupsd_t, apcupsd_var_run_t, apcupsd_var_run_t)
Chris PeBenito 9401ae1
files_pid_filetrans(apcupsd_t, apcupsd_var_run_t, file)
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
kernel_read_system_state(apcupsd_t)
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
corecmd_exec_bin(apcupsd_t)
Chris PeBenito 9401ae1
corecmd_exec_shell(apcupsd_t)
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
corenet_all_recvfrom_unlabeled(apcupsd_t)
Chris PeBenito 9401ae1
corenet_all_recvfrom_netlabel(apcupsd_t)
Chris PeBenito 9401ae1
corenet_tcp_sendrecv_generic_if(apcupsd_t)
Chris PeBenito 9401ae1
corenet_tcp_sendrecv_generic_node(apcupsd_t)
Chris PeBenito 9401ae1
corenet_tcp_sendrecv_all_ports(apcupsd_t)
Chris PeBenito 9401ae1
corenet_tcp_bind_generic_node(apcupsd_t)
Dominick Grift 937d176
Chris PeBenito 9401ae1
corenet_tcp_bind_apcupsd_port(apcupsd_t)
Chris PeBenito 9401ae1
corenet_sendrecv_apcupsd_server_packets(apcupsd_t)
Chris PeBenito 9401ae1
corenet_tcp_connect_apcupsd_port(apcupsd_t)
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
dev_rw_generic_usb_dev(apcupsd_t)
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
files_read_etc_files(apcupsd_t)
Chris PeBenito 9401ae1
files_manage_etc_runtime_files(apcupsd_t)
Dominick Grift 6cd9f59
files_etc_filetrans_etc_runtime(apcupsd_t, file, "nologin")
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
term_use_unallocated_ttys(apcupsd_t)
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
logging_send_syslog_msg(apcupsd_t)
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
miscfiles_read_localization(apcupsd_t)
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
sysnet_dns_name_resolve(apcupsd_t)
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
userdom_use_user_ttys(apcupsd_t)
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
optional_policy(`
Chris PeBenito 9401ae1
	hostname_exec(apcupsd_t)
Chris PeBenito 9401ae1
')
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
optional_policy(`
Chris PeBenito 9401ae1
	mta_send_mail(apcupsd_t)
Chris PeBenito 9401ae1
	mta_system_content(apcupsd_tmp_t)
Chris PeBenito 9401ae1
')
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
optional_policy(`
Chris PeBenito 9401ae1
	shutdown_domtrans(apcupsd_t)
Chris PeBenito 9401ae1
')
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
########################################
Chris PeBenito 9401ae1
#
Dominick Grift 6cd9f59
# CGI local policy
Chris PeBenito 9401ae1
#
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
optional_policy(`
Chris PeBenito 9401ae1
	apache_content_template(apcupsd_cgi)
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
	allow httpd_apcupsd_cgi_script_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 9401ae1
	allow httpd_apcupsd_cgi_script_t self:udp_socket create_socket_perms;
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
	corenet_all_recvfrom_unlabeled(httpd_apcupsd_cgi_script_t)
Chris PeBenito 9401ae1
	corenet_all_recvfrom_netlabel(httpd_apcupsd_cgi_script_t)
Chris PeBenito 9401ae1
	corenet_tcp_sendrecv_generic_if(httpd_apcupsd_cgi_script_t)
Chris PeBenito 9401ae1
	corenet_tcp_sendrecv_generic_node(httpd_apcupsd_cgi_script_t)
Chris PeBenito 9401ae1
	corenet_tcp_sendrecv_all_ports(httpd_apcupsd_cgi_script_t)
Dominick Grift 6cd9f59
	corenet_sendrecv_apcupsd_client_packets(httpd_apcupsd_cgi_script_t)
Chris PeBenito 9401ae1
	corenet_tcp_connect_apcupsd_port(httpd_apcupsd_cgi_script_t)
Chris PeBenito 9401ae1
	corenet_udp_sendrecv_generic_if(httpd_apcupsd_cgi_script_t)
Chris PeBenito 9401ae1
	corenet_udp_sendrecv_generic_node(httpd_apcupsd_cgi_script_t)
Chris PeBenito 9401ae1
	corenet_udp_sendrecv_all_ports(httpd_apcupsd_cgi_script_t)
Chris PeBenito 9401ae1
Chris PeBenito 9401ae1
	sysnet_dns_name_resolve(httpd_apcupsd_cgi_script_t)
Chris PeBenito 9401ae1
')