Bug 1985818
| Summary: | openmetrics scripting generates AVCs and no data with selinux enforcing | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Nathan Scott <nathans> |
| Component: | pcp | Assignee: | pcp-maint <pcp-maint> |
| Status: | CLOSED ERRATA | QA Contact: | Jan Kurik <jkurik> |
| Severity: | medium | Docs Contact: | Apurva Bhide <abhide> |
| Priority: | medium | ||
| Version: | 8.4 | CC: | agerstmayr, jkurik, nathans |
| Target Milestone: | beta | Keywords: | Bugfix, Triaged |
| Target Release: | 8.6 | Flags: | pm-rhel:
mirror+
|
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | pcp-5.3.3-1.el8 | Doc Type: | No Doc Update |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2022-05-10 13:30:52 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: | |||
| Bug Depends On: | |||
| Bug Blocks: | 1991763 | ||
Nathan, this does not seem to repro with a simple scripted config on rhel84, rhel85 nor f34. All with selinux=Enforcing. For both dynamic config and after a reboot. I tested with the load.sh scripted config example from pmdaopenmetrics(1) man page. No AVCs are generated but maybe I'm missing something ..? Can you please post more details on what the /etc/init.d/besclient script is doing and please include some detail of whatever the customer sent to you? Thanks Upstream for pcp-5.3.2. Document how to deal with Open Metrics PMDA scripted configs that trigger AVCs. There is no generic fix for this - we can't unilaterally grant an unconstrained execute policy to pmcd or it's children.
commit cdb75d802e08e7bc6560fbf41906c63498e9a5f6
Author: Mark Goodwin <mgoodwin>
Date: Tue Jul 27 14:23:49 2021 +1000
docs: add "SELinux Considerations" section to pmdaopenmetrics(1)
Scripted configs executed by pmdaopenmetrics are subject to
the prevailing pmcd SELinux context and policies. This is normally
fine for simple scripts such as /proc scrapers etc, but can result
in AVCs for more complex scripts. The new section includes details
on creating and loading local site-specific SELinux modules.
The 'SELinux CONSIDERATIONS' section is present and describes in details what needs to be done for OpenMetrics scripts to avoid SELinux's AVC records. Considering as verified. 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 (pcp 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-2022:1765 |
Customer (Nationwide UK) reports AVCs attempting to run scripted mode of OpenMetrics agent ... excepts from their (copious) notes: # tail -f /var/log/audit/audit.log | grep besclient type=AVC msg=audit(1627127856.524:1612): avc: denied { execute } for pid=9644 comm="bash" name="besclient" dev="dm-0" ino=8563925 scontext=system_u:system_r:pcp_pmcd_t:s0 tcontext=system_u:object_r:initrc_exec_t:s0 tclass=file permissive=1 type=AVC msg=audit(1627127856.524:1612): avc: denied { execute_no_trans } for pid=9644 comm="bash" path="/etc/rc.d/init.d/besclient" dev="dm-0" ino=8563925 scontext=system_u:system_r:pcp_pmcd_t:s0 tcontext=system_u:object_r:initrc_exec_t:s0 tclass=file permissive=1 type=SYSCALL msg=audit(1627127856.524:1612): arch=80000016 syscall=11 success=yes exit=0 a0=2aa1adfd510 a1=2aa1ae003e0 a2=2aa1adfdac0 a3=2aa1adfd690 items=3 ppid=9638 pid=9644 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="besclient" exe="/usr/bin/bash" subj=system_u:system_r:pcp_pmcd_t:s0 key=(null) type=EXECVE msg=audit(1627127856.524:1612): argc=3 a0="/bin/sh" a1="/etc/init.d/besclient" a2="status" type=PATH msg=audit(1627127856.524:1612): item=0 name="/etc/init.d/besclient" inode=8563925 dev=fd:00 mode=0100755 ouid=0 ogid=707 rdev=00:00 obj=system_u:object_r:initrc_exec_t:s0 nametype=NORMAL cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0 type=AVC msg=audit(1627127856.544:1613): avc: denied { read } for pid=9644 comm="besclient" name="lock" dev="dm-4" ino=158 scontext=system_u:system_r:pcp_pmcd_t:s0 tcontext=system_u:object_r:var_lock_t:s0 tclass=lnk_file permissive=1 type=SYSCALL msg=audit(1627127856.544:1613): arch=80000016 syscall=106 success=no exit=-2 a0=2aa47aa80d0 a1=3ffe1efcfb0 a2=3ffe1efcfb0 a3=2aa37903568 items=1 ppid=9638 pid=9644 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="besclient" exe="/usr/bin/bash" subj=system_u:system_r:pcp_pmcd_t:s0 key=(null) #--- audit2why suggests this type=AVC msg=audit(1627132487.084:1189): avc: denied { execute } for pid=7494 comm="bash" name="besclient" dev="dm-0" ino=8563925 scontext=system_u:system_r:pcp_pmcd_t:s0 tcontext=system_u:object_r:initrc_exec_t:s0 tclass=file permissive=0 Was caused by: Missing type enforcement (TE) allow rule. You can use audit2allow to generate a loadable module to allow this access.