Bug 539707

Summary: SELinux is preventing /usr/lib64/nagios/plugins/check_disk "getattr" access on /dev/sdb1.
Product: [Fedora] Fedora Reporter: Mike Hanby <flakrat>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 12CC: dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:cfccaacf9e094c28f6872281dd83b8a15a8fe74711bfb98b5e8e1a25c8b3bc96
Fixed In Version: 3.6.32-49.fc12 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-12-01 16:40:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mike Hanby 2009-11-20 21:00:03 UTC
Summary:

SELinux is preventing /usr/lib64/nagios/plugins/check_disk "getattr" access on
/dev/sdb1.

Detailed Description:

[check_disk has a permissive type (nrpe_t). This access was not denied.]

SELinux denied access requested by check_disk. It is not expected that this
access is required by check_disk 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) Please file a bug
report.

Additional Information:

Source Context                system_u:system_r:nrpe_t:s0
Target Context                system_u:object_r:fixed_disk_device_t:s0
Target Objects                /dev/sdb1 [ blk_file ]
Source                        check_disk
Source Path                   /usr/lib64/nagios/plugins/check_disk
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           nagios-plugins-disk-1.4.13-17.fc12
Target RPM Packages           
Policy RPM                    selinux-policy-3.6.32-41.fc12
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Plugin Name                   catchall
Host Name                     (removed)
Platform                      Linux (removed)
                              2.6.31.5-127.fc12.x86_64 #1 SMP Sat Nov 7 21:11:14
                              EST 2009 x86_64 x86_64
Alert Count                   2
First Seen                    Fri 20 Nov 2009 02:55:00 PM CST
Last Seen                     Fri 20 Nov 2009 02:56:19 PM CST
Local ID                      4c837a01-5371-4ba2-9f4c-8091717d3ef9
Line Numbers                  

Raw Audit Messages            

node=(removed) type=AVC msg=audit(1258750579.618:30744): avc:  denied  { getattr } for  pid=23360 comm="check_disk" path="/dev/sdb1" dev=tmpfs ino=3658 scontext=system_u:system_r:nrpe_t:s0 tcontext=system_u:object_r:fixed_disk_device_t:s0 tclass=blk_file

node=(removed) type=SYSCALL msg=audit(1258750579.618:30744): arch=c000003e syscall=4 success=yes exit=128 a0=7fff28fa7e9f a1=f07090 a2=f07090 a3=8 items=0 ppid=23359 pid=23360 auid=4294967295 uid=488 gid=471 euid=488 suid=488 fsuid=488 egid=471 sgid=471 fsgid=471 tty=(none) ses=4294967295 comm="check_disk" exe="/usr/lib64/nagios/plugins/check_disk" subj=system_u:system_r:nrpe_t:s0 key=(null)



Hash String generated from  selinux-policy-3.6.32-41.fc12,catchall,check_disk,nrpe_t,fixed_disk_device_t,blk_file,getattr
audit2allow suggests:

#============= nrpe_t ==============
allow nrpe_t fixed_disk_device_t:blk_file getattr;

Comment 1 Mike Hanby 2009-11-20 21:35:37 UTC
This is using the Nagios plugin from the official Fedora 12 repo:
nagios-plugins-disk-1.4.13-17.fc12.x86_64

The plugin works with SELinux in permissive mode, as you might expect.

Comment 2 Mike Hanby 2009-11-20 21:37:14 UTC
Some additional rpm versions that might be helpful:

nrpe-2.12-11.fc12.x86_64
selinux-policy-targeted-3.6.32-41.fc12.noarch
selinux-policy-3.6.32-41.fc12.noarch

Comment 3 Daniel Walsh 2009-11-20 21:39:34 UTC
You can add these rules for now using

# grep avc /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp



You can add this for now.

Miroslav can you write up a policy for the 
check_disk plugins for nagios to allow them to read fixed disk.  I really do not want to give this access to all plugins.

Comment 4 Mike Hanby 2009-11-20 23:18:18 UTC
Thanks, yeah I think adding that to all plugins would be overkill.

As an example, I'm also using check_procs plugin on this workstation and it works fine within the selinux policy.

Comment 5 Miroslav Grepl 2009-11-23 13:44:29 UTC
Dan,

I have sent you a patch.

Comment 6 Daniel Walsh 2009-11-23 19:24:16 UTC
Fixed in selinux-policy-3.6.32-48.fc12.noarch

Comment 7 Mike Hanby 2009-11-23 21:09:24 UTC
Thanks, I'll post back once I install the updated package.

I haven't run the manual audit2allow or semodule commands on the affected system, so it should be a good test.

Comment 8 Fedora Update System 2009-11-23 23:38:25 UTC
selinux-policy-3.6.32-49.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/selinux-policy-3.6.32-49.fc12

Comment 9 Fedora Update System 2009-11-25 15:21:31 UTC
selinux-policy-3.6.32-49.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update selinux-policy'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2009-12131

Comment 10 Fedora Update System 2009-12-02 04:32:55 UTC
selinux-policy-3.6.32-49.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 Mike Hanby 2009-12-02 20:11:08 UTC
Sorry, I forgot to update this ticket, selinux-policy-3.6.32-49.fc12 resolved the problem on my system.