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 1758140

Summary: Aide unusable because of SELinux
Product: Red Hat Enterprise Linux 7 Reporter: Sandeep MJ <sjayapra>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED WONTFIX QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.7CC: benl, cww, dwalsh, fedora-bugreport, lvrabec, mmalik, plautrba, rsroka, ssekidde, vmojzis, zpytela
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1599382
: 1758265 (view as bug list) Environment:
Last Closed: 2019-12-09 14:19:43 UTC Type: ---
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: 1599382    
Bug Blocks:    

Description Sandeep MJ 2019-10-03 11:47:48 UTC
+++ This bug was initially created as a clone of Bug #1599382 +++

Description of problem:
SELinux is preventing aide from checking hundreds of files.

Version-Release number of selected component (if applicable):
1. selinux-policy-3.13.1-252.el7.1.noarch.rpm
2. aide-0.15.1-13.el7.x86_64


Steps to reproduce:

Set up cronjab:
05 4 * * 1-6 root /usr/sbin/aide --check --config=/etc/aide.conf


Below errors are seen:

lstat() failed for /dev/sdb1:Permission denied
lstat() failed for /dev/kcare:Permission denied
lstat() failed for /dev/vcsa6:Permission denied
lstat() failed for /dev/vcs6:Permission denied
lstat() failed for /dev/vcsa5:Permission denied
lstat() failed for /dev/vcs5:Permission denied
lstat() failed for /dev/vcsa4:Permission denied
...
.

Audit logs show:

----
time->Mon Sep 30 04:05:09 2019
type=PROCTITLE msg=audit(1569782109.484:4741293): proctitle=2F7573722F7362696E2F61696465002D2D636865636B002D2D636F6E6669673D2F6574632F616964652E636F6E66
type=PATH msg=audit(1569782109.484:4741293): item=0 name="/dev/vcsa6" inode=25882 dev=00:05 mode=020660 ouid=0 ogid=5 rdev=07:86 obj=system_u:object_r:tty_device_t:s0 objtype=NORMAL cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0
type=CWD msg=audit(1569782109.484:4741293):  cwd="/root"
type=SYSCALL msg=audit(1569782109.484:4741293): arch=c000003e syscall=6 success=no exit=-13 a0=55a2b35d95e0 a1=7ffcb8caf3c0 a2=7ffcb8caf3c0 a3=a items=1 ppid=15458 pid=15460 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=11743 comm="aide" exe="/usr/sbin/aide" subj=system_u:system_r:aide_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1569782109.484:4741293): avc:  denied  { getattr } for  pid=15460 comm="aide" path="/dev/vcsa6" dev="devtmpfs" ino=25882 scontext=system_u:system_r:aide_t:s0-s0:c0.c1023 tcontext=system_u:object_r:tty_device_t:s0 tclass=chr_file permissive=0
----
time->Mon Sep 30 04:05:09 2019
type=PROCTITLE msg=audit(1569782109.484:4741294): proctitle=2F7573722F7362696E2F61696465002D2D636865636B002D2D636F6E6669673D2F6574632F616964652E636F6E66
type=PATH msg=audit(1569782109.484:4741294): item=0 name="/dev/vcs6" inode=25880 dev=00:05 mode=020660 ouid=0 ogid=5 rdev=07:06 obj=system_u:object_r:tty_device_t:s0 objtype=NORMAL cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0
type=CWD msg=audit(1569782109.484:4741294):  cwd="/root"
type=SYSCALL msg=audit(1569782109.484:4741294): arch=c000003e syscall=6 success=no exit=-13 a0=55a2b3651c20 a1=7ffcb8caf3c0 a2=7ffcb8caf3c0 a3=9 items=1 ppid=15458 pid=15460 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=11743 comm="aide" exe="/usr/sbin/aide" subj=system_u:system_r:aide_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1569782109.484:4741294): avc:  denied  { getattr } for  pid=15460 comm="aide" path="/dev/vcs6" dev="devtmpfs" ino=25880 scontext=system_u:system_r:aide_t:s0-s0:c0.c1023 tcontext=system_u:object_r:tty_device_t:s0 tclass=chr_file permissive=0
----
time->Mon Sep 30 04:05:09 2019
type=PROCTITLE msg=audit(1569782109.484:4741295): proctitle=2F7573722F7362696E2F61696465002D2D636865636B002D2D636F6E6669673D2F6574632F616964652E636F6E66
type=PATH msg=audit(1569782109.484:4741295): item=0 name="/dev/vcsa5" inode=25879 dev=00:05 mode=020660 ouid=0 ogid=5 rdev=07:85 obj=system_u:object_r:tty_device_t:s0 objtype=NORMAL cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0
type=CWD msg=audit(1569782109.484:4741295):  cwd="/root"
type=SYSCALL msg=audit(1569782109.484:4741295): arch=c000003e syscall=6 success=no exit=-13 a0=55a2b35d7fb0 a1=7ffcb8caf3c0 a2=7ffcb8caf3c0 a3=a items=1 ppid=15458 pid=15460 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=11743 comm="aide" exe="/usr/sbin/aide" subj=system_u:system_r:aide_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1569782109.484:4741295): avc:  denied  { getattr } for  pid=15460 comm="aide" path="/dev/vcsa5" dev="devtmpfs" ino=25879 scontext=system_u:system_r:aide_t:s0-s0:c0.c1023 tcontext=system_u:object_r:tty_device_t:s0 tclass=chr_file permissive=0
----

