Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1179809

Summary: [Openvswitch] [OpenDaylight] SELinux must be disabled to connect ovs to odl
Product: Red Hat Enterprise Linux 7 Reporter: Joe Talerico <jtaleric>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: high    
Version: 7.0CC: bburns, dradez, dshaks, jtaleric, lvrabec, mgrepl, mmalik, plautrba, pmatilai, pvrabec, rkhan, ssekidde
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.13.1-48.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1234977 (view as bug list) Environment:
Last Closed: 2015-11-19 10:24:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1234977    

Description Joe Talerico 2015-01-07 15:22:16 UTC
Description of problem:
To enable ovs to connect to OpenDaylight (and other controllers I assume) the user must set SELinux to 0.

Version-Release number of selected component (if applicable):
openvswitch-2.0.0-7.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. setenforce 1
2. connect ovs to odl
ovs-vsctl set-manager tcp:ODL_IP:6640
3. check for connected state with ovs-vsctl show or ovs-vsctl 
ovs-vsctl list Manager

Actual results:
[root@compute1 ~]# ovs-vsctl list Manager
_uuid               : fd0818a3-0814-4dde-8851-89e225c37d6a
connection_mode     : []
external_ids        : {}
inactivity_probe    : []
is_connected        : false
max_backoff         : []
other_config        : {}
status              : {sec_since_connect="4813", sec_since_disconnect="4803", state=BACKOFF}
target              : "tcp:10.1.254.4:6640"


Expected results:
[root@compute1 ~]# ovs-vsctl list Manager
_uuid               : fd0818a3-0814-4dde-8851-89e225c37d6a
connection_mode     : []
external_ids        : {}
inactivity_probe    : []
is_connected        : true
max_backoff         : []
other_config        : {}
status              : {sec_since_connect="4813", sec_since_disconnect="4803", state=BACKOFF}
target              : "tcp:10.1.254.4:6640"


Additional info:
Disabling SELinux fixes this problem:
[root@compute1 ~]# setenforce 0
[root@compute1 ~]# ovs-vsctl list Manager
_uuid               : fd0818a3-0814-4dde-8851-89e225c37d6a
connection_mode     : []
external_ids        : {}
inactivity_probe    : []
is_connected        : true
max_backoff         : []
other_config        : {}
status              : {sec_since_connect="0", sec_since_disconnect="4833", state=ACTIVE}
target              : "tcp:10.1.254.4:6640"
[root@compute1 ~]# 

AVC
type=AVC msg=audit(1420639716.027:1230578): avc:  denied  { name_connect } for  pid=23703 comm="ovsdb-server" dest=6640 scontext=system_u:system_r:openvswitch_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=SYSCALL msg=audit(1420639716.027:1230578): arch=c000003e syscall=42 success=no exit=-13 a0=d a1=7fff07fb24d0 a2=10 a3=0 items=0 ppid=23702 pid=23703 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="ovsdb-server" exe="/usr/sbin/ovsdb-server" subj=system_u:system_r:openvswitch_t:s0 key=(null)
type=AVC msg=audit(1420639724.031:1230579): avc:  denied  { name_connect } for  pid=23703 comm="ovsdb-server" dest=6640 scontext=system_u:system_r:openvswitch_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=SYSCALL msg=audit(1420639724.031:1230579): arch=c000003e syscall=42 success=no exit=-13 a0=d a1=7fff07fb24d0 a2=10 a3=0 items=0 ppid=23702 pid=23703 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="ovsdb-server" exe="/usr/sbin/ovsdb-server" subj=system_u:system_r:openvswitch_t:s0 key=(null)
type=AVC msg=audit(1420639732.033:1230580): avc:  denied  { name_connect } for  pid=23703 comm="ovsdb-server" dest=6640 scontext=system_u:system_r:openvswitch_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=SYSCALL msg=audit(1420639732.033:1230580): arch=c000003e syscall=42 success=no exit=-13 a0=d a1=7fff07fb24d0 a2=10 a3=0 items=0 ppid=23702 pid=23703 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="ovsdb-server" exe="/usr/sbin/ovsdb-server" subj=system_u:system_r:openvswitch_t:s0 key=(null)
type=AVC msg=audit(1420639740.033:1230581): avc:  denied  { name_connect } for  pid=23703 comm="ovsdb-server" dest=6640 scontext=system_u:system_r:openvswitch_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=SYSCALL msg=audit(1420639740.033:1230581): arch=c000003e syscall=42 success=no exit=-13 a0=d a1=7fff07fb24d0 a2=10 a3=0 items=0 ppid=23702 pid=23703 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="ovsdb-server" exe="/usr/sbin/ovsdb-server" subj=system_u:system_r:openvswitch_t:s0 key=(null)
type=AVC msg=audit(1420639748.036:1230582): avc:  denied  { name_connect } for  pid=23703 comm="ovsdb-server" dest=6640 scontext=system_u:system_r:openvswitch_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket

