Bug 1507110 - SELinux is preventing NetworkManager from 'read' accesses on the directory /var/lib/libvirt/dnsmasq.
Summary: SELinux is preventing NetworkManager from 'read' accesses on the directory /v...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 26
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:f338ba7c46cfa5fcfb7cfe1a7c3...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-10-27 17:45 UTC by Oron Peled
Modified: 2018-02-26 14:55 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-26 14:55:02 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Oron Peled 2017-10-27 17:45:43 UTC
Description of problem:
This problem started after adding libvirt and libvirt_guests to /etc/nsswitch.conf

The result is that various services (NetworkManger is just one of them) use these NSS libraries for resolving hosts.
The implementation of libvirt NSS libraries is trying to read /var/lib/libvirt/dnsmasq and access files under it.
SELinux is preventing NetworkManager from 'read' accesses on the directory /var/lib/libvirt/dnsmasq.

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

If you believe that NetworkManager should be allowed read access on the dnsmasq directory 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:
# ausearch -c 'NetworkManager' --raw | audit2allow -M my-NetworkManager
# semodule -X 300 -i my-NetworkManager.pp

Additional Information:
Source Context                system_u:system_r:NetworkManager_t:s0
Target Context                system_u:object_r:virt_var_lib_t:s0
Target Objects                /var/lib/libvirt/dnsmasq [ dir ]
Source                        NetworkManager
Source Path                   NetworkManager
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           libvirt-daemon-driver-network-3.2.1-6.fc26.x86_64
Policy RPM                    selinux-policy-3.13.1-260.13.fc26.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.13.9-200.fc26.x86_64 #1 SMP Mon
                              Oct 23 13:52:45 UTC 2017 x86_64 x86_64
Alert Count                   1
First Seen                    2017-10-27 20:36:22 IDT
Last Seen                     2017-10-27 20:36:22 IDT
Local ID                      3de943c1-9197-4dfd-9d34-59d07600669a

Raw Audit Messages
type=AVC msg=audit(1509125782.224:517): avc:  denied  { read } for  pid=1116 comm="NetworkManager" name="dnsmasq" dev="dm-0" ino=396384 scontext=system_u:system_r:NetworkManager_t:s0 tcontext=system_u:object_r:virt_var_lib_t:s0 tclass=dir permissive=0


Hash: NetworkManager,NetworkManager_t,virt_var_lib_t,dir,read

Version-Release number of selected component:
selinux-policy-3.13.1-260.13.fc26.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.9.1
hashmarkername: setroubleshoot
kernel:         4.13.9-200.fc26.x86_64
type:           libreport

Comment 1 Oron Peled 2017-10-27 17:47:26 UTC
Forgot to mention that libvirt-nss package supply the "libvirt" and "libvirt_guests" NSS libraries.

Comment 2 Oron Peled 2017-10-27 18:28:47 UTC
Same issue affects chronyd -- here is the detailed report:

SELinux is preventing chronyd from read access on the directory /var/lib/libvirt/dnsmasq.

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

If you believe that chronyd should be allowed read access on the dnsmasq directory 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:
# ausearch -c 'chronyd' --raw | audit2allow -M my-chronyd
# semodule -X 300 -i my-chronyd.pp

Additional Information:
Source Context                system_u:system_r:chronyd_t:s0
Target Context                system_u:object_r:virt_var_lib_t:s0
Target Objects                /var/lib/libvirt/dnsmasq [ dir ]
Source                        chronyd
Source Path                   chronyd
Port                          <Unknown>
Host                          neon
Source RPM Packages           
Target RPM Packages           libvirt-daemon-driver-network-3.2.1-6.fc26.x86_64
Policy RPM                    selinux-policy-3.13.1-260.13.fc26.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     neon
Platform                      Linux neon 4.13.9-200.fc26.x86_64 #1 SMP Mon Oct
                              23 13:52:45 UTC 2017 x86_64 x86_64
Alert Count                   2
First Seen                    2017-10-27 20:41:12 IDT
Last Seen                     2017-10-27 21:11:05 IDT
Local ID                      ede605e7-1c40-427e-88e7-0b3148057325

Raw Audit Messages
type=AVC msg=audit(1509127865.167:527): avc:  denied  { read } for  pid=972 comm="chronyd" name="dnsmasq" dev="dm-0" ino=396384 scontext=system_u:system_r:chronyd_t:s0 tcontext=system_u:object_r:virt_var_lib_t:s0 tclass=dir permissive=0


Hash: chronyd,chronyd_t,virt_var_lib_t,dir,read

Comment 3 kingsizebk 2018-02-22 13:47:03 UTC
Description of problem:
I believe this problem was caused by modifying /etc/nsswith.conf as follows, so that VM names would be resolvable:

hosts:      files mdns4_minimal [NOTFOUND=return] libvirt dns myhostname

Version-Release number of selected component:
selinux-policy-3.13.1-260.18.fc26.noarch

Additional info:
reporter:       libreport-2.9.1
hashmarkername: setroubleshoot
kernel:         4.15.3-200.fc26.x86_64
type:           libreport


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