Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1804532

Summary: pcp-pmda-systemd throws selinux errors
Product: Red Hat Enterprise Linux 8 Reporter: Brian J. Atkisson <batkisso>
Component: pcpAssignee: Nathan Scott <nathans>
Status: CLOSED DUPLICATE QA Contact: Jan Kurik <jkurik>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.1CC: agerstmayr, jkurik, mgoodwin, nathans, patrickm
Target Milestone: rcKeywords: Bugfix, Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-21 00:22:22 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 Brian J. Atkisson 2020-02-19 04:19:10 UTC
Description of problem:
Using the pcp-pmda-systemd package for PCP results in SELinux errors:

Feb 18 23:07:49 dev1.example.com setroubleshoot[1258]: SELinux is preventing /var/lib/pcp/pmdas/systemd/pmdasystemd from map access on the file /run/log/journal/6cc143c826d44238b8f0a0061a00f223/system.journal. For complete SELinux messages run: sealert -l f72f5c52-ca19-4672-9f75-c891296cbba6
Feb 18 23:07:49 dev1.example.com platform-python[1258]: SELinux is preventing /var/lib/pcp/pmdas/systemd/pmdasystemd from map access on the file /run/log/journal/6cc143c826d44238b8f0a0061a00f223/system.journal.
                                                        
                                                        *****  Plugin catchall_boolean (89.3 confidence) suggests   ******************
                                                        
                                                        If you want to allow domain to can mmap files
                                                        Then you must tell SELinux about this by enabling the 'domain_can_mmap_files' boolean.
                                                        
                                                        Do
                                                        setsebool -P domain_can_mmap_files 1
                                                        
                                                        *****  Plugin catchall (11.6 confidence) suggests   **************************
                                                        
                                                        If you believe that pmdasystemd should be allowed map access on the system.journal file by default.
                                                        Then you should report this as a bug.
                                                        You can generate a local policy module to allow this access.
                                                        Do
                                                        allow this access for now by executing:
                                                        # ausearch -c 'pmdasystemd' --raw | audit2allow -M my-pmdasystemd
                                                        # semodule -X 300 -i my-pmdasystemd.pp



[root@dev1 ~]# sealert -l f72f5c52-ca19-4672-9f75-c891296cbba6
SELinux is preventing /var/lib/pcp/pmdas/systemd/pmdasystemd from map access on the file /run/log/journal/6cc143c826d44238b8f0a0061a00f223/system.journal.

*****  Plugin catchall_boolean (89.3 confidence) suggests   ******************

If you want to allow domain to can mmap files
Then you must tell SELinux about this by enabling the 'domain_can_mmap_files' boolean.

Do
setsebool -P domain_can_mmap_files 1

*****  Plugin catchall (11.6 confidence) suggests   **************************

If you believe that pmdasystemd should be allowed map access on the system.journal file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'pmdasystemd' --raw | audit2allow -M my-pmdasystemd
# semodule -X 300 -i my-pmdasystemd.pp


Additional Information:
Source Context                system_u:system_r:pcp_pmcd_t:s0
Target Context                system_u:object_r:syslogd_var_run_t:s0
Target Objects                /run/log/journal/6cc143c826d44238b8f0a0061a00f223/
                              system.journal [ file ]
Source                        pmdasystemd
Source Path                   /var/lib/pcp/pmdas/systemd/pmdasystemd
Port                          <Unknown>
Host                          dev1.example.com
Source RPM Packages           pcp-pmda-systemd-4.3.2-2.el8.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.14.3-20.el8.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     dev1.example.com
Platform                      Linux dev1.example.com 4.18.0-147.3.1.el8_1.x86_64
                              #1 SMP Wed Nov 27 01:11:44 UTC 2019 x86_64 x86_64
Alert Count                   2193644
First Seen                    2020-02-04 23:07:02 EST
Last Seen                     2020-02-18 23:13:03 EST
Local ID                      f72f5c52-ca19-4672-9f75-c891296cbba6

Raw Audit Messages
type=AVC msg=audit(1582085583.759:2243442): avc:  denied  { map } for  pid=1255 comm="pmdasystemd" path="/run/log/journal/6cc143c826d44238b8f0a0061a00f223/system.journal" dev="tmpfs" ino=210383596 scontext=system_u:system_r:pcp_pmcd_t:s0 tcontext=system_u:object_r:syslogd_var_run_t:s0 tclass=file permissive=0


type=SYSCALL msg=audit(1582085583.759:2243442): arch=x86_64 syscall=mmap success=no exit=EACCES a0=0 a1=800000 a2=1 a3=1 items=0 ppid=1235 pid=1255 auid=4294967295 uid=3 gid=4 euid=3 suid=3 fsuid=3 egid=4 sgid=4 fsgid=4 tty=(none) ses=4294967295 comm=pmdasystemd exe=/var/lib/pcp/pmdas/systemd/pmdasystemd subj=system_u:system_r:pcp_pmcd_t:s0 key=(null)

Hash: pmdasystemd,pcp_pmcd_t,syslogd_var_run_t,file,map




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

pcp-pmda-systemd-4.3.2-2.el8.x86_64

How reproducible:
Always

Steps to Reproduce:
1. yum install pcp-pmda-systemd
2. cd /var/lib/pcp/pmdas/systemd
3. ./Install 

Actual results:

SELinux errors

Comment 2 Nathan Scott 2020-04-21 00:22:22 UTC
As per Jan's note, this issue was resolved by changes in the PCP rebase in RHEL 8.2.

*** This bug has been marked as a duplicate of bug 1723598 ***