Bug 1227293

Summary: chrooted_path not handled properly by dhcpd resource agent [patch]
Product: Red Hat Enterprise Linux 7 Reporter: Radek Steiger <rsteiger>
Component: resource-agentsAssignee: Fabio Massimo Di Nitto <fdinitto>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.1CC: agk, cluster-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: resource-agents-3.9.5-47.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 04:48:07 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:
Attachments:
Description Flags
proposed patch: replace hardcoded paths with OCF_RESKEY_chrooted_path
none
optional patch: change default chroot path to dhcp's real default path none

Description Radek Steiger 2015-06-02 11:01:24 UTC
> Description of problem:

The dhcpd resource agent provides chrooted_path parameter however the default /var/lib/dhcp path is hardcoded at certain places in the agent script, therefore using this parameter doesn't give the expected results. If I set chrooted_path to anything other, following shows in the log: 

Jun  2 10:49:48 virt-142 dhcpd: isc-dhcpd-4.2.5
Jun  2 10:49:48 virt-142 crmd[1674]: notice: process_lrm_event: Operation dhcpd_monitor_0: not running (node=virt-142, call=588, rc=7, cib-update=440, confirmed=true)
Jun  2 10:49:49 virt-142 dhcpd: isc-dhcpd-4.2.5
Jun  2 10:49:49 virt-142 dhcpd(dhcpd)[2052]: ERROR: could not copy /lib64/libdl.so.2 to chroot jail
Jun  2 10:49:49 virt-142 dhcpd(dhcpd)[2052]: ERROR: Could not fully initialize the chroot environment.
Jun  2 10:49:49 virt-142 lrmd[1671]: notice: operation_finished: dhcpd_start_0:2052:stderr [ cp: cannot create regular file '/var/lib/dhcp/lib*/': No such file or directory ]
Jun  2 10:49:49 virt-142 lrmd[1671]: notice: operation_finished: dhcpd_start_0:2052:stderr [ ocf-exit-reason:could not copy /lib64/libdl.so.2 to chroot jail ]
Jun  2 10:49:49 virt-142 lrmd[1671]: notice: operation_finished: dhcpd_start_0:2052:stderr [ ocf-exit-reason:Could not fully initialize the chroot environment. ]
Jun  2 10:49:49 virt-142 dhcpd: isc-dhcpd-4.2.5
Jun  2 10:49:49 virt-142 crmd[1674]: notice: process_lrm_event: Operation dhcpd_start_0: not installed (node=virt-142, call=589, rc=5, cib-update=441, confirmed=true)
Jun  2 10:49:49 virt-142 crmd[1674]: notice: process_lrm_event: virt-142-dhcpd_start_0:589 [ cp: cannot create regular file '/var/lib/dhcp/lib*/': No such file or directory\nocf-exit-reason:could not copy /lib64/libdl.so.2 to chroot jail\nocf-exit-reason:Could not fully initialize the chroot environment.\n ]
Jun  2 10:49:49 virt-142 dhcpd: isc-dhcpd-4.2.5
Jun  2 10:49:49 virt-142 dhcpd(dhcpd)[2203]: INFO: dhcpd already stopped
Jun  2 10:49:49 virt-142 crmd[1674]: notice: process_lrm_event: Operation dhcpd_stop_0: ok (node=virt-142, call=590, rc=0, cib-update=442, confirmed=true)


> Version-Release number of selected component (if applicable):

resource-agents-3.9.5-40.el7_1.3.x86_64


> How reproducible:

Always


> Steps to Reproduce:
0. create custom dhcp config in /etc/mydhcp.conf
1. pcs resource create DHCP dhcpd config=/etc/mydhcp.conf chrooted_path=/var/lib/mydhcpjail user=dhcpd group=dhcpd interface=eth0
2. 
3. 


> Actual results:

Libs are missing from /var/lib/mydhcpjail. See the log above.


> Expected results:

/var/lib/mydhcpjail is fully populated with required libs.

Comment 1 Radek Steiger 2015-06-02 11:02:23 UTC
Created attachment 1033704 [details]
proposed patch: replace hardcoded paths with OCF_RESKEY_chrooted_path

Comment 2 Radek Steiger 2015-06-02 11:07:21 UTC
Created attachment 1033706 [details]
optional patch: change default chroot path to dhcp's real default path

By default dhcp uses /var/lib/dhcpd directory. The resource agent however uses its own /var/lib/dhcp directory for chroot by default which causes problems with selinux. This patch changes the default chroot_path to the same directory as provided by dhcp rpm package.

Comment 3 David Vossel 2015-06-25 18:19:25 UTC
modified patches a bit and posted them upstream.

https://github.com/ClusterLabs/resource-agents/pull/627

Comment 9 errata-xmlrpc 2015-11-19 04:48:07 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-2190.html