Comment 2 Milos Malik 2019-10-03 16:11:28 UTC
If /etc/aide.conf is unchanged then the scenario triggers following SELinux denial:

----
type=PROCTITLE msg=audit(10/03/2019 12:08:03.340:840) : proctitle=/usr/sbin/aide --check --config=/etc/aide.conf 
type=SYSCALL msg=audit(10/03/2019 12:08:03.340:840) : arch=x86_64 syscall=lstat success=no exit=EACCES(Permission denied) a0=0x5579f6da6870 a1=0x7ffdb3fa60d0 a2=0x7ffdb3fa60d0 a3=0x17 items=0 ppid=12405 pid=12407 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=33 comm=aide exe=/usr/sbin/aide subj=system_u:system_r:aide_t:s0-s0:c0.c1023 key=(null) 
type=AVC msg=audit(10/03/2019 12:08:03.340:840) : avc:  denied  { getattr } for  pid=12407 comm=aide path=/etc/udev/rules.d/.null dev="vda1" ino=732146 scontext=system_u:system_r:aide_t:s0-s0:c0.c1023 tcontext=system_u:object_r:udev_rules_t:s0 tclass=chr_file permissive=0 
----

If /etc/aide.conf is modified in such a way that /dev/ is checked, then hundreds of SELinux denials are triggered.

Comment 3 Lukas Vrabec 2019-10-04 08:32:48 UTC
Radovan, 

Does it make sense that AIDE is checking also /dev ? 

Because aide is executed via cronjob, it's ends in aide_t SELinux domain and in aide policy it's not allowed to scan /dev. 

Thanks,
Lukas.

Comment 4 Radovan Sroka 2019-10-04 08:51:07 UTC
(In reply to Lukas Vrabec from comment #3)
> Radovan, 
> 
> Does it make sense that AIDE is checking also /dev ? 
> 
> Because aide is executed via cronjob, it's ends in aide_t SELinux domain and
> in aide policy it's not allowed to scan /dev. 
> 
> Thanks,
> Lukas.

If customer wants to scan /dev he should be definitely able to.
I think it's not that common to do that but there are attributes that
customer can scan and analyze also in device context.

Comment 6 Zdenek Pytela 2019-10-04 15:28:06 UTC
Sandeep,

Red Hat Enterprise Linux 7 is now in the Maintenance Support 1 phase of the product life cycle. Future minor releases will focus on retaining and improving stability and reliability rather than adding new features, so that qualified Critical and Important Security errata advisories (RHSAs) and Urgent Priority Bug Fix errata advisories (RHBAs) may be released as they become available.

Please describe the impact of this issue and provide justification so that the bug can be assesed.

See the Red Hat Enterprise Linux Life Cycle document for more details:
https://access.redhat.com/support/policy/updates/errata/#Maintenance_Support_1_Phase

Comment 12 Lukas Vrabec 2019-12-09 14:19:43 UTC
This issue was not selected to be included in Red Hat Enterprise Linux 7 because it is seen either as low or moderate impact to a small number of use-cases. Current minor release will be in Maintenance Support 1 Phase, which means that qualified Critical and Important Security errata advisories (RHSAs) and Urgent Priority Bug Fix errata advisories (RHBAs) may be released as they become available.

We will now close this issue, but if you believe that it qualifies for the Maintenance Support 1 Phase, please re-open; otherwise, we recommend moving the request to Red Hat Enterprise Linux 8 if applicable.