Bug 1084744 - SELinux is preventing /usr/sbin/openvpn from 'name_connect' accesses on the tcp_socket .
Summary: SELinux is preventing /usr/sbin/openvpn from 'name_connect' accesses on the t...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 20
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:8282d2cfb1fb1f43a48da68972d...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-04-06 08:00 UTC by Mikhail
Modified: 2014-04-20 01:24 UTC (History)
5 users (show)

Fixed In Version: selinux-policy-3.12.1-153.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-04-20 01:24:36 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Mikhail 2014-04-06 08:00:26 UTC
Description of problem:
SELinux is preventing /usr/sbin/openvpn from 'name_connect' accesses on the tcp_socket .

*****  Plugin connect_ports (85.9 confidence) suggests   *********************

If you want to allow /usr/sbin/openvpn to connect to network port 11942
Then you need to modify the port type.
Do
# semanage port -a -t PORT_TYPE -p tcp 11942
    where PORT_TYPE is one of the following: dns_port_t, dnssec_port_t, http_cache_port_t, http_port_t, kerberos_port_t, ldap_port_t, ocsp_port_t, openvpn_port_t, squid_port_t, tor_port_t.

*****  Plugin catchall_boolean (7.33 confidence) suggests   ******************

If you want to allow nis to enabled
Then you must tell SELinux about this by enabling the 'nis_enabled' boolean.
You can read 'None' man page for more details.
Do
setsebool -P nis_enabled 1

*****  Plugin catchall_boolean (7.33 confidence) suggests   ******************

If you want to allow openvpn to can network connect
Then you must tell SELinux about this by enabling the 'openvpn_can_network_connect' boolean.
You can read 'None' man page for more details.
Do
setsebool -P openvpn_can_network_connect 1

*****  Plugin catchall (1.35 confidence) suggests   **************************

If you believe that openvpn should be allowed name_connect access on the  tcp_socket by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep openvpn /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:openvpn_t:s0
Target Context                system_u:object_r:unreserved_port_t:s0
Target Objects                 [ tcp_socket ]
Source                        openvpn
Source Path                   /usr/sbin/openvpn
Port                          11942
Host                          (removed)
Source RPM Packages           openvpn-2.3.2-4.fc20.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-149.fc20.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 3.13.8-200.fc20.x86_64 #1 SMP Tue
                              Apr 1 03:35:46 UTC 2014 x86_64 x86_64
Alert Count                   2
First Seen                    2014-04-06 13:41:24 YEKT
Last Seen                     2014-04-06 13:59:43 YEKT
Local ID                      ec5e6892-a1ce-4cfc-b1e4-d03366ebb89f

Raw Audit Messages
type=AVC msg=audit(1396771183.144:990): avc:  denied  { name_connect } for  pid=24752 comm="openvpn" dest=11942 scontext=system_u:system_r:openvpn_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket


type=SYSCALL msg=audit(1396771183.144:990): arch=x86_64 syscall=connect success=no exit=EINPROGRESS a0=5 a1=7fff009f70c8 a2=10 a3=4000 items=0 ppid=24750 pid=24752 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm=openvpn exe=/usr/sbin/openvpn subj=system_u:system_r:openvpn_t:s0 key=(null)

Hash: openvpn,openvpn_t,unreserved_port_t,tcp_socket,name_connect

Additional info:
reporter:       libreport-2.2.1
hashmarkername: setroubleshoot
kernel:         3.13.8-200.fc20.x86_64
type:           libreport

Comment 1 Miroslav Grepl 2014-04-07 07:22:12 UTC
Again the alert tells you what to do. Did it happen by default or did you setup this port?

Comment 2 Mikhail 2014-04-07 07:40:27 UTC
I am really don't understand why usual user of desktop system needed configure SELinux for use VPN???

