Bug 889151

Summary: SELinux prevents cron/logrotate from rotating nginx log files
Product: [Fedora] Fedora Reporter: Jamie Nguyen <jamielinux>
Component: selinux-policy-targetedAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED CURRENTRELEASE QA Contact: Ben Levenson <benl>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: dwalsh
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: 2013-02-11 04:56:13 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 Jamie Nguyen 2012-12-20 10:55:28 UTC
Logrotation of nginx log files in /var/log/nginx/*.log is prevented from executing properly by SELinux policy. Once the log files have been rotated, the nginx web server needs to be told to re-open the log files with SIGUSR1.



/etc/logrotate.d/nginx contains:

  postrotate
      /bin/systemctl kill --signal=SIGUSR1 nginx.service
  endscript



/var/log/audit/audit.log contains:
==========
type=USER_AVC msg=audit(1355990461.465:299): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  denied  { stop } for auid=0 uid=0 gid=0 path="/usr/lib/systemd/system/nginx.service" cmdline="/bin/systemctl kill --signal=SIGUSR1 nginx.service" scontext=system_u:system_r:logrotate_t:s0-s0:c0.c1023 tcontext=system_u:object_r:systemd_unit_file_t:s0 tclass=service  exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
==========



cronie-1.4.10-1
logrotate-3.8.2-1
nginx-1.2.6-3
selinux-policy-3.11.1-66.fc18

Comment 1 Jamie Nguyen 2012-12-20 10:57:17 UTC
Associated bug: https://bugzilla.redhat.com/show_bug.cgi?id=888225

Also, as far as I can see, this does not affect Fedora 17.

Comment 2 Fedora Update System 2013-02-05 07:45:21 UTC
nginx-1.2.6-6.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/nginx-1.2.6-6.fc18

Comment 3 Fedora Update System 2013-02-05 09:24:36 UTC
selinux-policy-3.11.1-76.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/selinux-policy-3.11.1-76.fc18

Comment 4 Fedora Update System 2013-02-08 02:37:06 UTC
Package selinux-policy-3.11.1-76.fc18:
* should fix your issue,
* was pushed to the Fedora 18 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.11.1-76.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-2101/selinux-policy-3.11.1-76.fc18
then log in and leave karma (feedback).

Comment 5 Fedora Update System 2013-02-11 04:56:15 UTC
selinux-policy-3.11.1-76.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 6 Fedora Update System 2013-02-16 01:22:21 UTC
nginx-1.2.6-6.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.