Bug 770596 - SELinux is preventing /bin/bash from 'write' accesses on the file resolv.conf.
Summary: SELinux is preventing /bin/bash from 'write' accesses on the file resolv.conf.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 16
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:a9562686ccbbafd97260b2d4b1f...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-12-27 22:00 UTC by Frank Murphy
Modified: 2012-01-02 10:55 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-12-29 17:59:02 UTC
Type: ---


Attachments (Terms of Use)

Description Frank Murphy 2011-12-27 22:00:54 UTC
libreport version: 2.0.8
executable:     /usr/bin/python
hashmarkername: setroubleshoot
kernel:         3.1.6-1.fc16.x86_64
reason:         SELinux is preventing /bin/bash from 'write' accesses on the file resolv.conf.
time:           Tue 27 Dec 2011 22:00:17 GMT

description:
:SELinux is preventing /bin/bash from 'write' accesses on the file resolv.conf.
:
:*****  Plugin catchall_labels (83.8 confidence) suggests  ********************
:
:If you want to allow bash to have write access on the resolv.conf file
:Then you need to change the label on resolv.conf
:Do
:# semanage fcontext -a -t FILE_TYPE 'resolv.conf'
:where FILE_TYPE is one of the following: dhcpc_tmp_t, user_cron_spool_t, dhcpc_t, afs_cache_t, dhcpc_state_t, proc_xen_t, puppet_tmp_t, initrc_var_run_t, dhcpc_var_run_t, net_conf_t, root_t. 
:Then execute: 
:restorecon -v 'resolv.conf'
:
:
:*****  Plugin catchall (17.1 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                system_u:system_r:dhcpc_t:s0
:Target Context                unconfined_u:object_r:etc_t:s0
:Target Objects                resolv.conf [ file ]
:Source                        dhclient-script
:Source Path                   /bin/bash
:Port                          <Unknown>
:Host                          (removed)
:Source RPM Packages           bash-4.2.20-1.fc16
:Target RPM Packages           
:Policy RPM                    selinux-policy-3.10.0-67.fc16
:Selinux Enabled               True
:Policy Type                   targeted
:Enforcing Mode                Permissive
:Host Name                     (removed)
:Platform                      Linux frank01.frankly3d.local 3.1.6-1.fc16.x86_64
:                              #1 SMP Wed Dec 21 22:41:17 UTC 2011 x86_64 x86_64
:Alert Count                   1
:First Seen                    Tue 27 Dec 2011 21:53:50 GMT
:Last Seen                     Tue 27 Dec 2011 21:53:50 GMT
:Local ID                      7e1db65e-d55a-464d-9394-e46ea92600d2
:
:Raw Audit Messages
:type=AVC msg=audit(1325022830.611:155): avc:  denied  { write } for  pid=4772 comm="dhclient-script" name="resolv.conf" dev=dm-2 ino=56105 scontext=system_u:system_r:dhcpc_t:s0 tcontext=unconfined_u:object_r:etc_t:s0 tclass=file
:
:
:type=SYSCALL msg=audit(1325022830.611:155): arch=x86_64 syscall=open success=yes exit=ESRCH a0=17fd350 a1=241 a2=1b6 a3=11 items=0 ppid=4750 pid=4772 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=dhclient-script exe=/bin/bash subj=system_u:system_r:dhcpc_t:s0 key=(null)
:
:Hash: dhclient-script,dhcpc_t,etc_t,file,write
:
:audit2allow
:
:#============= dhcpc_t ==============
:allow dhcpc_t etc_t:file write;
:
:audit2allow -R
:
:#============= dhcpc_t ==============
:allow dhcpc_t etc_t:file write;
:

Comment 1 Frank Murphy 2011-12-28 06:24:05 UTC
Reported as am uncertain if bash requires this access?

Comment 2 Daniel Walsh 2011-12-29 17:59:02 UTC
If you read the alert, it told you how to fix this.

restorecon /etc/resolv.conf

Now the question is how did it get mislabeled?

Did you do something special to create this file?

Comment 3 Frank Murphy 2011-12-29 18:23:45 UTC
(In reply to comment #2)
> If you read the alert, it told you how to fix this.
> 
> restorecon /etc/resolv.conf

so it's required access.


> 
> Now the question is how did it get mislabeled?
> 
> Did you do something special to create this file?

"service network restart"

Comment 4 Miroslav Grepl 2012-01-02 09:57:51 UTC
Yes, it is required access.

How is /etc/resolv.conf labeled now?

# ls -Z /etc/resolv.conf

Comment 5 Frank Murphy 2012-01-02 10:31:27 UTC
ls -Z /etc/resolv.conf
-rw-r--r--. root root system_u:object_r:net_conf_t:s0  /etc/resolv.conf

Comment 6 Miroslav Grepl 2012-01-02 10:55:33 UTC
Ok, reopen the bug if this happens again.


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