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 977415 - AVC denials when using openvswitch logrotate
Summary: AVC denials when using openvswitch logrotate
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: selinux-policy
Version: 6.5
Hardware: All
OS: Linux
urgent
urgent
Target Milestone: rc
: 6.5
Assignee: Miroslav Grepl
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks: 977477
TreeView+ depends on / blocked
 
Reported: 2013-06-24 13:49 UTC by Ofer Blaut
Modified: 2013-11-21 10:31 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Previously, the logrotate daemon rotated logs and tried to update the process ID (PID) in the "/var/run/openvswitch/ovs-vswitchd.pid" configuration, which caused AVC denials. Usually, the logrotate script sends a SIGHUP to a daemon to order it to reopen log files after they were rotated. This update revises the openvswitch policy, and AVC denials no longer occur in the described scenario.
Clone Of:
Environment:
Last Closed: 2013-11-21 10:31:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1598 0 normal SHIPPED_LIVE selinux-policy bug fix and enhancement update 2013-11-20 21:39:24 UTC

Description Ofer Blaut 2013-06-24 13:49:00 UTC
Created attachment 764629 [details]
Logs from bug 976000

Description of problem:

I just encountered new AVC on one of my compute nodes
openstack-selinux-0.1.2-10.el6ost.noarch
selinux-policy-3.7.19-195.el6_4.11.noarch
selinux-policy-targeted-3.7.19-195.el6_4.11.noarch

Jun 23 03:14:01 puma40 kernel: type=1400 audit(1371946441.174:4): avc:  denied  { write } for  pid=20391 comm="ovs-appctl" name="ovs-vswitchd.pid" dev=dm-0 ino=3801130 scontext=system_u:system_r:logrotate_t:s0-s0:c0.c1023 tcontext=system_u:object_r:var_run_t:s0 tclass=file
 Jun 23 03:14:01 puma40 ovs-appctl: 00001|daemon|WARN|/var/run/openvswitch/ovs-vswitchd.pid: open: Permission denied
 Jun 23 03:14:01 puma40 ovs-appctl: 00001|daemon|WARN|/var/run/openvswitch/ovsdb-server.pid: open: Permission denied
 Jun 23 03:14:01 puma40 kernel: type=1400 audit(1371946441.176:5): avc:  denied  { write } for  pid=20392 comm="ovs-appctl" name="ovsdb-server.pid" dev=dm-0 ino=3801127 scontext=system_u:system_r:logrotate_t:s0-s0:c0.c1023 tcontext=system_u:object_r:var_run_t:s0 tclass=file

Looks like logrotate daemon rotated logs and tried to update PID
in /var/run/openvswitch/ovs-vswitchd.pid which was denied.
Usually the logrotate script sends a SIGHUP to a deamon to order him to
reopen log files after they were rotated. But that probably won't change
the PID and also the scontext would be different. The other option is
that the service was restarted (insted of sending HUP) but that is not
very common for __bigger__ daemons I think. Check the logrotate script
(/etc/logrotate.d/...) to see what actually happens once the logs reach
the size limit.


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. run openstack setup for few days ( or operate openvswitch log rotate)
2. check AVC on /var/log/messages compute nodes
3.

Actual results:


Expected results:


Additional info:

Comment 1 Miroslav Grepl 2013-06-24 13:58:28 UTC
Fixed in selinux-policy-3.7.19-206.el6

Comment 5 Ofer Blaut 2013-06-25 16:00:15 UTC
Hi

I have tried to reproduce with Milos help 

edit crontab -e with 
* * * * * logrotate -f /etc/logrotate.d/openvswitch
* * * * * logrotate -f /etc/logrotate.d/openstack-quantum

Didn't see any AVC

Ofer

Comment 6 Ofer Blaut 2013-06-26 09:07:02 UTC
Issue is reproduced thanks to Milos

Steps:

## modify following lines in /etc/anacrontab
RANDOM_DELAY=1
1       1       cron.daily              nice run-parts /etc/cron.daily
service auditd stop
rm -f /var/log/audit/audit.log
service auditd start
rm -f /var/log/openvswitch/*
service openvswitch restart
rm -f /var/spool/anacron/cron.daily
killall anacron
## modify following lines in /var/lib/logrotate.status
/var/log/openvswitch/ovsdb-server.log" 2013-6-06
/var/log/openvswitch/ovs-vswitchd.log" 2013-6-06

date 06260300
tail -f /var/log/cron
(wait 2 minutes)
ausearch -m avc -m selinux_err -i

Comment 9 errata-xmlrpc 2013-11-21 10:31:42 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.

http://rhn.redhat.com/errata/RHBA-2013-1598.html


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