RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1815621 - SELinux policy prevents /usr/lib64/nagios/plugins/check_file_age from working via NRPE
Summary: SELinux policy prevents /usr/lib64/nagios/plugins/check_file_age from working...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: selinux-policy
Version: 8.1
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: 8.3
Assignee: Zdenek Pytela
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-03-20 18:30 UTC by James Ralston
Modified: 2020-11-04 01:57 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-04 01:56:06 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:4528 0 None None None 2020-11-04 01:56:32 UTC

Description James Ralston 2020-03-20 18:30:30 UTC
Description of problem:

Current SELinux policy prevents /usr/lib64/nagios/plugins/check_file_age from working in any way when called via NRPE.

In RHEL8, check_file_age is a perl script, and SELinux policy blocks perl from being able to execute it:

type=AVC msg=audit(1584727714.401:2456): avc:  denied  { execute } for  pid=25648 comm="check_file_age" path="/usr/bin/perl" dev="dm-0" ino=8986739 scontext=system_u:system_r:nagios_admin_plugin_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=1
type=AVC msg=audit(1584727714.401:2456): avc:  denied  { map } for  pid=25648 comm="check_file_age" path="/usr/bin/perl" dev="dm-0" ino=8986739 scontext=system_u:system_r:nagios_admin_plugin_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=1

Version-Release number of selected component (if applicable):

selinux-policy-targeted-3.14.3-20.el8.noarch

How reproducible:

Configure an NRPE check to call check_file_age via nrpe.

Comment 1 James Ralston 2020-03-20 18:52:29 UTC
We maintain a local SELinux policy module, and I can confirm that the following SELinux boolean, when enabled, resolves the issue:

## <desc>
##  <p>
##    Permit check_file_age to work.
##  </p>
##  <p>
##    See: https://bugzilla.redhat.com/show_bug.cgi?id=1815621
##  </p>
## </desc>

gen_tunable(local_nagios_uses_check_file_age, false)

gen_require(`
    type nagios_admin_plugin_t;
    type bin_t;
    class file { execute map };
')

tunable_policy(`local_nagios_uses_check_file_age',`
    allow nagios_admin_plugin_t bin_t:file { execute map };
')

Comment 2 Florian Apolloner 2020-03-30 10:03:49 UTC
The check_mailq plugin is affected by the same issue:

type=AVC msg=audit(1585562084.441:29236): avc:  denied  { map } for  pid=20025 comm="check_mailq" path="/usr/bin/perl" dev="dm-0" ino=789560 scontext=system_u:system_r:nagios_mail_plugin_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=1
type=AVC msg=audit(1585562084.441:29236): avc:  denied  { execute } for  pid=20025 comm="check_mailq" path="/usr/bin/perl" dev="dm-0" ino=789560 scontext=system_u:system_r:nagios_mail_plugin_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=1
type=SYSCALL msg=audit(1585562084.441:29236): arch=c000003e syscall=59 success=yes exit=0 a0=14aaf30 a1=14ab280 a2=14aaab0 a3=fffffffffffffa86 items=0 ppid=7568 pid=20025 auid=4294967295 uid=992 gid=989 euid=992 suid=992 fsuid=992 egid=989 sgid=989 fsgid=989 tty=(none) ses=4294967295 comm="check_mailq" exe="/usr/bin/perl" subj=system_u:system_r:nagios_mail_plugin_t:s0 key=(null)ARCH=x86_64 SYSCALL=execve AUID="unset" UID="icinga" GID="icinga" EUID="icinga" SUID="icinga" FSUID="icinga" EGID="icinga" SGID="icinga" FSGID="icinga"


In this case the type is `nagios_mail_plugin_t` and the above policy fixes this if I adjust the types accordingly. This might be needed for all perl plugins?

Comment 3 Zdenek Pytela 2020-03-30 12:29:10 UTC
Florian, James,

There is an attribute:

# seinfo -xanagios_plugin_domain

Type Attributes: 1
   attribute nagios_plugin_domain;
        nagios_admin_plugin_t
        nagios_checkdisk_plugin_t
        nagios_eventhandler_plugin_t
        nagios_mail_plugin_t
        nagios_openshift_plugin_t
        nagios_services_plugin_t
        nagios_system_plugin_t
        nagios_unconfined_plugin_t

 which can be used to allow a group of permissions to, in a similar manner to how permissions are allowed to domains.

Comment 5 Jonte Regnell 2020-06-08 11:55:32 UTC
RHEL 7 seems to have the same issues after 7.8 upgrade.

Comment 6 Zdenek Pytela 2020-06-08 13:09:11 UTC
Jonte,

FYI: A bz for RHEL 7 has been created, too, now in VERIFIED state:

bz#1824625

Comment 14 errata-xmlrpc 2020-11-04 01:56:06 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 (selinux-policy bug fix and enhancement update), 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-2020:4528


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