Bug 736841 - SELinux is preventing /bin/bash from 'write' accesses on the file /etc/resolv.conf.
Summary: SELinux is preventing /bin/bash from 'write' accesses on the file /etc/resolv...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: rawhide
Hardware: i386
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: setroubleshoot_trace_hash:98a614dd71d...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-08 20:20 UTC by Mircea Sava
Modified: 2011-09-09 12:19 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2011-09-09 07:57:59 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Mircea Sava 2011-09-08 20:20:44 UTC
SELinux is preventing /bin/bash from 'write' 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.
Do
# /sbin/restorecon -v /etc/resolv.conf

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

If you believe that bash should be allowed write 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:
# grep dhclient-script /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                unconfined_u:system_r:dhcpc_t:s0-s0:c0.c1023
Target Context                unconfined_u:object_r:etc_runtime_t:s0
Target Objects                /etc/resolv.conf [ file ]
Source                        dhclient-script
Source Path                   /bin/bash
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           bash-4.2.10-4.fc15
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.16-38.fc15
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 2.6.40.4-5.fc15.i686
                              #1 SMP Tue Aug 30 14:54:41 UTC 2011 i686 i686
Alert Count                   2
First Seen                    Thu 08 Sep 2011 10:21:16 PM EEST
Last Seen                     Thu 08 Sep 2011 10:21:16 PM EEST
Local ID                      29ec74d0-d379-4474-a234-bbeb52024302

Raw Audit Messages
type=AVC msg=audit(1315509676.219:92): avc:  denied  { write } for  pid=3007 comm="dhclient-script" name="resolv.conf" dev=dm-1 ino=13956 scontext=unconfined_u:system_r:dhcpc_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:etc_runtime_t:s0 tclass=file


type=SYSCALL msg=audit(1315509676.219:92): arch=i386 syscall=open success=no exit=EACCES a0=9c6b888 a1=8201 a2=0 a3=0 items=0 ppid=2928 pid=3007 auid=528 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=1 comm=dhclient-script exe=/bin/bash subj=unconfined_u:system_r:dhcpc_t:s0-s0:c0.c1023 key=(null)

Hash: dhclient-script,dhcpc_t,etc_runtime_t,file,write

audit2allow

#============= dhcpc_t ==============
allow dhcpc_t etc_runtime_t:file write;

audit2allow -R

#============= dhcpc_t ==============
allow dhcpc_t etc_runtime_t:file write;

Comment 1 Miroslav Grepl 2011-09-09 07:57:59 UTC
resolv.conf is mislabeled.

# /sbin/restorecon -v /etc/resolv.conf

will fix. 

Could you reopen the bug if this happens again.

Comment 2 Daniel Walsh 2011-09-09 12:19:42 UTC
Somewhere in your init scripts or a script launched out of dbus it is creating a resolv.conf with the wrong label.  Are you using a tool like ppp?


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