Bug 1074830

Summary: SELinux is preventing access to certificate files to VPN plugins (e.g. openvpn)
Product: [Fedora] Fedora Reporter: Shuresh Williams <stressfreechozeme>
Component: network-manager-appletAssignee: Lubomir Rintel <lkundrak>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 28CC: aarapov, berlins, blueowl, dcbw, dominick.grift, dwalsh, ep, fedora, henrique.ferreiro, JamieNeubert, kyrsjo, lkundrak, lvrabec, maxim.yegorushkin, mhroncok, mikhail.v.gavrilov, naval.antennas, robin, salzstange3, sheepdestroyer, thaller
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:46b2b84a95888552442542dec779b8c4628cdab654d8f48f6bf4ff41839039d1
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-28 19:06:32 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Shuresh Williams 2014-03-11 05:01:27 UTC
Description of problem:
attempting to connect to openvpn server
SELinux is preventing /usr/sbin/openvpn from 'open' accesses on the file .

*****  Plugin openvpn (47.5 confidence) suggests   ***************************

If you want to mv  to standard location so that openvpn can have open access
Then you must move the cert file to the ~/.cert directory
Do
# mv  ~/.cert
# restorecon -R -v ~/.cert


*****  Plugin openvpn (47.5 confidence) suggests   ***************************

If you want to modify the label on  so that openvpn can have open access on it
Then you must fix the labels.
Do
# semanage fcontext -a -t home_cert_t 
# restorecon -R -v 


*****  Plugin catchall (6.38 confidence) suggests   **************************

If you believe that openvpn should be allowed open access on the  file 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                unconfined_u:object_r:user_home_t:s0
Target Objects                 [ file ]
Source                        openvpn
Source Path                   /usr/sbin/openvpn
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           openvpn-2.3.2-4.fc20.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-122.fc20.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.13.5-200.fc20.x86_64 #1 SMP Mon
                              Feb 24 16:51:35 UTC 2014 x86_64 x86_64
Alert Count                   31
First Seen                    2014-03-02 14:49:12 EST
Last Seen                     2014-03-11 00:57:35 EDT
Local ID                      ea2b4470-8808-49a5-bf02-1674b29a3aab

Raw Audit Messages
type=AVC msg=audit(1394513855.374:505): avc:  denied  { open } for  pid=4294 comm="openvpn" path="/home/stress/Documents/StressfreeIT/Customer/Engel_and_Associates/test/stressfreetech.crt" dev="dm-2" ino=1313259 scontext=system_u:system_r:openvpn_t:s0 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file


type=SYSCALL msg=audit(1394513855.374:505): arch=x86_64 syscall=open success=no exit=EACCES a0=7fffe70afec1 a1=0 a2=1b6 a3=7fffe70acb80 items=0 ppid=4283 pid=4294 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,user_home_t,file,open

Additional info:
reporter:       libreport-2.1.12
hashmarkername: setroubleshoot
kernel:         3.13.5-200.fc20.x86_64
type:           libreport

Potential duplicate: bug 849784

Comment 1 Miroslav Grepl 2014-03-11 15:39:44 UTC
*****  Plugin openvpn (47.5 confidence) suggests   ***************************

If you want to mv  to standard location so that openvpn can have open access
Then you must move the cert file to the ~/.cert directory
Do
# mv  ~/.cert
# restorecon -R -v ~/.cert


*****  Plugin openvpn (47.5 confidence) suggests   ***************************

If you want to modify the label on  so that openvpn can have open access on it
Then you must fix the labels.
Do
# semanage fcontext -a -t home_cert_t 
# restorecon -R -v

Comment 2 Mikhail 2014-04-06 08:07:40 UTC
How it occurs:
1. I save my OpenVPN archive configuration to "Download" folder and extract to content "vpn".
2. I import "Albion_Gavrilov.ovpn" with "Network Manager"
3. When I try enable my VPN connection. I see SELinux alert.

What could be the reason for limiting the reading certificate file here? 
I think that the average user to do easy as I did.

Comment 4 Miroslav Grepl 2014-04-07 07:04:03 UTC
Yes but the point is you could have them anywhere in your homedirs and it would require full access on your homedir (your private data, PIN ... ).

And I believe the alert tells you what to do.

Comment 5 Mikhail 2014-04-09 17:17:54 UTC
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 7 Mikhail 2014-04-10 10:59:15 UTC
yes

Comment 8 Mikhail 2014-04-12 11:15:13 UTC
> 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 9 naval.antennas 2014-07-31 03:14:56 UTC
Description of problem:
Trying to connect a VPN.

Additional info:
reporter:       libreport-2.2.2
hashmarkername: setroubleshoot
kernel:         3.15.6-200.fc20.x86_64
type:           libreport

