Chris PeBenito 78f17e
Chris PeBenito 3480f3
policy_module(apcupsd,1.2.0)
Chris PeBenito 78f17e
Chris PeBenito 78f17e
########################################
Chris PeBenito 78f17e
#
Chris PeBenito 78f17e
# Declarations
Chris PeBenito 78f17e
#
Chris PeBenito 78f17e
Chris PeBenito 78f17e
type apcupsd_t;
Chris PeBenito 78f17e
type apcupsd_exec_t;
Chris PeBenito 78f17e
init_daemon_domain(apcupsd_t, apcupsd_exec_t)
Chris PeBenito 78f17e
Chris PeBenito 78f17e
type apcupsd_lock_t;
Chris PeBenito 78f17e
files_lock_file(apcupsd_lock_t)
Chris PeBenito 78f17e
Chris PeBenito 78f17e
type apcupsd_log_t;
Chris PeBenito 78f17e
logging_log_file(apcupsd_log_t)
Chris PeBenito 78f17e
Chris PeBenito 72f82c
type apcupsd_tmp_t;
Chris PeBenito 72f82c
files_tmp_file(apcupsd_tmp_t)
Chris PeBenito 72f82c
Chris PeBenito 78f17e
type apcupsd_var_run_t;
Chris PeBenito 78f17e
files_pid_file(apcupsd_var_run_t)
Chris PeBenito 78f17e
Chris PeBenito 78f17e
########################################
Chris PeBenito 78f17e
#
Chris PeBenito 78f17e
# apcupsd local policy
Chris PeBenito 78f17e
#
Chris PeBenito 78f17e
Chris PeBenito 72f82c
allow apcupsd_t self:capability { dac_override setgid sys_tty_config };
Chris PeBenito c412be
allow apcupsd_t self:process signal;
Chris PeBenito 78f17e
allow apcupsd_t self:fifo_file rw_file_perms;
Chris PeBenito 78f17e
allow apcupsd_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 78f17e
allow apcupsd_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 78f17e
Chris PeBenito 78f17e
allow apcupsd_t apcupsd_lock_t:file manage_file_perms;
Chris PeBenito 78f17e
files_lock_filetrans(apcupsd_t,apcupsd_lock_t,file)
Chris PeBenito 78f17e
Chris PeBenito 78f17e
allow apcupsd_t apcupsd_log_t:dir setattr;
Chris PeBenito 78f17e
manage_files_pattern(apcupsd_t,apcupsd_log_t,apcupsd_log_t)
Chris PeBenito 78f17e
logging_log_filetrans(apcupsd_t,apcupsd_log_t,{ file dir })
Chris PeBenito 78f17e
Chris PeBenito 72f82c
manage_files_pattern(apcupsd_t, apcupsd_tmp_t, apcupsd_tmp_t)
Chris PeBenito 72f82c
files_tmp_filetrans(apcupsd_t, apcupsd_tmp_t, file)
Chris PeBenito 72f82c
Chris PeBenito 78f17e
manage_files_pattern(apcupsd_t,apcupsd_var_run_t,apcupsd_var_run_t)
Chris PeBenito 78f17e
files_pid_filetrans(apcupsd_t,apcupsd_var_run_t, file)
Chris PeBenito 78f17e
Chris PeBenito 72f82c
kernel_read_system_state(apcupsd_t)
Chris PeBenito 72f82c
Chris PeBenito 72f82c
corecmd_exec_bin(apcupsd_t)
Chris PeBenito 72f82c
corecmd_exec_shell(apcupsd_t)
Chris PeBenito 72f82c
Chris PeBenito 190066
corenet_all_recvfrom_unlabeled(apcupsd_t)
Chris PeBenito 190066
corenet_all_recvfrom_netlabel(apcupsd_t)
Chris PeBenito 78f17e
corenet_tcp_sendrecv_generic_if(apcupsd_t)
Chris PeBenito 78f17e
corenet_tcp_sendrecv_all_nodes(apcupsd_t)
Chris PeBenito 78f17e
corenet_tcp_sendrecv_all_ports(apcupsd_t)
Chris PeBenito 78f17e
corenet_tcp_bind_all_nodes(apcupsd_t)
Chris PeBenito c412be
corenet_tcp_bind_apcupsd_port(apcupsd_t)
Chris PeBenito c412be
corenet_sendrecv_apcupsd_server_packets(apcupsd_t)
Chris PeBenito 72f82c
corenet_tcp_connect_apcupsd_port(apcupsd_t)
Chris PeBenito 78f17e
Chris PeBenito 78f17e
dev_rw_generic_usb_dev(apcupsd_t)
Chris PeBenito 78f17e
Chris PeBenito 78f17e
# Init script handling
Chris PeBenito 78f17e
domain_use_interactive_fds(apcupsd_t)
Chris PeBenito 78f17e
Chris PeBenito 78f17e
files_read_etc_files(apcupsd_t)
Chris PeBenito 78f17e
files_search_locks(apcupsd_t)
Chris PeBenito 72f82c
# Creates /etc/nologin
Chris PeBenito 72f82c
files_manage_etc_runtime_files(apcupsd_t)
Chris PeBenito 72f82c
files_etc_filetrans_etc_runtime(apcupsd_t,file)
Chris PeBenito 72f82c
Chris PeBenito 72f82c
# https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=240805
Chris PeBenito 72f82c
term_use_unallocated_ttys(apcupsd_t)
Chris PeBenito 72f82c
Chris PeBenito 72f82c
#apcupsd runs shutdown, probably need a shutdown domain
Chris PeBenito 72f82c
init_rw_utmp(apcupsd_t)
Chris PeBenito 72f82c
init_telinit(apcupsd_t)
Chris PeBenito 78f17e
Chris PeBenito 78f17e
libs_use_ld_so(apcupsd_t)
Chris PeBenito 78f17e
libs_use_shared_libs(apcupsd_t)
Chris PeBenito 78f17e
Chris PeBenito 78f17e
logging_send_syslog_msg(apcupsd_t)
Chris PeBenito 78f17e
Chris PeBenito 78f17e
miscfiles_read_localization(apcupsd_t)
Chris PeBenito 78f17e
Chris PeBenito 72f82c
optional_policy(`
Chris PeBenito 72f82c
	hostname_exec(apcupsd_t)
Chris PeBenito 72f82c
')
Chris PeBenito 72f82c
Chris PeBenito 72f82c
optional_policy(`
Chris PeBenito 72f82c
	mta_send_mail(apcupsd_t)
Chris PeBenito 72f82c
')
Chris PeBenito 72f82c
Chris PeBenito 72f82c
########################################
Chris PeBenito 72f82c
#
Chris PeBenito 72f82c
# apcupsd_cgi Declarations
Chris PeBenito 72f82c
#
Chris PeBenito 72f82c
Chris PeBenito 72f82c
optional_policy(`
Chris PeBenito 72f82c
	apache_content_template(apcupsd_cgi)
Chris PeBenito 72f82c
	
Chris PeBenito 72f82c
	allow httpd_apcupsd_cgi_script_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 72f82c
	allow httpd_apcupsd_cgi_script_t self:udp_socket create_socket_perms;
Chris PeBenito 72f82c
	
Chris PeBenito 72f82c
	corenet_all_recvfrom_unlabeled(httpd_apcupsd_cgi_script_t)
Chris PeBenito 72f82c
	corenet_all_recvfrom_netlabel(httpd_apcupsd_cgi_script_t)
Chris PeBenito 72f82c
	corenet_tcp_sendrecv_all_if(httpd_apcupsd_cgi_script_t)
Chris PeBenito 72f82c
	corenet_tcp_sendrecv_all_nodes(httpd_apcupsd_cgi_script_t)
Chris PeBenito 72f82c
	corenet_tcp_sendrecv_all_ports(httpd_apcupsd_cgi_script_t)
Chris PeBenito 72f82c
	corenet_tcp_connect_apcupsd_port(httpd_apcupsd_cgi_script_t)
Chris PeBenito 72f82c
	corenet_udp_sendrecv_all_if(httpd_apcupsd_cgi_script_t)
Chris PeBenito 72f82c
	corenet_udp_sendrecv_all_nodes(httpd_apcupsd_cgi_script_t)
Chris PeBenito 72f82c
	corenet_udp_sendrecv_all_ports(httpd_apcupsd_cgi_script_t)
Chris PeBenito 72f82c
	
Chris PeBenito 72f82c
	sysnet_dns_name_resolve(httpd_apcupsd_cgi_script_t)
Chris PeBenito 72f82c
')