Bug 471034 - Selinux prevents logrotate from running correctly
Selinux prevents logrotate from running correctly
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: logrotate (Show other bugs)
9
All Linux
medium Severity medium
: ---
: ---
Assigned To: Daniel Novotny
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-11-11 09:28 EST by Ivan Makfinsky
Modified: 2009-02-25 08:32 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-02-25 08:32:21 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ivan Makfinsky 2008-11-11 09:28:56 EST
Description of problem:
Selinux is preventing logrotate from accessing log files in /var/log/ and as a result logrotate reports are never generated.

Version-Release number of selected component (if applicable):
logrotate-3.7.6-5.fc9.i386
selinux-policy-3.3.1-103.fc9.noarch

How reproducible:
Every day, several times a day.

Steps to Reproduce:
1. Install logrotate. Install selinux-policy.
2. Hibernate/Suspend laptop.
3. Wake up laptop.
  
Actual results:
Selinux error message - 
Summary:

SELinux is preventing logrotate (logrotate_t) "getattr" to
/var/log/pm-suspend.log (hald_log_t).

Detailed Description:

SELinux denied access requested by logrotate. It is not expected that this
access is required by logrotate and this access may signal an intrusion attempt.
It is also possible that the specific version or configuration of the
application is causing it to require additional access.

Allowing Access:

Sometimes labeling problems can cause SELinux denials. You could try to restore
the default system file context for /var/log/pm-suspend.log,

restorecon -v '/var/log/pm-suspend.log'

If this does not work, there is currently no automatic way to allow this access.
Instead, you can generate a local policy module to allow this access - see FAQ
(http://fedora.redhat.com/docs/selinux-faq-fc5/#id2961385) Or you can disable
SELinux protection altogether. Disabling SELinux protection is not recommended.
Please file a bug report (http://bugzilla.redhat.com/bugzilla/enter_bug.cgi)
against this package.

Additional Information:

Source Context                system_u:system_r:logrotate_t:s0-s0:c0.c1023
Target Context                system_u:object_r:hald_log_t:s0
Target Objects                /var/log/pm-suspend.log [ file ]
Source                        logrotate
Source Path                   /usr/sbin/logrotate
Port                          <Unknown>
Host                          physical.priv.ovirt.org
Source RPM Packages           logrotate-3.7.6-5.fc9
Target RPM Packages           pm-utils-1.1.0-7.fc9
Policy RPM                    selinux-policy-3.3.1-103.fc9
Selinux Enabled               True
Policy Type                   targeted
MLS Enabled                   True
Enforcing Mode                Enforcing
Plugin Name                   catchall_file
Host Name                     physical.priv.ovirt.org
Platform                      Linux physical.priv.ovirt.org 2.6.26.6-79.fc9.i686
                              #1 SMP Fri Oct 17 14:52:14 EDT 2008 i686 i686
Alert Count                   24
First Seen                    Mon 10 Nov 2008 10:01:01 PM EST
Last Seen                     Tue 11 Nov 2008 08:01:01 AM EST
Local ID                      b9f79f1b-8c01-4741-aa5c-303b95587854
Line Numbers                  

Raw Audit Messages            

host=physical.priv.ovirt.org type=AVC msg=audit(1226408461.183:334): avc:  denied  { getattr } for  pid=16350 comm="logrotate" path="/var/log/pm-suspend.log" dev=dm-1 ino=85434 scontext=system_u:system_r:logrotate_t:s0-s0:c0.c1023 tcontext=system_u:object_r:hald_log_t:s0 tclass=file

host=physical.priv.ovirt.org type=SYSCALL msg=audit(1226408461.183:334): arch=40000003 syscall=195 success=no exit=-13 a0=88118f8 a1=bfbb9a90 a2=46eff4 a3=bfbb9a90 items=0 ppid=16348 pid=16350 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=26 comm="logrotate" exe="/usr/sbin/logrotate" subj=system_u:system_r:logrotate_t:s0-s0:c0.c1023 key=(null)




Expected results:
Logrotate report.

Additional info:
Comment 1 Daniel Novotny 2008-11-20 05:07:34 EST
what is the SElinux context of /var/log/pm-suspend.log ? ( ls -Z )

did you try the restorecons command? ( restorecons -v /var/log/pm-suspend.log )
Comment 2 Daniel Novotny 2009-02-25 08:32:21 EST
seems to be working OK now with newer selinux-policy.
if not, feel free to reopen the bug

Note You need to log in before you can comment on or make changes to this bug.