From mboxrd@z Thu Jan 1 00:00:00 1970 From: stefan@seekline.net (Stefan Schulze Frielinghaus) Date: Fri, 25 Dec 2009 13:55:00 +0100 Subject: [refpolicy] services_nut.patch In-Reply-To: <1261390459.2952.2.camel@localhost> References: <4AFC823D.3090202@redhat.com> <1258381900.5120.16.camel@localhost> <4B019ACD.4010406@redhat.com> <1258901980.2423.16.camel@localhost> <4B0A88B7.1050903@redhat.com> <1258987001.3109.6.camel@localhost> <1258989561.27504.643.camel@gorn.columbia.tresys.com> <1258992270.4516.13.camel@localhost> <1258992547.4516.17.camel@localhost> <4B0AC3B1.20003@redhat.com> <1261144417.26160.272.camel@gorn.columbia.tresys.com> <1261390459.2952.2.camel@localhost> Message-ID: <1261745700.2157.6.camel@localhost> To: refpolicy@oss.tresys.com List-Id: refpolicy.oss.tresys.com On Mon, 2009-12-21 at 11:14 +0100, Stefan Schulze Frielinghaus wrote: > On Fri, 2009-12-18 at 08:53 -0500, Christopher J. PeBenito wrote: > [...] > > Was there any resolution on this? > > Yes, but I had no physical access to my UPS for the last two weeks. At > the end of this week I will have physical access again and then I will > check that the policy is really working fine. So I expect a > tested/working policy in one to two weeks. I take the discussion back on list. Miroslav, from the latest policy I did not change anything except I removed the duplicate policies for the cgi scripts and uncommented the *_ups_port() stuff. I'm fine with the attached policy (tested several times including a shutdown and cgi services). Is the policy OK for you too? -------------- next part -------------- A non-text attachment was scrubbed... Name: corenetwork.te.in.patch Type: text/x-patch Size: 745 bytes Desc: not available Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20091225/276f25a8/attachment.bin -------------- next part -------------- /etc/ups(/.*)? gen_context(system_u:object_r:nut_conf_t,s0) /sbin/upsdrvctl -- gen_context(system_u:object_r:nut_upsdrvctl_exec_t,s0) /usr/sbin/upsd -- gen_context(system_u:object_r:nut_upsd_exec_t,s0) /usr/sbin/upsmon -- gen_context(system_u:object_r:nut_upsmon_exec_t,s0) /var/run/nut(/.*)? gen_context(system_u:object_r:nut_var_run_t,s0) /var/www/nut-cgi-bin/upsimage\.cgi -- gen_context(system_u:object_r:httpd_nutups_cgi_script_exec_t,s0) /var/www/nut-cgi-bin/upsset\.cgi -- gen_context(system_u:object_r:httpd_nutups_cgi_script_exec_t,s0) /var/www/nut-cgi-bin/upsstats\.cgi -- gen_context(system_u:object_r:httpd_nutups_cgi_script_exec_t,s0) -------------- next part -------------- ## SELinux policy for nut - Network UPS Tools -------------- next part -------------- policy_module(nut, 1.0.0) ######################################## # # Declarations # type nut_upsd_t; type nut_upsd_exec_t; init_daemon_domain(nut_upsd_t, nut_upsd_exec_t) type nut_upsmon_t; type nut_upsmon_exec_t; init_daemon_domain(nut_upsmon_t, nut_upsmon_exec_t) type nut_upsdrvctl_t; type nut_upsdrvctl_exec_t; init_daemon_domain(nut_upsdrvctl_t, nut_upsdrvctl_exec_t) # conf files type nut_conf_t; files_config_file(nut_conf_t) # pid files type nut_var_run_t; files_pid_file(nut_var_run_t) ######################################## # # Local policy for upsd # allow nut_upsd_t self:capability { setgid setuid }; allow nut_upsd_t self:unix_dgram_socket { create_socket_perms sendto }; allow nut_upsd_t self:tcp_socket connected_stream_socket_perms; allow nut_upsd_t nut_upsdrvctl_t:unix_stream_socket connectto; read_files_pattern(nut_upsd_t, nut_conf_t, nut_conf_t) # pid file manage_files_pattern(nut_upsd_t, nut_var_run_t, nut_var_run_t) manage_dirs_pattern(nut_upsd_t, nut_var_run_t, nut_var_run_t) manage_sock_files_pattern(nut_upsd_t, nut_var_run_t, nut_var_run_t) files_pid_filetrans(nut_upsd_t, nut_var_run_t, { file sock_file }) corenet_tcp_bind_ups_port(nut_upsd_t) corenet_tcp_bind_generic_port(nut_upsd_t) corenet_tcp_bind_all_nodes(nut_upsd_t) kernel_read_kernel_sysctls(nut_upsd_t) # /etc/nsswitch.conf auth_use_nsswitch(nut_upsd_t) files_read_usr_files(nut_upsd_t) logging_send_syslog_msg(nut_upsd_t) miscfiles_read_localization(nut_upsd_t) ######################################## # # Local policy for upsmon # allow nut_upsmon_t self:capability { dac_override dac_read_search setgid setuid }; allow nut_upsmon_t self:fifo_file rw_fifo_file_perms; allow nut_upsmon_t self:unix_dgram_socket { create_socket_perms sendto }; allow nut_upsmon_t self:tcp_socket create_socket_perms; read_files_pattern(nut_upsmon_t, nut_conf_t, nut_conf_t) # pid file manage_files_pattern(nut_upsmon_t, nut_var_run_t, nut_var_run_t) manage_dirs_pattern(nut_upsmon_t, nut_var_run_t, nut_var_run_t) files_pid_filetrans(nut_upsmon_t, nut_var_run_t, { file }) corenet_tcp_connect_ups_port(upsmon_t) corenet_tcp_connect_generic_port(nut_upsmon_t) corecmd_exec_bin(nut_upsmon_t) corecmd_exec_shell(nut_upsmon_t) kernel_read_kernel_sysctls(nut_upsmon_t) kernel_read_system_state(nut_upsmon_t) # Creates /etc/killpower files_manage_etc_runtime_files(nut_upsmon_t) files_etc_filetrans_etc_runtime(nut_upsmon_t, file) auth_use_nsswitch(nut_upsmon_t) files_search_usr(nut_upsmon_t) logging_send_syslog_msg(nut_upsmon_t) miscfiles_read_localization(nut_upsmon_t) # /usr/bin/wall term_write_all_terms(nut_upsmon_t) # upsmon runs shutdown, probably need a shutdown domain init_rw_utmp(nut_upsmon_t) init_telinit(nut_upsmon_t) ######################################## # # Local policy for upsdrvctl # allow nut_upsdrvctl_t self:capability { dac_override kill setgid setuid }; allow nut_upsdrvctl_t self:process { sigchld signal signull }; allow nut_upsdrvctl_t self:fd use; allow nut_upsdrvctl_t self:fifo_file rw_fifo_file_perms; allow nut_upsdrvctl_t self:unix_dgram_socket { create_socket_perms sendto }; allow nut_upsdrvctl_t self:udp_socket create_socket_perms; read_files_pattern(nut_upsdrvctl_t, nut_conf_t, nut_conf_t) # pid file manage_files_pattern(nut_upsdrvctl_t, nut_var_run_t, nut_var_run_t) manage_dirs_pattern(nut_upsdrvctl_t, nut_var_run_t, nut_var_run_t) manage_sock_files_pattern(nut_upsdrvctl_t, nut_var_run_t, nut_var_run_t) files_pid_filetrans(nut_upsdrvctl_t, nut_var_run_t, { file sock_file }) # /sbin/upsdrvctl executes other drivers corecmd_exec_bin(nut_upsdrvctl_t) corecmd_exec_sbin(nut_upsdrvctl_t) kernel_read_kernel_sysctls(nut_upsdrvctl_t) # /etc/nsswitch.conf auth_use_nsswitch(nut_upsdrvctl_t) dev_read_urand(nut_upsdrvctl_t) dev_rw_generic_usb_dev(nut_upsdrvctl_t) term_use_unallocated_ttys(nut_upsdrvctl_t) logging_send_syslog_msg(nut_upsdrvctl_t) miscfiles_read_localization(nut_upsdrvctl_t) init_sigchld(nut_upsdrvctl_t) ####################################### # # Local policy for upscgi scripts # requires httpd_enable_cgi and httpd_can_network_connect # optional_policy(` apache_content_template(nutups_cgi) read_files_pattern(httpd_nutups_cgi_script_t, nut_conf_t, nut_conf_t) corenet_tcp_connect_ups_port(httpd_nutups_cgi_script_t) ')