Bug 695243

Summary: SELinux is preventing /bin/bash from 'read' accesses on the lnk_file /var/lock/subsys/nscd.
Product: [Fedora] Fedora Reporter: Michal Schmidt <mschmidt>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 15CC: dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:7806bcbc5f686fe17ba52ee08983854671cc884164791d446a2a16bfe9da1af8
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-10-07 14:06:06 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Michal Schmidt 2011-04-11 07:21:09 UTC
SELinux is preventing /bin/bash from 'read' accesses on the lnk_file /var/lock/subsys/nscd.

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

If you believe that bash should be allowed read access on the nscd lnk_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                system_u:object_r:var_lock_t:s0
Target Objects                /var/lock/subsys/nscd [ lnk_file ]
Source                        dhclient-script
Source Path                   /bin/bash
Port                          <Neznámé>
Host                          (removed)
Source RPM Packages           bash-4.2.8-2.fc15
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.16-13.fc15
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 2.6.38.2-9.fc15.x86_64 #1 SMP Wed
                              Mar 30 16:55:57 UTC 2011 x86_64 x86_64
Alert Count                   3
First Seen                    Po 11. duben 2011, 00:17:51 CEST
Last Seen                     Po 11. duben 2011, 00:20:46 CEST
Local ID                      195de783-4e39-4302-9113-1854f3381a0b

Raw Audit Messages
type=AVC msg=audit(1302474046.568:64): avc:  denied  { read } for  pid=2892 comm="dhclient-script" name="lock" dev=vda1 ino=389445 scontext=unconfined_u:system_r:dhcpc_t:s0-s0:c0.c1023 tcontext=system_u:object_r:var_lock_t:s0 tclass=lnk_file


type=SYSCALL msg=audit(1302474046.568:64): arch=x86_64 syscall=stat success=no exit=EACCES a0=2507c30 a1=7fff17a4dbc0 a2=7fff17a4dbc0 a3=8 items=1 ppid=2836 pid=2892 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=tty2 ses=1 comm=dhclient-script exe=/bin/bash subj=unconfined_u:system_r:dhcpc_t:s0-s0:c0.c1023 key=(null)

type=CWD msg=audit(1302474046.568:64): cwd=/etc/sysconfig/network-scripts

type=PATH msg=audit(1302474046.568:64): item=0 name=/var/lock/subsys/nscd

Hash: dhclient-script,dhcpc_t,var_lock_t,lnk_file,read

audit2allow

#============= dhcpc_t ==============
allow dhcpc_t var_lock_t:lnk_file read;

audit2allow -R

#============= dhcpc_t ==============
allow dhcpc_t var_lock_t:lnk_file read;

Comment 1 Michal Schmidt 2011-04-11 07:26:31 UTC
$ ls -lZ /var/lock
lrwxrwxrwx. root root system_u:object_r:var_lock_t:s0  /var/lock -> ../run/lock

The access probably happens in /etc/sysconfig/network-scripts/network-functions:change_resolv_conf():
  [ -e /var/lock/subsys/nscd ] && /usr/sbin/nscd -i hosts; # invalidate cache

Comment 2 Daniel Walsh 2011-04-11 16:22:04 UTC
Miroslav I checked in a change for this in files.if.  Need to allow all apps that use locks to read var_lock_t lnk_file.