Bug 2109666 - nagios-selinux actually confines "unconfined" Nagios plugins
Summary: nagios-selinux actually confines "unconfined" Nagios plugins
Keywords:
Status: ASSIGNED
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: nagios
Version: epel9
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Guido Aulisi
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-07-21 18:29 UTC by Ben Webb
Modified: 2022-10-18 18:25 UTC (History)
11 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Ben Webb 2022-07-21 18:29:59 UTC
Description of problem:
The nagios-selinux package replaces the system nagios SELinux module with one
that appears to prohibit most common Nagios operations. "Unconfined" plugins
such as check_procs do not work at all without disabling SELinux.

I have a small reproducer below that uses NRPE rather than a full Nagios
install. Plugins work normally with the default selinux-policy-targeted, but
fail if nagios-selinux is installed.

Version-Release number of selected component (if applicable):
nagios-selinux-4.4.6-7.el9~bootstrap.noarch

How reproducible:
Always

Steps to Reproduce:
% dnf install nrpe nagios-plugins-procs nagios-plugins-nrpe
% systemctl start nrpe
% /usr/lib64/nagios/plugins/check_nrpe -H localhost -c check_total_procs
PROCS OK: 113 processes | procs=113;150;200;0;
% dnf install nagios-selinux
% /usr/lib64/nagios/plugins/check_nrpe -H localhost -c check_total_procs
Unable to read output
% grep avc /var/log/audit/audit.log |tail -1
type=AVC msg=audit(1658426463.166:127): avc:  denied  { execute } for  pid=1792 comm="check_procs" name="ps" dev="dm-0" ino=4330077 scontext=system_u:system_r:nagios_unconfined_plugin_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=0

Actual results:
nagios_unconfined_plugin_t plugins such as check_procs are denied by SELinux.

Expected results:
Plugins work without SELinux denials.

Additional info:
I see similar avc denials for virtually every plugin on my full Nagios server,
but these all go away and everything works normally (at least for me) if I
rpm -e --nodeps nagios-selinux

My Nagios install worked before with RHEL 8.6, but I notice the nagios
RPM didn't require nagios-selinux at that time (and I didn't have it installed).

Comment 1 static 2022-10-14 05:01:24 UTC
I was looking into what to upgrade centos7 to in the future for Nagios and I ran into this testing on 9 also.  The host check doesn't even work (check_ping).  I tried fixing all the AVC denials for it using setroubleshoot and the ausearch/semodule -i but pinging still didn't work unless I disable selinux completely.

Comment 2 static 2022-10-14 05:02:29 UTC
I meant setting selinux to permissive.  It didn't require disabling it with the kernel parameter to do that.


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