Bug 735307 - SELinux is preventing cat "read" access to /var/spool/bacula/log.
Summary: SELinux is preventing cat "read" access to /var/spool/bacula/log.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: selinux-policy
Version: 6.2
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Miroslav Grepl
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-02 09:20 UTC by Milos Malik
Modified: 2011-09-02 13:15 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-09-02 13:15:34 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Milos Malik 2011-09-02 09:20:13 UTC
Detailed Description:
SELinux denied access requested by cat. /var/spool/bacula/log may be a
mislabeled. /var/spool/bacula/log default SELinux type is var_log_t, but its
current type is var_spool_t. Changing this file back to the default type, may
fix your problem.

File contexts can be assigned to a file in the following ways.

  * Files created in a directory receive the file context of the parent
    directory by default.
  * The SELinux policy might override the default label inherited from the
    parent directory by specifying a process running in context A which creates
    a file in a directory labeled B will instead create the file with label C.
    An example of this would be the dhcp client running with the dhclient_t type
    and creating a file in the directory /etc. This file would normally receive
    the etc_t type due to parental inheritance but instead the file is labeled
    with the net_conf_t type because the SELinux policy specifies this.
  * Users can change the file context on a file using tools such as chcon, or
    restorecon.

This file could have been mislabeled either by user error, or if an normally
confined application was run under the wrong domain.

However, this might also indicate a bug in SELinux because the file should not
have been labeled with this type.

If you believe this is a bug, please file a bug report against this package.

Allowing Access:

You can restore the default system context to this file by executing the
restorecon command. restorecon '/var/spool/bacula/log', if this file is a
directory, you can recursively restore using restorecon -R
'/var/spool/bacula/log'.

Fix Command:

/sbin/restorecon '/var/spool/bacula/log'

Additional Information:

Source Context                system_u:system_r:logwatch_t:s0-s0:c0.c1023
Target Context                unconfined_u:object_r:var_spool_t:s0
Target Objects                /var/spool/bacula/log [ file ]
Source                        cat
Source Path                   cat
Port                          <Unknown>
Host                          <DELETED>
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.7.19-93.el6_1.7
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Plugin Name                   restorecon
Host Name                     <DELETED>
Platform                      Linux <DELETED>
                              2.6.32-131.12.1.el6.s390x #1 SMP Sun Jul 31
                              16:49:40 EDT 2011 s390x s390x
Alert Count                   3
First Seen                    Wed Aug 31 03:23:03 2011
Last Seen                     Fri Sep  2 03:31:04 2011
Local ID                      11b67c1a-08b7-49a6-80ab-ae964c6a2a58
Line Numbers                  

Raw Audit Messages:

node=<DELETED> type=AVC msg=audit(1314948664.221:71082): avc:  denied  { read } for  pid=37215 comm="cat" name="log" dev=md1 ino=3955388 scontext=system_u:system_r:logwatch_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:var_spool_t:s0 tclass=file

Comment 2 Daniel Walsh 2011-09-02 13:15:34 UTC
You have a mislabeled directory.

restorecon -R -v /var/spool/bacula

Should fix, at somepoint someone should fix bacula to put its log files where they belong under /var/log.


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