Bug 1405479 - SELinux blocks OVS to run 'hostname'
Summary: SELinux blocks OVS to run 'hostname'
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.3
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Lukas Vrabec
QA Contact: Milos Malik
Mirek Jahoda
URL:
Whiteboard:
Depends On:
Blocks: 1430750 1430751
TreeView+ depends on / blocked
 
Reported: 2016-12-16 15:36 UTC by Rick Alongi
Modified: 2017-08-01 15:20 UTC (History)
18 users (show)

Fixed In Version: selinux-policy-3.13.1-127.el7
Doc Type: Bug Fix
Doc Text:
Prior to this update, an SELinux rule for Open vSwitch (OVS) was missing. As a consequence, during boot time, while running SELinux in enforcing mode, the ovs-ctl script was not allowed to run the hostname and ip commands. The missing policy rule has been added, and OVS is now able to configure itself properly during boot time.
Clone Of:
: 1430750 1430751 (view as bug list)
Environment:
Last Closed: 2017-08-01 15:20:12 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:1861 0 normal SHIPPED_LIVE selinux-policy bug fix update 2017-08-01 17:50:24 UTC

Description Rick Alongi 2016-12-16 15:36:37 UTC
Description of problem:

SELinux AVC denial messages are asserting at certain points during automated regression test runs against openvswitch FDB 2.6.1.2 with RHEL 7.3 GA.  No such messages are observed when running the same automated tests against openvswitch FDP 2.5.0.22 and RHEL 7.3 GA.

Snippet from log containing AVC denial message:

type=AVC msg=audit(1481891854.635:110): avc:  denied  { getattr } for  pid=17949 comm="ovs-ctl" path="/usr/bin/hostname" dev="dm-0" ino=25939 scontext=system_u:system_r:openvswitch_t:s0 tcontext=system_u:object_r:hostname_exec_t:s0 tclass=file

This appears to be the same issue tracked in https://bugzilla.redhat.com/show_bug.cgi?id=1360465 which is against Fedora 23.  I'm logging this against RHEL 7.3 since I did not find an existing BZ for RHEL.

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

RHEL 7.3 GA
kernel: 3.10.0-514.el7.x86_64
OVS: openvswitch-2.6.1-2.git20161206.el7fdb.x86_64

How reproducible:
100% 

How reproducible:
Always

Steps to Reproduce:
1. Make sure SELinux is enabled
2. Enable openvswitch service
3. Boot

Actual results:
During boot time, the SELinux will block ovs-ctl to run 'hostname' and the AVC message referenced above will assert in /var/log/audit/audit.log.

BZ1360465 states that doing a force-reload-kmod will trigger the other two AVCs referenced in that BZ.  I executed "/usr/share/openvswitch/scripts/ovs-ctl force-reload-kmod" but did not see the resulting other two AVC messages.

Expected results:
No AVC denials should assert.


Additional info:

Comment 2 Milos Malik 2016-12-19 10:00:49 UTC
Could you switch the openvswitch_t domain to permissive mode before re-running the scenario and collect all SELinux denials?

# semanage permissive -a openvswitch_t
... re-run your scenario ...
# ausearch -m avc -m user_avc -m selinux_err -m user_selinux_err -i -ts today

Comment 4 Giuseppe Scrivano 2017-02-23 10:35:53 UTC
*** Bug 1420636 has been marked as a duplicate of this bug. ***

Comment 5 Giuseppe Scrivano 2017-02-23 10:50:53 UTC
More information on this issue:

https://bugzilla.redhat.com/show_bug.cgi?id=1420636

It is currently blocking OpenShift when openvswitch 2.5 or 2.6 is used.

Comment 12 Milos Malik 2017-03-02 20:58:43 UTC
# rpm -qa selinux-policy\*
selinux-policy-targeted-3.13.1-124.el7.noarch
selinux-policy-minimum-3.13.1-124.el7.noarch
selinux-policy-mls-3.13.1-124.el7.noarch
selinux-policy-3.13.1-124.el7.noarch
selinux-policy-devel-3.13.1-124.el7.noarch
# sesearch -s openvswitch_t -t initrc_t -c file -A -C

# sesearch -s openvswitch_t -t initrc_t -c file -D -C

# sesearch -s openvswitch_t -t initrc_t -c dir -A -C

# sesearch -s openvswitch_t -t initrc_t -c dir -D -C

# 

Access to initrc_t files and directories is neither allowed nor dontaudit-ed.

Comment 15 Milos Malik 2017-03-08 20:27:08 UTC
I can verify this bug, relevant test case already exist, but I need your cooperation, because our test case does not trigger SELinux denials which contain tcontext=system_u:system_r:initrc_t:s0. Our test case is able to trigger SELinux denials related to the hostname utility.

Comment 18 Mike Barrett 2017-03-09 04:58:32 UTC
Steve,

OpenShift 3.5 is supported on RHEL 7.2 and higher.  We will drop RHEL 7.2 support when RHEL 7.4 comes out in August.

Thanks,
Mike

Comment 32 errata-xmlrpc 2017-08-01 15:20:12 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://access.redhat.com/errata/RHBA-2017:1861


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