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 1649077

Summary: SELinux is preventing /usr/lib64/sa/sadc from getattr access on the directory /var/log/audit
Product: Red Hat Enterprise Linux 7 Reporter: James Ralston <ralston>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED DUPLICATE QA Contact: Milos Malik <mmalik>
Severity: high Docs Contact:
Priority: high    
Version: 7.6CC: lvrabec, mgrepl, mmalik, plautrba, ralston, ssekidde, vmojzis, zpytela
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-03-06 17:35:12 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 James Ralston 2018-11-12 21:20:05 UTC
Description of problem:

After updating from RHEL7.5 to RHEL7.6, we now receive these SELinux denials whenever the /etc/cron.d/sysstat cron job attempts to run /usr/lib64/sa/sa1:

time->Mon Nov 12 16:00:01 2018
type=PROCTITLE msg=audit(1542056401.813:5173): proctitle=2F7573722F6C696236342F73612F73616463002D46002D4C002D53004449534B00310031002D
type=PATH msg=audit(1542056401.813:5173): item=0 name="/var/log/audit" inode=192 dev=fd:03 mode=040700 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:auditd_log_t:s0 objtype=NORMAL cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0
type=CWD msg=audit(1542056401.813:5173):  cwd="/usr/lib64/sa"
type=SYSCALL msg=audit(1542056401.813:5173): arch=c000003e syscall=4 success=no exit=-13 a0=7fffeab20350 a1=7fffeab201a0 a2=7fffeab201a0 a3=0 items=1 ppid=26858 pid=26862 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=49 comm="sadc" exe="/usr/lib64/sa/sadc" subj=system_u:system_r:sysstat_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1542056401.813:5173): avc:  denied  { getattr } for  pid=26862 comm="sadc" path="/var/log/audit" dev="dm-3" ino=192 scontext=system_u:system_r:sysstat_t:s0-s0:c0.c1023 tcontext=system_u:object_r:auditd_log_t:s0 tclass=dir permissive=0

Just to be sure, I performed a complete relabel of all filesystems, but I still receive these avc denials.

I'm not sure what is at fault here: should sadc not be attempting to touch the /var/log/audit directory, or should SELInux policy not block its attempts to do so? Why would sadc be wanting to touch anything but the files in /var/log/sa, anyway?

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

Source Context                system_u:system_r:sysstat_t:s0-s0:c0.c1023
Target Context                system_u:object_r:auditd_log_t:s0
Target Objects                /var/log/audit [ dir ]
Source                        sadc
Source Path                   /usr/lib64/sa/sadc
Port                          <Unknown>
Source RPM Packages           sysstat-10.1.5-17.el7.x86_64
Target RPM Packages           audit-2.8.4-4.el7.x86_64
Policy RPM                    selinux-policy-3.13.1-229.el7_6.5.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Platform                      Linux hostname.example.org 3.10.0-957.el7.x86_64
                              #1 SMP Thu Oct 4 20:48:51 UTC 2018 x86_64 x86_64
Alert Count                   4
First Seen                    2018-11-12 15:30:01 EST
Last Seen                     2018-11-12 16:00:01 EST

How reproducible:

Install sysstat.

Steps to Reproduce:
1. Install sysstat.
2. ???
3. Profit!

Actual results:

The above avc denial message is generated when the /etc/cron.d/sysstat cron job runs /usr/lib64/sa/sa1.

Expected results:

No avc messages should be generated when the /etc/cron.d/sysstat cron job runs /usr/lib64/sa/sa1.

Additional info:

The /usr/lib64/sa/sa1 job correctly logs statistics to /var/log/sa despite the avc denial.

Therefore, if it's the case that sadc shouldn't be touching /var/log/audit in any way, this would suggest that although the best course of action is to correct the sysstat package to not touch /var/log/audit, in the meantime, slapping a dontaudit rule on these failures would quiet the noise without breaking sysstat.

Comment 2 Milos Malik 2018-11-13 09:02:21 UTC
I believe this bug is a duplicate of BZ#1637416.

Comment 3 James Ralston 2018-11-14 18:09:47 UTC
Confirmed: I only see the denials if /var/log/audit is a separate filesystem. So the root problem here is the same problem as for BZ#1637416.

Feel free to close as a duplicate of BZ#1637416.

Comment 4 Zdenek Pytela 2019-03-06 17:35:12 UTC
James,

Thank you for the confirmation, hence closing as duplicate of #1637416 which currently is in the ON_QA status.

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