Comment 2 Joe Talerico 2015-01-07 15:29:30 UTC
SELinux Packages on this host:
selinux-policy-targeted-3.12.1-153.el7_0.13.noarch
selinux-policy-3.12.1-153.el7_0.13.noarch
openstack-selinux-0.5.19-2.el7ost.noarch

Comment 3 Panu Matilainen 2015-01-20 11:45:30 UTC
For some unexplained reason, selinux-policy allows OVS to listen on port 6634, but 6634 is an unassigned port number. OVS default port has been and currently is 6632 but the IANA assigned port is 6640 which OVS will start defaulting to in future.

It'd seem reasonable to allow both 6632 and 6640 in the policy, but 6634 seems questionable. Reassigning to selinux-policy.

Comment 4 Milos Malik 2015-01-20 12:29:27 UTC
# rpm -qa selinux-policy\*
selinux-policy-3.13.1-16.el7.noarch
selinux-policy-targeted-3.13.1-16.el7.noarch
selinux-policy-doc-3.13.1-16.el7.noarch
selinux-policy-mls-3.13.1-16.el7.noarch
selinux-policy-minimum-3.13.1-16.el7.noarch
selinux-policy-devel-3.13.1-16.el7.noarch
# seinfo --portcon=6632
	portcon tcp 1024-32767 system_u:object_r:unreserved_port_t:s0
	portcon udp 1024-32767 system_u:object_r:unreserved_port_t:s0
# seinfo --portcon=6634
	portcon tcp 6634 system_u:object_r:openvswitch_port_t:s0
	portcon tcp 1024-32767 system_u:object_r:unreserved_port_t:s0
	portcon udp 1024-32767 system_u:object_r:unreserved_port_t:s0
# seinfo --portcon=6640
	portcon tcp 1024-32767 system_u:object_r:unreserved_port_t:s0
	portcon udp 1024-32767 system_u:object_r:unreserved_port_t:s0
# sesearch -s openvswitch_t -t openvswitch_port_t -c tcp_socket -p name_connect -A -C

#

Even if the port was labeled correctly, the allow rule for name_connect would be missing.

Comment 6 Lukas Vrabec 2015-06-29 12:13:46 UTC
commit 320b5cf95f7db44fe1e4ca010899e7ec882a93a4
Author: Lukas Vrabec <lvrabec>
Date:   Mon Jun 29 14:08:34 2015 +0200

    Allow ovsdb-server to connect on xodbc-connect and ovsdb tcp ports. BZ(1179809)
    
    OVS default port has been and currently is 6632 but the IANA assigned
    port is 6640 which OVS will start defaulting to in future.

commit 1cf4d0d00fc452e4d4270e538790a875c479a906
Author: Lukas Vrabec <lvrabec>
Date:   Mon Jun 29 14:01:54 2015 +0200

    Label tcp port 6632 as xodbc-connect port. BZ (1179809)

commit c2bed33bfb32492ca122e1d64c5245886cdc9a55
Author: Lukas Vrabec <lvrabec>
Date:   Mon Jun 29 13:50:51 2015 +0200

    Label tcp port 6640 as ovsdb port. BZ (1179809)

Comment 14 errata-xmlrpc 2015-11-19 10:24:51 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-2300.html