Bug 1173995

Summary: SElinux prevent log rotate of audit.log
Product: [Fedora] Fedora Reporter: Bill Davidsen <davidsen>
Component: logrotateAssignee: Jan Kaluža <jkaluza>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 21CC: jkaluza
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-12-15 06:58:14 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 Bill Davidsen 2014-12-14 17:41:44 UTC
Description of problem:
logrotate was prevented from rotating audit.log by a type or permissions problem.

Version-Release number of selected component (if applicable):
fc21-Live-MATE fully updates 0300EST 2014-12-13

How reproducible:
Until next Sunday, can't tell

Steps to Reproduce:
1. This is the first run of logrotate on a totally stock install
2.
3.

Actual results:
Log did not rotate

Expected results:
Log rotation

Additional info:
This is a reference install with zero custom or 3rd party software.
I use it to determine if local changes have in any way caused a problem.
I will preserve a copy of the raw audit log for one week

Problem report started:
  SELinux is preventing logrotate from read access on the directory /var/cache/dnf.

  *****  Plugin restorecon (94.8 confidence) suggests   ************************

  If you want to fix the label. 
  /var/cache/dnf default label should be rpm_var_cache_t.
  Then you can run restorecon.
  Do
  # /sbin/restorecon -v /var/cache/dnf

However, later it gave this advice:
If you believe that logrotate should be allowed read access on the dnf directory 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:
# grep logrotate /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:logrotate_t:s0-s0:c0.c1023
Target Context                unconfined_u:object_r:var_t:s0
Target Objects                /var/cache/dnf [ dir ]
Source                        logrotate
Source Path                   logrotate
Port                          <Unknown>
Host                          FC21-MATE-x86_64.tmr.com
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-99.fc21.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     FC21-MATE-x86_64.tmr.com
Platform                      Linux FC21-MATE-x86_64.tmr.com
                              3.17.6-300.fc21.x86_64 #1 SMP Mon Dec 8 22:29:32
                              UTC 2014 x86_64 x86_64
Alert Count                   1
First Seen                    2014-12-14 03:38:02 EST
Last Seen                     2014-12-14 03:38:02 EST
Local ID                      16d34d85-b757-4a7b-85c2-2b8923c6ea3e

Raw Audit Messages
type=AVC msg=audit(1418546282.263:562): avc:  denied  { read } for  pid=5038 comm="logrotate" name="dnf" dev="dm-0" ino=287063 scontext=system_u:system_r:logrotate_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:var_t:s0 tclass=dir permissive=0


Hash: logrotate,logrotate_t,var_t,dir,read

Comment 1 Jan Kaluža 2014-12-15 06:58:14 UTC

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