Comment 10 salzstange3 2014-09-06 14:39:35 UTC
Description of problem:
Ich habe versucht, eine VPN-Verbindung mittels openvpn zu erstellen.

Additional info:
reporter:       libreport-2.2.3
hashmarkername: setroubleshoot
kernel:         3.15.10-201.fc20.x86_64
type:           libreport

Comment 11 Fedora End Of Life 2015-05-29 11:13:17 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 12 Jamie 2015-07-09 19:49:00 UTC
Description of problem:
Tried to open my ca.crt file to establish vpn connection

Version-Release number of selected component:
selinux-policy-3.13.1-128.2.fc22.noarch

Additional info:
reporter:       libreport-2.6.0
hashmarkername: setroubleshoot
kernel:         4.0.6-300.fc22.x86_64
type:           libreport

Comment 13 sheepdestroyer 2015-07-15 13:21:39 UTC
Description of problem:
tried setting up vpn connction

Version-Release number of selected component:
selinux-policy-3.13.1-128.4.fc22.noarch

Additional info:
reporter:       libreport-2.6.0
hashmarkername: setroubleshoot
kernel:         4.0.7-300.fc22.x86_64
type:           libreport

Comment 14 Fedora Admin XMLRPC Client 2015-08-18 14:59:34 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 15 Maxim Egorushkin 2015-11-13 10:45:00 UTC
I hit this issue with Fedora 23. 
It is ironic that SELinux prevents one from having secure connections.
Had to disable SELinux.

Comment 16 Thomas Haller 2016-04-26 12:20:45 UTC
There is no easy solution to this bug. Currently not even rawhide has a proper solution for it, and much less we are going to fix this on older Fedora versions.


Longterm solution is do move away from certificate files and use pkcs11 URIs (e.g. https://bugzilla.gnome.org/show_bug.cgi?id=719982 ). This is also not a regression, as it never worked.


I am moving this bug to "rawhide".


The workaround is to adjust the SELinux label of the certificate files.
Put them to ~/.cert directory, and if the labels are still wrong, run

  restorecon -Rv ~/.cert

Comment 17 Thomas Haller 2016-04-26 12:23:31 UTC
*** Bug 1329897 has been marked as a duplicate of this bug. ***

Comment 18 Christian Stadelmann 2016-05-28 11:16:31 UTC
Workaround: Copy your certificate to /opt or /etc, e.g. /etc/pki. Make sure it is readable by all users.

Suggested solution: NetworkManager should copy the certificate in a /var or /etc directory owned by NetworkManager.

Comment 19 Christian Stadelmann 2016-05-28 11:17:06 UTC
*** Bug 1260939 has been marked as a duplicate of this bug. ***

Comment 20 Jan Kurik 2016-07-26 04:34:46 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.

Comment 21 shaun berlinger 2017-02-03 02:51:54 UTC
Description of problem:
I installed openvpn.server, as well as, attached my thrid party vpn server and for some reason I am not able to make a connection. I'm not sure if I installed openvpn server correctly or not, or why my third party vpn isn't connecting. I attached my server i'm using in the gateway box as well as attached the ca. certificate with it, added my username and password and no conection. I attempted to install EPEL and tried to create an openvpn server via online instructions and wasn't able to create a sample server or keys. not sure what I'm doing wrong.

Version-Release number of selected component:
selinux-policy-3.13.1-225.6.fc25.noarch

Additional info:
reporter:       libreport-2.8.0
hashmarkername: setroubleshoot
kernel:         4.9.6-200.fc25.x86_64
type:           libreport

Comment 22 Lubomir Rintel 2017-03-23 17:53:26 UTC
We'll deal with this on the UI side -- we don't want to give an access to the user home directories to VPN plugins.

Comment 23 Fedora End Of Life 2017-11-16 19:35:03 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 24 Fedora End Of Life 2018-02-20 15:25:24 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 28 development cycle.
Changing version to '28'.

Comment 25 ep 2018-09-21 20:35:17 UTC
Description of problem:
trying to use OpenVPN

Version-Release number of selected component:
selinux-policy-3.14.1-42.fc28.noarch

Additional info:
reporter:       libreport-2.9.5
hashmarkername: setroubleshoot
kernel:         4.18.8-200.fc28.x86_64
type:           libreport

Comment 26 Ben Cotton 2019-05-02 19:37:37 UTC
This message is a reminder that Fedora 28 is nearing its end of life.
On 2019-May-28 Fedora will stop maintaining and issuing updates for
Fedora 28. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora 'version' of '28'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 28 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 27 Ben Cotton 2019-05-28 19:06:32 UTC
Fedora 28 changed to end-of-life (EOL) status on 2019-05-28. Fedora 28 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.