Bug 800615 - SELinux is preventing /usr/sbin/logrotate from 'write' accesses on the ficheiro /usr/local/groundwork/apache2/logs/access_log.
SELinux is preventing /usr/sbin/logrotate from 'write' accesses on the fichei...
Product: Fedora
Classification: Fedora
Component: selinux-policy (Show other bugs)
x86_64 Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Miroslav Grepl
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2012-03-06 14:26 EST by HUGO LOPES
Modified: 2012-03-06 14:30 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-03-06 14:30:03 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description HUGO LOPES 2012-03-06 14:26:18 EST
libreport version: 2.0.8
executable:     /usr/bin/python
hashmarkername: setroubleshoot
kernel:         3.2.7-1.fc16.x86_64
reason:         SELinux is preventing /usr/sbin/logrotate from 'write' accesses on the ficheiro /usr/local/groundwork/apache2/logs/access_log.
time:           Ter 06 Mar 2012 19:25:49 WET

:SELinux is preventing /usr/sbin/logrotate from 'write' accesses on the ficheiro /usr/local/groundwork/apache2/logs/access_log.
:*****  Plugin catchall_labels (83.8 confidence) suggests  ********************
:If quer permitir logrotate para ter acesso write sobre o access_log file
:Then you need to change the label on /usr/local/groundwork/apache2/logs/access_log
:# semanage fcontext -a -t FILE_TYPE '/usr/local/groundwork/apache2/logs/access_log'
:where FILE_TYPE is one of the following: varnishlog_log_t, wtmp_t, logrotate_var_lib_t, logrotate_tmp_t, logfile, named_cache_t, acct_data_t, var_spool_t, logrotate_lock_t, abrt_var_cache_t, afs_cache_t, logrotate_t, mailman_log_t. 
:Then execute: 
:restorecon -v '/usr/local/groundwork/apache2/logs/access_log'
:*****  Plugin catchall (17.1 confidence) suggests  ***************************
:If you believe that logrotate should be allowed write access on the access_log file by default.
:Then you should report this as a bug.
:You can generate a local policy module to allow this access.
: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:usr_t:s0
:Target Objects                /usr/local/groundwork/apache2/logs/access_log [
:                              file ]
:Source                        logrotate
:Source Path                   /usr/sbin/logrotate
:Port                          <Desconhecida>
:Host                          (removed)
:Source RPM Packages           logrotate-3.8.0-3.fc16.x86_64
:Target RPM Packages           
:Policy RPM                    selinux-policy-3.10.0-75.fc16.noarch
:Selinux Enabled               True
:Policy Type                   targeted
:Enforcing Mode                Enforcing
:Host Name                     (removed)
:Platform                      Linux (removed) 3.2.7-1.fc16.x86_64 #1 SMP Tue Feb
:                              21 01:40:47 UTC 2012 x86_64 x86_64
:Alert Count                   1
:First Seen                    Ter 06 Mar 2012 19:09:02 WET
:Last Seen                     Ter 06 Mar 2012 19:09:02 WET
:Local ID                      e7bf5e5f-c1fa-4893-9c9e-a1cc2efd7df2
:Raw Audit Messages
:type=AVC msg=audit(1331060942.789:173): avc:  denied  { write } for  pid=4811 comm="logrotate" name="access_log" dev=sda6 ino=106956 scontext=system_u:system_r:logrotate_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:usr_t:s0 tclass=file
:type=SYSCALL msg=audit(1331060942.789:173): arch=x86_64 syscall=open success=no exit=EACCES a0=18b1fc0 a1=2 a2=18c0910 a3=ffffffffffffc414 items=0 ppid=4809 pid=4811 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=10 comm=logrotate exe=/usr/sbin/logrotate subj=system_u:system_r:logrotate_t:s0-s0:c0.c1023 key=(null)
:Hash: logrotate,logrotate_t,usr_t,file,write
:#============= logrotate_t ==============
:allow logrotate_t usr_t:file write;
:audit2allow -R
:#============= logrotate_t ==============
:allow logrotate_t usr_t:file write;
Comment 1 Daniel Walsh 2012-03-06 14:30:03 EST
I take it that these are log files for apache.

# semanage fcontext -a -t httpd_log_t '/usr/local/groundwork/apache2/logs(/.*)?'
# restorecon -R -v /usr/local

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