Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1512950 - SELinux is preventing dnsmasq from 'read' accesses on the file /etc/resolv.conf.
Summary: SELinux is preventing dnsmasq from 'read' accesses on the file /etc/resolv.conf.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 27
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:76faa4058709f36e49042ae1b9a...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-14 13:51 UTC by Berend De Schouwer
Modified: 2017-11-26 12:06 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-11-26 12:06:04 UTC


Attachments (Terms of Use)

Description Berend De Schouwer 2017-11-14 13:51:00 UTC
Description of problem:
dnsmasq couldn't read resolv.conf, however resolv.conf does have the label net_conf_t:

~]$ ls -laZ /etc/resolv.conf 
-rw-r--r--. 1 root root system_u:object_r:net_conf_t:s0 78 Nov 14 15:47 /etc/resolv.conf
SELinux is preventing dnsmasq from 'read' accesses on the file /etc/resolv.conf.

*****  Plugin restorecon (99.5 confidence) suggests   ************************

If you want to fix the label. 
/etc/resolv.conf default label should be net_conf_t.
Then you can run restorecon. The access attempt may have been stopped due to insufficient permissions to access a parent directory in which case try to change the following command accordingly.
Do
# /sbin/restorecon -v /etc/resolv.conf

*****  Plugin catchall (1.49 confidence) suggests   **************************

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

Additional Information:
Source Context                system_u:system_r:dnsmasq_t:s0-s0:c0.c1023
Target Context                unconfined_u:object_r:user_home_t:s0
Target Objects                /etc/resolv.conf [ file ]
Source                        dnsmasq
Source Path                   dnsmasq
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-283.14.fc27.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.13.9-300.fc27.x86_64 #1 SMP Mon
                              Oct 23 13:41:58 UTC 2017 x86_64 x86_64
Alert Count                   1
First Seen                    2017-11-13 18:23:31 SAST
Last Seen                     2017-11-13 18:23:31 SAST
Local ID                      b637ff09-f389-437a-99b0-33580a575fa7

Raw Audit Messages
type=AVC msg=audit(1510590211.787:3770): avc:  denied  { read } for  pid=2302 comm="dnsmasq" name="resolv.conf" dev="dm-2" ino=655757 scontext=system_u:system_r:dnsmasq_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=0


Hash: dnsmasq,dnsmasq_t,user_home_t,file,read

Version-Release number of selected component:
selinux-policy-3.13.1-283.14.fc27.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.9.3
hashmarkername: setroubleshoot
kernel:         4.13.11-300.fc27.x86_64
type:           libreport

Comment 1 Daniel Walsh 2017-11-26 12:06:04 UTC
This indicates that dnsmasq attempted to read a file named resolv.conf that was labeled user_home_t, which indicates it is home directory data.  If  you created a resolv.conf in your homedir and mv'd it to somewhere else this could happen.

Please fix the label on the resolv.conf.


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