Bug 1140426

Summary: SELinux is preventing /usr/sbin/openvpn from read, write access on the chr_file tun.
Product: [Fedora] Fedora Reporter: Adam Williamson <awilliam>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 21CC: dominick.grift, dwalsh, lvrabec, mgrepl, mruckman, rharwood
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:d7bef0e9428267ae982197888f67c8bdd83d53a91751d47d697bb402a1c192e0
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-15 08:54:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Adam Williamson 2014-09-10 23:58:03 UTC
Description of problem:
Happens when I try to log in to the Red Hat VPN using OpenVPN via NetworkManager.
SELinux is preventing /usr/sbin/openvpn from read, write access on the chr_file tun.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that openvpn should be allowed read write access on the tun chr_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                system_u:object_r:svirt_image_t:s0:c151,c840
Target Objects                tun [ chr_file ]
Source                        openvpn
Source Path                   /usr/sbin/openvpn
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           openvpn-2.3.4-4.fc21.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-79.fc21.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.17.0-0.rc3.git2.2.fc22.1.x86_64
                              #1 SMP Thu Sep 4 16:43:36 UTC 2014 x86_64 x86_64
Alert Count                   1
First Seen                    2014-09-10 16:56:42 PDT
Last Seen                     2014-09-10 16:56:42 PDT
Local ID                      129c107b-ff42-4c7e-8fe2-9e60ff0a3d02

Raw Audit Messages
type=AVC msg=audit(1410393402.364:7777): avc:  denied  { read write } for  pid=21265 comm="openvpn" name="tun" dev="devtmpfs" ino=13429 scontext=system_u:system_r:openvpn_t:s0 tcontext=system_u:object_r:svirt_image_t:s0:c151,c840 tclass=chr_file permissive=0


type=SYSCALL msg=audit(1410393402.364:7777): arch=x86_64 syscall=open success=no exit=EACCES a0=7f823973efdd a1=2 a2=0 a3=0 items=0 ppid=21250 pid=21265 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=openvpn exe=/usr/sbin/openvpn subj=system_u:system_r:openvpn_t:s0 key=(null)

Hash: openvpn,openvpn_t,svirt_image_t,chr_file,read,write

Version-Release number of selected component:
selinux-policy-3.13.1-79.fc21.noarch

Additional info:
reporter:       libreport-2.2.3
hashmarkername: setroubleshoot
kernel:         3.17.0-0.rc3.git2.2.fc22.1.x86_64
type:           libreport

Comment 1 Adam Williamson 2014-09-11 00:28:56 UTC
Oh, I see. This is fall-out from https://bugzilla.redhat.com/show_bug.cgi?id=1139646 , I think, which gave /dev/net/tun the svirt_image_t type.

Comment 2 Mike Ruckman 2014-09-11 00:51:13 UTC
I've confirmed this locally as well.

Workaround is the following:
# grep openvpn /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Comment 3 Robbie Harwood 2014-09-12 20:00:57 UTC
This is also preventing /usr/sbin/vpnc from doing similarly:

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that vpnc should be allowed read access on the tun chr_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 vpnc /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:vpnc_t:s0
Target Context                system_u:object_r:svirt_image_t:s0:c706,c928
Target Objects                /dev/net/tun [ chr_file ]
Source                        vpnc
Source Path                   /usr/sbin/vpnc
Port                          <Unknown>
Host                          thriss
Source RPM Packages           vpnc-0.5.3-23.svn457.fc22.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-81.fc22.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     thriss
Platform                      Linux thriss 3.17.0-0.rc4.git3.1.fc22.x86_64 #1
                              SMP Thu Sep 11 13:17:37 UTC 2014 x86_64 x86_64
Alert Count                   56
First Seen                    2014-09-12 13:22:39 EDT
Last Seen                     2014-09-12 16:00:01 EDT
Local ID                      f5142b3c-aebd-485a-9c63-3ccdc0c2f584

Raw Audit Messages
type=AVC msg=audit(1410552001.433:828): avc:  denied  { read } for  pid=2234 comm="vpnc" path="/dev/net/tun" dev="devtmpfs" ino=14367 scontext=system_u:system_r:vpnc_t:s0 tcontext=system_u:object_r:svirt_image_t:s0:c706,c928 tclass=chr_file permissive=1


type=SYSCALL msg=audit(1410552001.433:828): arch=x86_64 syscall=read success=yes exit=168 a0=5 a1=7f85fec78708 a2=1000 a3=0 items=0 ppid=2053 pid=2234 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=vpnc exe=/usr/sbin/vpnc subj=system_u:system_r:vpnc_t:s0 key=(null)

Hash: vpnc,vpnc_t,svirt_image_t,chr_file,read

Comment 4 Miroslav Grepl 2014-09-15 08:54:14 UTC

*** This bug has been marked as a duplicate of bug 1139646 ***