Bug 1154196

Summary: dhcrelay triggers { setpcap } AVC
Product: Red Hat Enterprise Linux 7 Reporter: Milos Malik <mmalik>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.13.1-7.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 10:46:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Milos Malik 2014-10-17 20:44:35 UTC
Description of problem:
It's a bit confusing - does not matter if SELinux is enforcing or permissive, following lines appear in the journal always:
Dropped all unnecessary capabilities.
Dropped all capabilities.

Version-Release number of selected component (if applicable):
dhcp-4.2.5-32.el7.x86_64
selinux-policy-3.13.1-6.el7.noarch
selinux-policy-devel-3.13.1-6.el7.noarch
selinux-policy-doc-3.13.1-6.el7.noarch
selinux-policy-minimum-3.13.1-6.el7.noarch
selinux-policy-mls-3.13.1-6.el7.noarch
selinux-policy-sandbox-3.13.1-6.el7.noarch
selinux-policy-targeted-3.13.1-6.el7.noarch

How reproducible:
always

Steps to Reproduce:
1. get a RHEL-7 machine where targeted policy is active
2. service dhcrelay start
3. search for AVCs

Actual results (enforcing mode):
----
type=SYSCALL msg=audit(10/17/2014 22:28:19.451:479) : arch=x86_64 syscall=prctl success=no exit=-1(Operation not permitted) a0=PR_CAPBSET_DROP a1=chown a2=0x0 a3=0x0 items=0 ppid=1 pid=12313 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=dhcrelay exe=/usr/sbin/dhcrelay subj=system_u:system_r:dhcpd_t:s0 key=(null) 
type=AVC msg=audit(10/17/2014 22:28:19.451:479) : avc:  denied  { setpcap } for  pid=12313 comm=dhcrelay capability=setpcap  scontext=system_u:system_r:dhcpd_t:s0 tcontext=system_u:system_r:dhcpd_t:s0 tclass=capability 
----

Actual results (permissive mode):
----
type=SYSCALL msg=audit(10/17/2014 22:22:39.615:444) : arch=x86_64 syscall=prctl success=yes exit=0 a0=PR_CAPBSET_DROP a1=chown a2=0x0 a3=0x0 items=0 ppid=1 pid=7787 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=dhcrelay exe=/usr/sbin/dhcrelay subj=system_u:system_r:dhcpd_t:s0 key=(null) 
type=AVC msg=audit(10/17/2014 22:22:39.615:444) : avc:  denied  { setpcap } for  pid=7787 comm=dhcrelay capability=setpcap  scontext=system_u:system_r:dhcpd_t:s0 tcontext=system_u:system_r:dhcpd_t:s0 tclass=capability 
----

Expected results:
 * no AVCs

Comment 1 Miroslav Grepl 2014-10-20 10:41:42 UTC
Yes, it makes sense to allow it.

Comment 2 Miroslav Grepl 2014-10-21 14:04:12 UTC
commit fcbcc51eacebb57c777eb8a3c203f95486104d6d
Author: Miroslav Grepl <mgrepl>
Date:   Tue Oct 21 16:01:26 2014 +0200

    Allow setpcap capability for dhcpd.

Comment 6 errata-xmlrpc 2015-03-05 10:46:13 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0458.html