Bug 1583830

Summary: SELinux prevents systemd-networkd from reading/writing tun tap device
Product: Red Hat Enterprise Linux 7 Reporter: Milos Malik <mmalik>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.6CC: lvrabec, mgrepl, mmalik, plautrba, ssekidde
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 10:04:31 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:

Description Milos Malik 2018-05-29 19:54:24 UTC
Description of problem:
It is not possible to create tun tap device with SELinux enabled.

Version-Release number of selected component (if applicable):
selinux-policy-3.13.1-201.el7.noarch
selinux-policy-devel-3.13.1-201.el7.noarch
selinux-policy-minimum-3.13.1-201.el7.noarch
selinux-policy-mls-3.13.1-201.el7.noarch
selinux-policy-targeted-3.13.1-201.el7.noarch
systemd-219-57.el7.x86_64
systemd-journal-gateway-219-57.el7.x86_64
systemd-libs-219-57.el7.x86_64
systemd-networkd-219-57.el7.x86_64
systemd-python-219-57.el7.x86_64
systemd-resolved-219-57.el7.x86_64
systemd-sysv-219-57.el7.x86_64

How reproducible:
 * always

Steps to Reproduce:
0.# mkdir -p /etc/systemd/network
1.# cat /etc/systemd/network/25-tun.netdev 
[NetDev]
Name=tun99
Kind=tun

[Tun]
MultiQueue=true
PacketInfo=true

2.# systemctl daemon-reload

3.# systemctl restart systemd-networkd

Actual results (enforcing mode):
----
type=PROCTITLE msg=audit(05/29/2018 15:45:19.840:497) : proctitle=/usr/lib/systemd/systemd-networkd 
type=PATH msg=audit(05/29/2018 15:45:19.840:497) : item=0 name=/dev/net/tun inode=12708 dev=00:05 mode=character,666 ouid=root ogid=root rdev=0a:c8 obj=system_u:object_r:tun_tap_device_t:s0 objtype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 
type=CWD msg=audit(05/29/2018 15:45:19.840:497) :  cwd=/ 
type=SYSCALL msg=audit(05/29/2018 15:45:19.840:497) : arch=x86_64 syscall=open success=no exit=EACCES(Permission denied) a0=0x55a2e002dfba a1=O_RDWR a2=0x0 a3=0x55a2e03ec180 items=1 ppid=1 pid=10681 auid=unset uid=systemd-network gid=systemd-network euid=systemd-network suid=systemd-network fsuid=systemd-network egid=systemd-network sgid=systemd-network fsgid=systemd-network tty=(none) ses=unset comm=systemd-network exe=/usr/lib/systemd/systemd-networkd subj=system_u:system_r:systemd_networkd_t:s0 key=(null) 
type=AVC msg=audit(05/29/2018 15:45:19.840:497) : avc:  denied  { read write } for  pid=10681 comm=systemd-network name=tun dev="devtmpfs" ino=12708 scontext=system_u:system_r:systemd_networkd_t:s0 tcontext=system_u:object_r:tun_tap_device_t:s0 tclass=chr_file permissive=0 
----

Expected results:
 * no SELinux denials

Comment 7 errata-xmlrpc 2018-10-30 10:04:31 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://access.redhat.com/errata/RHBA-2018:3111