Chris PeBenito e526fc
Chris PeBenito 29af4c
policy_module(nut, 1.1.0)
Chris PeBenito e526fc
Chris PeBenito e526fc
########################################
Chris PeBenito e526fc
#
Chris PeBenito e526fc
# Declarations
Chris PeBenito e526fc
#
Chris PeBenito e526fc
Chris PeBenito e526fc
type nut_conf_t;
Chris PeBenito e526fc
files_config_file(nut_conf_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
type nut_upsd_t;
Chris PeBenito e526fc
type nut_upsd_exec_t;
Chris PeBenito e526fc
init_daemon_domain(nut_upsd_t, nut_upsd_exec_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
type nut_upsmon_t;
Chris PeBenito e526fc
type nut_upsmon_exec_t;
Chris PeBenito e526fc
init_daemon_domain(nut_upsmon_t, nut_upsmon_exec_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
type nut_upsdrvctl_t;
Chris PeBenito e526fc
type nut_upsdrvctl_exec_t;
Chris PeBenito e526fc
init_daemon_domain(nut_upsdrvctl_t, nut_upsdrvctl_exec_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
type nut_var_run_t;
Chris PeBenito e526fc
files_pid_file(nut_var_run_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
########################################
Chris PeBenito e526fc
#
Chris PeBenito e526fc
# Local policy for upsd
Chris PeBenito e526fc
#
Chris PeBenito e526fc
Jeremy Solt f8b3b7
allow nut_upsd_t self:capability { setgid setuid dac_override };
Jeremy Solt f8b3b7
Chris PeBenito e526fc
allow nut_upsd_t self:unix_dgram_socket { create_socket_perms sendto };
Chris PeBenito e526fc
allow nut_upsd_t self:tcp_socket connected_stream_socket_perms;
Chris PeBenito e526fc
Chris PeBenito e526fc
allow nut_upsd_t nut_upsdrvctl_t:unix_stream_socket connectto;
Chris PeBenito e526fc
Chris PeBenito e526fc
read_files_pattern(nut_upsd_t, nut_conf_t, nut_conf_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
# pid file
Chris PeBenito e526fc
manage_files_pattern(nut_upsd_t, nut_var_run_t, nut_var_run_t)
Chris PeBenito e526fc
manage_dirs_pattern(nut_upsd_t, nut_var_run_t, nut_var_run_t)
Chris PeBenito e526fc
manage_sock_files_pattern(nut_upsd_t, nut_var_run_t, nut_var_run_t)
Chris PeBenito e526fc
files_pid_filetrans(nut_upsd_t, nut_var_run_t, { file sock_file })
Chris PeBenito e526fc
Chris PeBenito e526fc
kernel_read_kernel_sysctls(nut_upsd_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
corenet_tcp_bind_ups_port(nut_upsd_t)
Chris PeBenito e526fc
corenet_tcp_bind_generic_port(nut_upsd_t)
Chris PeBenito e526fc
corenet_tcp_bind_all_nodes(nut_upsd_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
files_read_usr_files(nut_upsd_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
auth_use_nsswitch(nut_upsd_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
logging_send_syslog_msg(nut_upsd_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
miscfiles_read_localization(nut_upsd_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
########################################
Chris PeBenito e526fc
#
Chris PeBenito e526fc
# Local policy for upsmon
Chris PeBenito e526fc
#
Chris PeBenito e526fc
Chris PeBenito e526fc
allow nut_upsmon_t self:capability { dac_override dac_read_search setgid setuid };
Chris PeBenito e526fc
allow nut_upsmon_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito e526fc
allow nut_upsmon_t self:unix_dgram_socket { create_socket_perms sendto };
Chris PeBenito e526fc
allow nut_upsmon_t self:tcp_socket create_socket_perms;
Chris PeBenito e526fc
Chris PeBenito e526fc
read_files_pattern(nut_upsmon_t, nut_conf_t, nut_conf_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
# pid file
Chris PeBenito e526fc
manage_files_pattern(nut_upsmon_t, nut_var_run_t, nut_var_run_t)
Chris PeBenito e526fc
manage_dirs_pattern(nut_upsmon_t, nut_var_run_t, nut_var_run_t)
Chris PeBenito e526fc
files_pid_filetrans(nut_upsmon_t, nut_var_run_t, file)
Chris PeBenito e526fc
Chris PeBenito e526fc
kernel_read_kernel_sysctls(nut_upsmon_t)
Chris PeBenito e526fc
kernel_read_system_state(nut_upsmon_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
corecmd_exec_bin(nut_upsmon_t)
Chris PeBenito e526fc
corecmd_exec_shell(nut_upsmon_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
corenet_tcp_connect_ups_port(nut_upsmon_t)
Chris PeBenito e526fc
corenet_tcp_connect_generic_port(nut_upsmon_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
# Creates /etc/killpower
Chris PeBenito e526fc
files_manage_etc_runtime_files(nut_upsmon_t)
Chris PeBenito e526fc
files_etc_filetrans_etc_runtime(nut_upsmon_t, file)
Jeremy Solt f8b3b7
files_search_usr(nut_upsmon_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
# /usr/bin/wall
Chris PeBenito e526fc
term_write_all_terms(nut_upsmon_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
# upsmon runs shutdown, probably need a shutdown domain
Chris PeBenito e526fc
init_rw_utmp(nut_upsmon_t)
Chris PeBenito e526fc
init_telinit(nut_upsmon_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
logging_send_syslog_msg(nut_upsmon_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
auth_use_nsswitch(nut_upsmon_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
miscfiles_read_localization(nut_upsmon_t)
Chris PeBenito e526fc
Jeremy Solt f8b3b7
mta_send_mail(nut_upsmon_t)
Jeremy Solt f8b3b7
Chris PeBenito e526fc
########################################
Chris PeBenito e526fc
#
Chris PeBenito e526fc
# Local policy for upsdrvctl
Chris PeBenito e526fc
#
Chris PeBenito e526fc
Chris PeBenito e526fc
allow nut_upsdrvctl_t self:capability { dac_override kill setgid setuid };
Chris PeBenito e526fc
allow nut_upsdrvctl_t self:process { sigchld signal signull };
Chris PeBenito e526fc
allow nut_upsdrvctl_t self:fd use;
Chris PeBenito e526fc
allow nut_upsdrvctl_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito e526fc
allow nut_upsdrvctl_t self:unix_dgram_socket { create_socket_perms sendto };
Chris PeBenito e526fc
allow nut_upsdrvctl_t self:udp_socket create_socket_perms;
Chris PeBenito e526fc
Chris PeBenito e526fc
read_files_pattern(nut_upsdrvctl_t, nut_conf_t, nut_conf_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
# pid file
Chris PeBenito e526fc
manage_files_pattern(nut_upsdrvctl_t, nut_var_run_t, nut_var_run_t)
Chris PeBenito e526fc
manage_dirs_pattern(nut_upsdrvctl_t, nut_var_run_t, nut_var_run_t)
Chris PeBenito e526fc
manage_sock_files_pattern(nut_upsdrvctl_t, nut_var_run_t, nut_var_run_t)
Chris PeBenito e526fc
files_pid_filetrans(nut_upsdrvctl_t, nut_var_run_t, { file sock_file })
Chris PeBenito e526fc
Chris PeBenito e526fc
kernel_read_kernel_sysctls(nut_upsdrvctl_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
# /sbin/upsdrvctl executes other drivers
Chris PeBenito e526fc
corecmd_exec_bin(nut_upsdrvctl_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
dev_read_urand(nut_upsdrvctl_t)
Chris PeBenito e526fc
dev_rw_generic_usb_dev(nut_upsdrvctl_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
term_use_unallocated_ttys(nut_upsdrvctl_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
auth_use_nsswitch(nut_upsdrvctl_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
init_sigchld(nut_upsdrvctl_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
logging_send_syslog_msg(nut_upsdrvctl_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
miscfiles_read_localization(nut_upsdrvctl_t)
Chris PeBenito e526fc
Chris PeBenito e526fc
#######################################
Chris PeBenito e526fc
#
Chris PeBenito e526fc
# Local policy for upscgi scripts
Chris PeBenito e526fc
# requires httpd_enable_cgi and httpd_can_network_connect
Chris PeBenito e526fc
#
Chris PeBenito e526fc
Chris PeBenito e526fc
optional_policy(`
Chris PeBenito e526fc
	apache_content_template(nutups_cgi)
Chris PeBenito e526fc
Chris PeBenito e526fc
	read_files_pattern(httpd_nutups_cgi_script_t, nut_conf_t, nut_conf_t)
Chris PeBenito e526fc
Jeremy Solt f8b3b7
	corenet_all_recvfrom_unlabeled(httpd_nutups_cgi_script_t)
Jeremy Solt f8b3b7
	corenet_all_recvfrom_netlabel(httpd_nutups_cgi_script_t)
Jeremy Solt f8b3b7
	corenet_tcp_sendrecv_generic_if(httpd_nutups_cgi_script_t)
Jeremy Solt f8b3b7
	corenet_tcp_sendrecv_generic_node(httpd_nutups_cgi_script_t)
Jeremy Solt f8b3b7
	corenet_tcp_sendrecv_all_ports(httpd_nutups_cgi_script_t)
Chris PeBenito e526fc
	corenet_tcp_connect_ups_port(httpd_nutups_cgi_script_t)
Jeremy Solt f8b3b7
	corenet_udp_sendrecv_generic_if(httpd_nutups_cgi_script_t)
Jeremy Solt f8b3b7
	corenet_udp_sendrecv_generic_node(httpd_nutups_cgi_script_t)
Jeremy Solt f8b3b7
	corenet_udp_sendrecv_all_ports(httpd_nutups_cgi_script_t)
Jeremy Solt f8b3b7
Jeremy Solt f8b3b7
	sysnet_dns_name_resolve(httpd_nutups_cgi_script_t)
Chris PeBenito e526fc
')