services_nut.patch
http://people.fedoraproject.org/~dwalsh/SELinux/F13/services_nut.patch
Latest nut policy.
Quoted 3 lines · Daniel J Walsh
http://people.fedoraproject.org/~dwalsh/SELinux/F13/services_nut.patch
Latest nut policy.
The following rules are unnecessary because they are already included by the interface apache_content_template as soon as the booleans httpd_enable_cgi and httpd_can_network_connect are enabled:
+ corenet_all_recvfrom_unlabeled(httpd_nutups_cgi_script_t)
+ corenet_all_recvfrom_netlabel(httpd_nutups_cgi_script_t)
+ corenet_tcp_sendrecv_generic_if(httpd_nutups_cgi_script_t)
+ corenet_tcp_sendrecv_generic_node(httpd_nutups_cgi_script_t)
+ corenet_tcp_sendrecv_all_ports(httpd_nutups_cgi_script_t)
corenet_tcp_connect_ups_port(httpd_nutups_cgi_script_t)
+ corenet_udp_sendrecv_generic_if(httpd_nutups_cgi_script_t)
+ corenet_udp_sendrecv_generic_node(httpd_nutups_cgi_script_t)
+ corenet_udp_sendrecv_all_ports(httpd_nutups_cgi_script_t)
+
+ sysnet_dns_name_resolve(httpd_nutups_cgi_script_t)
Is it really necessary to include the dac_override permissions for nut_upsd_t? I thought that the upsd daemon runs as a non root user where no dac_override permissions are used.
-allow nut_upsd_t self:capability { setgid setuid }; +allow nut_upsd_t self:capability { setgid setuid dac_override };
If you still have the AVC message and maybe some information of the setup, then I would like to dig a bit deeper into this because I use nut and would like to make it more secure ;-) Maybe the capabilities can even be dropped.
Guess the sbin rules are not necessary for refpolicy:
+corecmd_exec_sbin(nut_upsdrvctl_t)
Quoted 13 lines · Stefan Schulze Frielinghaus
Quoted 4 lines · Daniel J Walsh
http://people.fedoraproject.org/~dwalsh/SELinux/F13/services_nut.patch
Latest nut policy.
The following rules are unnecessary because they are already included by the interface
apache_content_templateas soon as the booleanshttpd_enable_cgiandhttpd_can_network_connectare enabled:(quoted diff) +1
-0+ corenet_all_recvfrom_unlabeled(httpd_nutups_cgi_script_t)
Review
Quoted 10 lines
(quoted diff) +9
-0+ corenet_all_recvfrom_netlabel(httpd_nutups_cgi_script_t) + corenet_tcp_sendrecv_generic_if(httpd_nutups_cgi_script_t) + corenet_tcp_sendrecv_generic_node(httpd_nutups_cgi_script_t) + corenet_tcp_sendrecv_all_ports(httpd_nutups_cgi_script_t) corenet_tcp_connect_ups_port(httpd_nutups_cgi_script_t) + corenet_udp_sendrecv_generic_if(httpd_nutups_cgi_script_t) + corenet_udp_sendrecv_generic_node(httpd_nutups_cgi_script_t) + corenet_udp_sendrecv_all_ports(httpd_nutups_cgi_script_t) + + sysnet_dns_name_resolve(httpd_nutups_cgi_script_t)
Ok this is a difference between apache interface in upstream and mine. I removed network access
set by those booleans from the interface to httpd_sys_script_t specific. I don't believe those interfaces should be effected by booleans. I don't want my bugzilla cgi to suddenly have network access just because httpd_sys_script_t needs it.
Quoted 7 lines
Is it really necessary to include the
dac_overridepermissions fornut_upsd_t? I thought that the upsd daemon runs as a non root user where nodac_overridepermissions are used.(quoted diff) +1
-1-allow nut_upsd_t self:capability { setgid setuid }; +allow nut_upsd_t self:capability { setgid setuid dac_override };
Quoted 10 lines
If you still have the AVC message and maybe some information of the setup, then I would like to dig a bit deeper into this because I use nut and would like to make it more secure ;-) Maybe the capabilities can even be dropped.
Guess the sbin rules are not necessary for refpolicy:
+corecmd_exec_sbin(nut_upsdrvctl_t)
Oops that is a bug.
dac_override can come in because a file has bad ownership.
Quoted 22 lines · Daniel J Walsh
Quoted 21 lines · Stefan Schulze Frielinghaus
Quoted 4 lines · Daniel J Walsh
http://people.fedoraproject.org/~dwalsh/SELinux/F13/services_nut.patch
Latest nut policy.
The following rules are unnecessary because they are already included by the interface
apache_content_templateas soon as the booleanshttpd_enable_cgiandhttpd_can_network_connectare enabled:(quoted diff) +10
-0+ corenet_all_recvfrom_unlabeled(httpd_nutups_cgi_script_t) + corenet_all_recvfrom_netlabel(httpd_nutups_cgi_script_t) + corenet_tcp_sendrecv_generic_if(httpd_nutups_cgi_script_t) + corenet_tcp_sendrecv_generic_node(httpd_nutups_cgi_script_t) + corenet_tcp_sendrecv_all_ports(httpd_nutups_cgi_script_t) corenet_tcp_connect_ups_port(httpd_nutups_cgi_script_t) + corenet_udp_sendrecv_generic_if(httpd_nutups_cgi_script_t) + corenet_udp_sendrecv_generic_node(httpd_nutups_cgi_script_t) + corenet_udp_sendrecv_all_ports(httpd_nutups_cgi_script_t) + + sysnet_dns_name_resolve(httpd_nutups_cgi_script_t)
Quoted 8 lines
Quoted 2 lines
Ok this is a difference between apache interface in upstream and mine. I removed network access
set by those booleans from the interface tohttpd_sys_script_tspecific. I don't believe those interfaces should be effected by booleans. I don't want my bugzilla cgi to suddenly have network access just becausehttpd_sys_script_tneeds it.
Yeah, I like this idea.
Quoted 12 lines
Quoted 12 lines
Is it really necessary to include the
dac_overridepermissions fornut_upsd_t? I thought that the upsd daemon runs as a non root user where nodac_overridepermissions are used.(quoted diff) +1
-1-allow nut_upsd_t self:capability { setgid setuid }; +allow nut_upsd_t self:capability { setgid setuid dac_override };If you still have the AVC message and maybe some information of the setup, then I would like to dig a bit deeper into this because I use nut and would like to make it more secure ;-) Maybe the capabilities can even be dropped.
Quoted 8 lines
Quoted 5 lines
Guess the sbin rules are not necessary for refpolicy:
+corecmd_exec_sbin(nut_upsdrvctl_t)
Oops that is a bug.
dac_overridecan come in because a file has bad ownership.
upsd runs per default as user nut on Fedora and EPEL. It should never run as root.
Quoted 60 lines · Stefan Schulze Frielinghaus
Quoted 26 lines · Daniel J Walsh
Quoted 24 lines · Stefan Schulze Frielinghaus
Quoted 5 lines · Daniel J Walsh
http://people.fedoraproject.org/~dwalsh/SELinux/F13/services_nut.patch
Latest nut policy.
The following rules are unnecessary because they are already included by the interface
apache_content_templateas soon as the booleanshttpd_enable_cgiandhttpd_can_network_connectare enabled:(quoted diff) +10
-0+ corenet_all_recvfrom_unlabeled(httpd_nutups_cgi_script_t) + corenet_all_recvfrom_netlabel(httpd_nutups_cgi_script_t) + corenet_tcp_sendrecv_generic_if(httpd_nutups_cgi_script_t) + corenet_tcp_sendrecv_generic_node(httpd_nutups_cgi_script_t) + corenet_tcp_sendrecv_all_ports(httpd_nutups_cgi_script_t) corenet_tcp_connect_ups_port(httpd_nutups_cgi_script_t) + corenet_udp_sendrecv_generic_if(httpd_nutups_cgi_script_t) + corenet_udp_sendrecv_generic_node(httpd_nutups_cgi_script_t) + corenet_udp_sendrecv_all_ports(httpd_nutups_cgi_script_t) + + sysnet_dns_name_resolve(httpd_nutups_cgi_script_t)Quoted 9 lines
Quoted 2 lines
Ok this is a difference between apache interface in upstream and mine. I removed network access
set by those booleans from the interface tohttpd_sys_script_tspecific. I don't believe those interfaces should be effected by booleans. I don't want my bugzilla cgi to suddenly have network access just becausehttpd_sys_script_tneeds it.Yeah, I like this idea.
Quoted 20 lines
Quoted 7 lines
Is it really necessary to include the
dac_overridepermissions fornut_upsd_t? I thought that the upsd daemon runs as a non root user where nodac_overridepermissions are used.(quoted diff) +1
-1-allow nut_upsd_t self:capability { setgid setuid }; +allow nut_upsd_t self:capability { setgid setuid dac_override };Quoted 11 lines
If you still have the AVC message and maybe some information of the setup, then I would like to dig a bit deeper into this because I use nut and would like to make it more secure ;-) Maybe the capabilities can even be dropped.
Guess the sbin rules are not necessary for refpolicy:
+corecmd_exec_sbin(nut_upsdrvctl_t)
Oops that is a bug.
Quoted 6 lines
Quoted 2 lines
dac_overridecan come in because a file has bad ownership.upsd runs per default as user nut on Fedora and EPEL. It should never run as root.
Then why does the policy have setuid/setgid?
Quoted 61 lines · Daniel J Walsh
Quoted 60 lines · Stefan Schulze Frielinghaus
Quoted 26 lines · Daniel J Walsh
Quoted 24 lines · Stefan Schulze Frielinghaus
Quoted 5 lines · Daniel J Walsh
http://people.fedoraproject.org/~dwalsh/SELinux/F13/services_nut.patch
Latest nut policy.
The following rules are unnecessary because they are already included by the interface
apache_content_templateas soon as the booleanshttpd_enable_cgiandhttpd_can_network_connectare enabled:(quoted diff) +10
-0+ corenet_all_recvfrom_unlabeled(httpd_nutups_cgi_script_t) + corenet_all_recvfrom_netlabel(httpd_nutups_cgi_script_t) + corenet_tcp_sendrecv_generic_if(httpd_nutups_cgi_script_t) + corenet_tcp_sendrecv_generic_node(httpd_nutups_cgi_script_t) + corenet_tcp_sendrecv_all_ports(httpd_nutups_cgi_script_t) corenet_tcp_connect_ups_port(httpd_nutups_cgi_script_t) + corenet_udp_sendrecv_generic_if(httpd_nutups_cgi_script_t) + corenet_udp_sendrecv_generic_node(httpd_nutups_cgi_script_t) + corenet_udp_sendrecv_all_ports(httpd_nutups_cgi_script_t) + + sysnet_dns_name_resolve(httpd_nutups_cgi_script_t)Quoted 9 lines
Quoted 2 lines
Ok this is a difference between apache interface in upstream and mine. I removed network access
set by those booleans from the interface tohttpd_sys_script_tspecific. I don't believe those interfaces should be effected by booleans. I don't want my bugzilla cgi to suddenly have network access just becausehttpd_sys_script_tneeds it.Yeah, I like this idea.
Quoted 20 lines
Quoted 7 lines
Is it really necessary to include the
dac_overridepermissions fornut_upsd_t? I thought that the upsd daemon runs as a non root user where nodac_overridepermissions are used.(quoted diff) +1
-1-allow nut_upsd_t self:capability { setgid setuid }; +allow nut_upsd_t self:capability { setgid setuid dac_override };Quoted 11 lines
If you still have the AVC message and maybe some information of the setup, then I would like to dig a bit deeper into this because I use nut and would like to make it more secure ;-) Maybe the capabilities can even be dropped.
Guess the sbin rules are not necessary for refpolicy:
+corecmd_exec_sbin(nut_upsdrvctl_t)
Oops that is a bug.
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
dac_overridecan come in because a file has bad ownership.upsd runs per default as user nut on Fedora and EPEL. It should never run as root.
Then why does the policy have setuid/setgid?
OK, I wasn't precise enough. upsd is started as root in the first place and then it drops its privileges and runs as user nut. This is even setup by the package maintainer: configure --with-user=%{name} --with-group=
In the end it shouldn't hurt to allow dac_override because in most cases the daemon will/should drop its privileges right after startup. You can circumvent this by adding the option "-u root" for upsd. I was just wondering why this rules is needed. I guess the daemon was running as root in your case. I did a quick test with strace:
setgid(475) = 0
setuid(57) = 0chdir("/var/run/nut")
/var/run/nut is owned by nut:nut and has mode 750. If the daemon runs as root then it would need dac_override permissions (before dropping privileges upsd only binds to two ports [IPv4/v6] and loads of course some libraries).
Summarized it shouldn't hurt to allow dac_override because in the default case the daemon will drop its privileges which is recommended. I was just wondering because I haven't seen such a setup before.