Bug 984613

Summary: aide generates AVC denials writing to /var/log/aide/aide.log when executed from a cron job
Product: [Fedora] Fedora Reporter: John F Sullivan <jsullivan3>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: dkopecek, dominick.grift, dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.12.1-66.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-26 23:05:10 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 John F Sullivan 2013-07-15 14:38:31 UTC
Description of problem:
When run as part of a cron job, AIDE generates AVC denials when attempting to write to /var/log/aide/aide.log.


Version-Release number of selected component (if applicable):
aide-0.15.1-5.fc19.x86_64
selinux-policy-3.12.1-63.fc19.noarch
selinux-policy-targeted-3.12.1-63.fc19.noarch


How reproducible:
Every time "aide" is updated as a cron job in /etc/cron.(hourly|daily|weekly|monthly).


Steps to Reproduce:
1. Create a file in /etc/cron.daily that executes "/usr/sbin/aide --update 2>&1"
2. Check /var/log/audit/audit.log for instances of AVC denials from aide
3. Check email from cron with AIDE report indicating that /var/log/aide/aide.txt cannot be written.


Actual results:
audit2why provides the following explanations:

type=AVC msg=audit(1373873583.328:998): avc:  denied  { write } for  pid=27218 comm="aide" name="aide.log" dev="dm-1" ino=55076 scontext=system_u:system_r:aide_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:aide_log_t:s0 tclass=file

        Was caused by:
                Missing type enforcement (TE) allow rule.

                You can use audit2allow to generate a loadable module to allow this access.

type=AVC msg=audit(1373874830.911:999): avc:  denied  { sys_admin } for  pid=27218 comm="aide" capability=21  scontext=system_u:system_r:aide_t:s0-s0:c0.c1023 tcontext=system_u:system_r:aide_t:s0-s0:c0.c1023 tclass=capability

        Was caused by:
                Missing type enforcement (TE) allow rule.

                You can use audit2allow to generate a loadable module to allow this access.


Expected results:
o No AVC denials
o AIDE is able to write to /var/log/aide/aide.log


Additional info:
Issue is resolved by implementing the following policy change:

module local 1.0;

require {
        type aide_t;
        type aide_log_t;
        class capability sys_admin;
        class file write;
}

#============= aide_t ==============
allow aide_t aide_log_t:file write;
allow aide_t self:capability sys_admin;

Comment 1 Daniel Kopeček 2013-07-18 11:00:44 UTC
Switching to selinux-policy for now. Changes might be needed in both aide and selinux-policy.

Comment 2 Daniel Walsh 2013-07-18 15:19:13 UTC
I have no problem allowing the write although I would like to know why it needs sys_admin, 

6e47d17e32e671c1ef051dcb5fdfabb53a3526ca allows this in git.

Comment 3 Fedora Update System 2013-07-24 14:10:00 UTC
selinux-policy-3.12.1-66.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/selinux-policy-3.12.1-66.fc19

Comment 4 Fedora Update System 2013-07-25 00:34:19 UTC
Package selinux-policy-3.12.1-66.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.12.1-66.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-13543/selinux-policy-3.12.1-66.fc19
then log in and leave karma (feedback).

Comment 5 Fedora Update System 2013-07-26 23:05:10 UTC
selinux-policy-3.12.1-66.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.