So we will achieve that users will either disable SELinux or move to other distributions (Debian, Ubuntu) :(


I am really don't understand why I need grant network or file access for every application :(

Comment 3 Miroslav Grepl 2014-04-07 07:42:27 UTC
Did you setup this port?

Comment 4 Miroslav Grepl 2014-04-07 07:43:25 UTC
We are not able to know all configurations. This is a reason why we have booleans for example.

Comment 5 Mikhail 2014-04-07 07:48:37 UTC
(In reply to Miroslav Grepl from comment #3)
> Did you setup this port?

Of course no. I am received ".ovpn" file for automatic VPN client configuration and I am expected that it would connect out of box. I am really don't want to know which port and ip address used for it.

Comment 6 Mikhail 2014-04-07 07:50:32 UTC
I agree that protection is needed for server applications to configure them will always be administrators. But I disagree configure client applications because that is only discourages users from Fedora.

Comment 7 Lukas Vrabec 2014-04-07 08:21:42 UTC
Hi, 

In this case we can only tell you what to do to fix your issue. Please, If you want to fix it, follow these steps:

*****  Plugin catchall_boolean (7.33 confidence) suggests   ******************

If you want to allow openvpn to can network connect
Then you must tell SELinux about this by enabling the 'openvpn_can_network_connect' boolean.
You can read 'None' man page for more details.
Do
setsebool -P openvpn_can_network_connect 1 

Thank you.

Comment 8 Mikhail 2014-04-07 09:19:44 UTC
I get it. Are you think is correct for each installed client application to configure booleans SELinux?

Ok, why I don't do it either for browser, IM client and other applications which is needed some network connections?

Comment 9 Mikhail 2014-04-07 09:20:46 UTC
I think this boolean "openvpn_can_network_connect" should be setted to 1 by default.

Comment 10 Lukas Vrabec 2014-04-07 09:42:44 UTC
(In reply to Mikhail from comment #8)
> I get it. Are you think is correct for each installed client application to
> configure booleans SELinux?
From security point of view, it's necessary.

> 
> Ok, why I don't do it either for browser, IM client and other applications
> which is needed some network connections?
Because every service or applications needs different rights, e.g IM client has different network rights than openvpn.

Comment 11 Mikhail 2014-04-07 09:54:13 UTC
I thought SELinux helps prevent real problems with secure, when blocks atypical behavior of programs. For example why the database server wants to connect to somewhere. Or why the Web server read the contents of home directories. But there is another case. I see no other purpose of openvpn how to create tunnels. Ie my outrage is based on the logic of why allow what should have permissions is the usual behavior. Extra blocking here only annoying and not create a sense of increased security.

Comment 12 Daniel Walsh 2014-04-08 13:20:39 UTC
I have no problem with turning this boolean on by default.

Comment 13 Lukas Vrabec 2014-04-08 14:07:14 UTC
OK Dan, I'll change it.

Comment 14 Lukas Vrabec 2014-04-08 14:23:16 UTC
commit 53d5f49e0411bf0d8158a3868828db5769e1798f
Author: Lukas Vrabec <lvrabec>
Date:   Tue Apr 8 16:11:22 2014 +0200

    openvpn_can_network_connect boolean set default on

Comment 15 Mikhail 2014-04-09 17:17:46 UTC
Thanks Dan.

Let's talk about the problem https://bugzilla.redhat.com/show_bug.cgi?id=1074830 constructively.

I am agree that certificates must be stored in safe place. But with this block of SELinux protect certificates only from openvpn LOL. It's means any another process can access and steal certificates.

Be right way if all certificates automatically moved to safe place and SELinux block any process to access to this place except trusted processes. Are you agree with me?

I suggest fill separate bug report for NetworkManager developers that they when importing ".ovpn" file automatically transferred certificates in safe place (~/.cert folder). Can you do this? And while this is not done , I believe that SELinux should not block access to the home folder for openvpn. Cause it now more annoying  than protects from real threats .

Thank you for understanding .

Comment 16 Mikhail 2014-04-09 17:21:18 UTC
By the way do not necessarily move files rather they just change the label of SELinux automatically

It can do NetworkManager :)

Comment 17 Miroslav Grepl 2014-04-10 08:19:49 UTC
(In reply to Mikhail from comment #16)
> By the way do not necessarily move files rather they just change the label
> of SELinux automatically
> 
> It can do NetworkManager :)

AFAIK there is a NM bug for this issue where we have been discussing it.

Comment 18 Mikhail 2014-04-10 08:25:44 UTC
Miroslav, thanks.
I need fill separate bug report or NM team know about it?

Comment 19 Miroslav Grepl 2014-04-10 08:34:30 UTC
Let me find this bug.

Comment 20 Fedora Update System 2014-04-10 08:43:48 UTC
selinux-policy-3.12.1-153.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/FEDORA-2014-4933/selinux-policy-3.12.1-153.fc20

Comment 21 Fedora Update System 2014-04-14 22:41:51 UTC
Package selinux-policy-3.12.1-153.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.12.1-153.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-4933/selinux-policy-3.12.1-153.fc20
then log in and leave karma (feedback).

Comment 22 Fedora Update System 2014-04-20 01:24:36 UTC
selinux-policy-3.12.1-153.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.


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