Bug 436416 - nut-cgi/upsstats.cgi selinux [error: socket failure: Permission denied]
Summary: nut-cgi/upsstats.cgi selinux [error: socket failure: Permission denied]
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: nut
Version: 8
Hardware: i386
OS: Linux
low
medium
Target Milestone: ---
Assignee: Michal Hlavinka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-03-07 00:54 UTC by R. Pao
Modified: 2009-01-09 06:07 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-01-09 06:07:18 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description R. Pao 2008-03-07 00:54:33 UTC
Description of problem:

Summary:

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

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 2.6.23.15-137.fc8 #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"
scontext=system_u:system_r:httpd_sys_script_t:s0
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"
exe="/var/www/nut-cgi-bin/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:
Consistent.

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 11:27:27 UTC
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 23:47:55 UTC
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 10:03:01 UTC
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: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 4 Bug Zapper 2009-01-09 06:07:18 UTC
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.