Bug 1426824

Summary: Current selinux policy break nagios
Product: Red Hat Enterprise Linux 7 Reporter: M. Scherer <mscherer>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: ian, kenyon, lvrabec, meltingrobot, mgrepl, mmalik, plautrba, pvrabec, ssekidde
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.13.1-175.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 12:26:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description M. Scherer 2017-02-25 10:52:03 UTC
Description of problem:
So I did a reboot of our infra for the latest kernel problem, and found out that selinux did prevent nagios from working, with AVC like this:

type=AVC msg=audit(1488019552.522:990): avc:  denied  { read } for  pid=14353 comm="status.cgi" name="objects.cache" dev="xvda1" ino=918300 scontext=system_u:system_r:nagios_script_t:s0 tcontext=system_u:object_r:nagios_spool_t:s0 tclass=file
type=AVC msg=audit(1488019552.522:990): avc:  denied  { open } for  pid=14353 comm="status.cgi" path="/var/spool/nagios/objects.cache" dev="xvda1" ino=918300 scontext=system_u:system_r:nagios_script_t:s0 tcontext=system_u:object_r:nagios_spool_t:s0 tclass=file
type=AVC msg=audit(1488019552.522:991): avc:  denied  { getattr } for  pid=14353 comm="status.cgi" path="/var/spool/nagios/objects.cache" dev="xvda1" ino=918300 scontext=system_u:system_r:nagios_script_t:s0 tcontext=system_u:object_r:nagios_spool_t:s0 tclass=file

So adding this line would be helpful.

allow nagios_script_t nagios_spool_t:file { getattr open read };


Version-Release number of selected component (if applicable):
selinux-policy-3.13.1-102.el7_3.13.noarch

How reproducible:
each time

Steps to Reproduce:
1. install nagios (I have ansible playbook if needed)
2. connect on the web interface with selinux in enforcing


Actual results:
nagios say he can't read anything, and the web interface do not work. It show 1 page, but you can't see anything and can't interact, acknowledge alerts, etc. 

Expected results:
nagios work as expected.

Additional info:
nagios was upgraded in epel in version 4.2. 

maybe it would be useful to move selinux-contrib to EPEL in order to be able to get the policy in sync with the release of epel packages (rather than wait on RHEL release).

Comment 2 Ian Young 2017-02-27 11:09:49 UTC
Same issue. Perhaps worth adding that this seems to be because the upgrade moved some of the files around, thus giving them different labels:

# find / -name objects.cache -exec ls -lZ \{\} \;
-rw-r--r--. nagios nagios system_u:object_r:nagios_log_t:s0 /var/log/nagios/objects.cache
-rw-r--r--. nagios nagios system_u:object_r:nagios_spool_t:s0 /var/spool/nagios/objects.cache

Comment 10 errata-xmlrpc 2018-04-10 12:26:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0763