Bug 1328269 - Missing SELinux rule for UDP socket
Summary: Missing SELinux rule for UDP socket
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Miroslav Grepl
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-18 20:52 UTC by Mauricio Teixeira
Modified: 2016-05-03 12:49 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-05-03 12:49:27 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Mauricio Teixeira 2016-04-18 20:52:12 UTC
RHEL7 is missing an SELinux rule that would allow OpenVPN to bind to a UDP socket:

***
module ovpn 2.0;

require {
  type reserved_port_t;
  class udp_socket name_bind;
}

#============= openvpn_t ==============
allow openvpn_t reserved_port_t:udp_socket name_bind;
***

I would like to know if it's possible to integrate this rule on the package that ships from EPEL7.

Comment 1 Orion Poplawski 2016-04-18 20:58:52 UTC
What port are you trying to bind to?  The default port 1194 is labeled openvpn_port_t and openvpn should be able to use it.  If you want to use a different port you need to do:

semanage port --add -t openvpn_port_t -p udp <port>

Comment 2 Mauricio Teixeira 2016-04-28 12:20:41 UTC
So there is an inconsistency here.
We use port 443 to avoid issues with random firewalls. The TCP daemon loads fine, out of the box, without any SELinux modifications. However for UDP I had to run the semanage rule above.
It would be good if UDP was allowed to use 443 by default, just like TCP is.

Comment 3 Orion Poplawski 2016-04-28 15:41:26 UTC
If you are going to use a different port than the standard one you are going to need to make selinux modifications.  These are the standard ports:

# semanage port -l | grep openvpn
openvpn_port_t                 tcp      1194
openvpn_port_t                 udp      1194

443 is the standard port for https, so:

# semanage port -l | grep 443
http_port_t                    tcp      80, 81, 443, 488, 8008, 8009, 8443, 9000

I'm reassigning to the selinux folks to see what is up with TCP working.  But the UDP behavior is as expected.

Comment 5 Miroslav Grepl 2016-05-03 12:49:27 UTC
Ok we don't support this labeling in the policy. I believe the best solution for this local modification is a local change using semanage how Orion wrote above.

semanage port --add -t openvpn_port_t -p udp <port>

Thank you.


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