Bug 436416 - nut-cgi/upsstats.cgi selinux [error: socket failure: Permission denied]
nut-cgi/upsstats.cgi selinux [error: socket failure: Permission denied]
Product: Fedora
Classification: Fedora
Component: nut (Show other bugs)
i386 Linux
low Severity medium
: ---
: ---
Assigned To: Michal Hlavinka
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2008-03-06 19:54 EST by R. Pao
Modified: 2009-01-09 01:07 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-01-09 01:07:18 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description R. Pao 2008-03-06 19:54:33 EST
Description of problem:


SELinux is preventing upsstats.cgi (httpd_sys_script_t) "create" to <Unknown>

Detailed Description:

SELinux denied access requested by upsstats.cgi. It is not expected that this
access is required by upsstats.cgi and this access may signal an intrusion
attempt. It is also possible that the specific version or configuration of the
application is causing it to require additional access.

Allowing Access:

You can generate a local policy module to allow this access - see FAQ
(http://fedora.redhat.com/docs/selinux-faq-fc5/#id2961385) Or you can disable
SELinux protection altogether. Disabling SELinux protection is not recommended.
Please file a bug report (http://bugzilla.redhat.com/bugzilla/enter_bug.cgi)
against this package.

Additional Information:

Source Context                system_u:system_r:httpd_sys_script_t:s0
Target Context                system_u:system_r:httpd_sys_script_t:s0
Target Objects                None [ tcp_socket ]
Source                        upsstats.cgi
Source Path                   /var/www/nut-cgi-bin/upsstats.cgi
Port                          <Unknown>
Host                          x30.paonet.org
Source RPM Packages           nut-cgi-2.2.0-6.1.fc8
Target RPM Packages           
Policy RPM                    selinux-policy-3.0.8-87.fc8
Selinux Enabled               True
Policy Type                   targeted
MLS Enabled                   True
Enforcing Mode                Enforcing
Plugin Name                   catchall
Host Name                     x30.paonet.org
Platform                      Linux x30.paonet.org #1 SMP Sun
                              Feb 10 17:48:34 EST 2008 i686 i686
Alert Count                   2
First Seen                    Thu 06 Mar 2008 04:41:59 PM PST
Last Seen                     Thu 06 Mar 2008 04:41:59 PM PST
Local ID                      d1a5c6b9-d812-4d57-8109-458e33f7bbb2
Line Numbers                  

Raw Audit Messages            

host=x30.paonet.org type=AVC msg=audit(1204850519.685:33): avc:  denied  {
create } for  pid=3598 comm="upsstats.cgi"
tcontext=system_u:system_r:httpd_sys_script_t:s0 tclass=tcp_socket

host=x30.paonet.org type=SYSCALL msg=audit(1204850519.685:33): arch=40000003
syscall=102 success=no exit=-13 a0=1 a1=bfaaa620 a2=1167b0 a3=804e4c0 items=0
ppid=3590 pid=3598 auid=500 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48
sgid=48 fsgid=48 tty=(none) comm="upsstats.cgi"
subj=system_u:system_r:httpd_sys_script_t:s0 key=(null)

Version-Release number of selected component (if applicable):
Installed Packages
Name   : nut
Arch   : i386
Version: 2.2.0
Release: 6.1.fc8
Size   : 3.0 M
Repo   : installed
Summary: Network UPS Tools

How reproducible:

Steps to Reproduce:
1.  yum install nut-cgi
2.  Configure for APC SmartUPS 1000NET (apcsmart) although the exact UPS should
not matter.  /etc/init.d/ups start and /etc/init.d/httpd start must succeed.
3.  Firefox URL: http://localhost/nut-cgi-bin/upsstats.cgi (or where ever you
ended up installing the nut cgi binaries).
4.  You will see the error and a popup about selinux blocking access.
5.  echo 0 > /selinux/enforce and you can reload the cgi and it will work.
Actual results:
[error: socket failure: Permission denied]
and selinux AVC denial pop-up

Expected results:
SMART-UPS 1000 	ON BATTERY 	024.0 % 	000.0 	119.6 	000.0 % 	036.9 °C 	00:26:00

Additional info:
Comment 1 Tomas Smetana 2008-03-11 07:27:27 EDT
The upsstats.cgi uses sockets to connect via network to upsd daemons.  It is
supposed to create the socket.  I'd say the selinux-policy should be updated.
Comment 2 Daniel Walsh 2008-03-11 19:47:55 EDT
You should write policy for nut-cgi.

You can turn on the network boolean to allow cgi scripts to connect to the network.

setsebool -P httpd_can_network_connect=1

You can use system-config-selinux/polgengui to create a cgi policy.
Comment 3 Bug Zapper 2008-11-26 05:03:01 EST
This message is a reminder that Fedora 8 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 8.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '8'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 8's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 8 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
Comment 4 Bug Zapper 2009-01-09 01:07:18 EST
Fedora 8 changed to end-of-life (EOL) status on 2009-01-07. Fedora 8 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.