RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1153333 - SELinux (still) prevents logrotate from reading /var/log/core directory
Summary: SELinux (still) prevents logrotate from reading /var/log/core directory
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: selinux-policy
Version: 6.6
Hardware: All
OS: Linux
high
medium
Target Milestone: rc
: ---
Assignee: Miroslav Grepl
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On: 1064326
Blocks: 1002699 1131460 1173188 1179805
TreeView+ depends on / blocked
 
Reported: 2014-10-15 19:21 UTC by Paul Stauffer
Modified: 2015-07-22 07:08 UTC (History)
13 users (show)

Fixed In Version: selinux-policy-3.7.19-261.el6
Doc Type: Bug Fix
Doc Text:
Clone Of: 1064326
: 1179805 (view as bug list)
Environment:
Last Closed: 2015-07-22 07:08:45 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1375 0 normal SHIPPED_LIVE selinux-policy bug fix and enhancement update 2015-07-20 18:07:47 UTC

Description Paul Stauffer 2014-10-15 19:21:34 UTC
+++ This bug was initially created as a clone of Bug #1064326 +++

The problem described in Bug #1064326 remains.

On any system with vdsm (currently 4.14.13-2.el6ev) installed and selinux enabled, the following still appears every hour in /var/log/messages:

setroubleshoot: SELinux is preventing /usr/sbin/logrotate from read access on the directory /var/log/core.

From /var/log/audit/audit.log:

type=AVC msg=audit(1413399661.335:7626): avc:  denied  { read } for  pid=4640 comm="logrotate" name="core" dev=dm-1 ino=919070 scontext=system_u:system_r:logrotate_t:s0-s0:c0.c1023 tcontext=system_u:object_r:virt_cache_t:s0 tclass=dir
type=SYSCALL msg=audit(1413399661.335:7626): arch=c000003e syscall=2 success=no exit=-13 a0=7fff20a390f0 a1=90800 a2=12128fe a3=fffffffffffffff0 items=0 ppid=4638 pid=4640 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=571 comm="logrotate" exe="/usr/sbin/logrotate" subj=system_u:system_r:logrotate_t:s0-s0:c0.c1023 key=(null)

According to Bug # 1064326, this was supposedly fixed in selinux-policy-3.7.19-260.el6, but as far as I can tell, nothing has changed.  Can someone please explain what the attempted solution was that was supposed to have been included in that release to close the previous bug?  Was the intention to allow logrotate read access on virt_cache_t?  Without an update to the vdsm package, the /var/log/core directory remains virt_cache_t.

Comment 2 Milos Malik 2014-10-15 19:43:23 UTC
Almost 8 months ago I filed 3 bugs related to this problem:
 * BZ#1066407
 * BZ#1064322
 * BZ#1064326

The problem is in the vdsm package, it brings own labeling pattern:

# rpm -q --scripts vdsm | grep semanage
    /usr/sbin/semanage fcontext -a -t virt_cache_t '/var/log/core(/.*)?'
#

Actual results:
 * /var/log/core directory is labeled incorrectly, which causes SELinux denials in enforcing mode, which means that core files in that directory are not processed by logrotate at all

Expected results:
 * do not call semanage at all, /var/log/core directory will be labeled correctly by selinux-policy

Currently, /var/log/core is labeled var_log_t, which allows the logrotate cron job to do what's necessary. Why does vdsm need to change the label on /var/log/core ?

Comment 3 Paul Stauffer 2014-10-15 19:52:56 UTC
Someone correct me if I'm wrong, but I believe that semanage hack was introduced by vdsm because otherwise libvirt cannot write to a var_log_t /var/log/core.  This was probably the wrong approach to take, and is certainly the source of the logrotate problem.

I'm guessing the proper solution is to create a new selinux type that can satisfy all of the needs here, which is why bug 1064326 and this one were filed against selinux-policy.  Not sure why 1064326 was marked fixed when the underlying problem remains, but perhaps someone can explain what solution if any was attempted.

Comment 4 Dan Kenigsberg 2014-10-22 13:29:30 UTC
Since more and more, rhev-3.5 is being deployed on top of rhel-7.0.z, I would ask to clone this bug and backport the fix.

Comment 5 Dan Kenigsberg 2014-10-22 13:54:02 UTC
Please ignore comment 4, it belongs to bug 1064322.

Comment 13 Miroslav Grepl 2014-12-19 10:42:13 UTC
commit 0d86f4d2c5ca4c88c8d39e038aceffa6a36ed89c
Author: Miroslav Grepl <mgrepl>
Date:   Fri Dec 19 11:39:11 2014 +0100

    Allow logrotate to manage virt_cache.

Comment 23 errata-xmlrpc 2015-07-22 07:08:45 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1375.html


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