Bug 1453114

Summary: dnsmasq: failed to create inotify for /etc/resolv.conf: Permission denied
Product: Red Hat Enterprise Linux 7 Reporter: Gerd Hoffmann <kraxel>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: kraxel, lvrabec, mgrepl, mmalik, plautrba, pvrabec, ssekidde
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.13.1-152.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 15:26:23 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 Gerd Hoffmann 2017-05-22 08:02:59 UTC
Description of problem:
libvirt fails to start virtual networks.

Version-Release number of selected component (if applicable):
libvirt-3.2.0-5.el7.x86_64
selinux-policy-3.13.1-145.el7.noarch
systemd-resolved-219-39.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. start libvirt network.

Actual results:

kraxel@broadwell ~/libvirt/net# virsh net-start bios
error: Failed to start network bios
error: internal error: Child process (VIR_BRIDGE_NAME=virbr0 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/bios.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper) unexpected exit status 5:
dnsmasq: failed to create inotify for /etc/resolv.conf: Permission denied

Expected results:
Network starts fine.

Additional info:

resolv.conf is managed by systemd-resolved ans looks this way:

kraxel@broadwell ~/libvirt/net# ll -Z /etc/resolv.conf /run/systemd/resolve/resolv.conf
lrwxrwxrwx. root            root            unconfined_u:object_r:etc_t:s0   /etc/resolv.conf -> /run/systemd/resolve/resolv.conf
-rw-r--r--. systemd-resolve systemd-resolve system_u:object_r:net_conf_t:s0  /run/systemd/resolve/resolv.conf

After "setenforce 0" the network starts fine.

Comment 2 Milos Malik 2017-05-22 08:15:20 UTC
Do you see any SELinux denials as a result of your scenario?

# ausearch -m avc -m user_avc -m selinux_err -m user_selinux_err -i -ts today

Comment 3 Gerd Hoffmann 2017-05-22 08:20:46 UTC
type=PROCTITLE msg=audit(22.05.2017 09:35:15.464:14806) : proctitle=/usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/bios.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
type=SYSCALL msg=audit(22.05.2017 09:35:15.464:14806) : arch=x86_64 syscall=inotify_add_watch success=no exit=EACCES(Permission denied) a0=0x6 a1=0x5614c43dc2d0 a2=0x88 a3=0x5 items=0 ppid=26122 pid=26194 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=dnsmasq exe=/usr/sbin/dnsmasq subj=system_u:system_r:dnsmasq_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(22.05.2017 09:35:15.464:14806) : avc:  denied  { read } for  pid=26194 comm=dnsmasq name=resolve dev="tmpfs" ino=20256 scontext=system_u:system_r:dnsmasq_t:s0-s0:c0.c1023 tcontext=system_u:object_r:systemd_resolved_var_run_t:s0 tclass=dir

Comment 8 errata-xmlrpc 2017-08-01 15:26:23 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-2017:1861