Bug 1857309
Summary: | [Azure][RHEL 8] cloud-init Permission denied with the use of mount option noexec | |||
---|---|---|---|---|
Product: | Red Hat Enterprise Linux 8 | Reporter: | schandle | |
Component: | cloud-init | Assignee: | Eduardo Otubo <eterrell> | |
Status: | CLOSED ERRATA | QA Contact: | xiachen | |
Severity: | high | Docs Contact: | ||
Priority: | urgent | |||
Version: | 8.2 | CC: | eterrell, gallwasingeborg, huzhao, jgreguske, mrezanin, mtessun, pdwyer, ribarry, vkuznets, xiachen, xialiu, xiliang, yacao, yuxisun | |
Target Milestone: | rc | Keywords: | ZStream | |
Target Release: | 8.0 | Flags: | pm-rhel:
mirror+
|
|
Hardware: | Unspecified | |||
OS: | Unspecified | |||
Whiteboard: | ||||
Fixed In Version: | cloud-init-20.3-1.el8 | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 1871914 1871915 1871916 1879989 1879990 (view as bug list) | Environment: | ||
Last Closed: | 2021-05-18 15:44:14 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: | ||||
Bug Depends On: | ||||
Bug Blocks: | 1871914, 1871915, 1871916, 1879989, 1879990 |
Description
schandle
2020-07-15 16:17:13 UTC
The feature is called 'dhclient sandboxing' and, among other things, cloud-init copies /usr/sbin/dhclient to /var/tmp/ and tries to execute it from there. With /var/tmp mounted read-only this is a no-go. The first question which comes to mind is why do we need to copy /usr/sbin/dhclient in the first place. Changelog tells us the following: + # XXX We copy dhclient out of /sbin/dhclient to avoid dealing with strict + # app armor profiles which disallow running dhclient -sf <our-script-file>. and this is definitely not needed for RHEL. How do we fix this? I see two options: 1) Check that what we've copied to /var/tmp is executable. Completely untested patch: diff --git a/cloudinit/net/dhcp.py b/cloudinit/net/dhcp.py index c033cc8e0a03..539b1f842120 100644 --- a/cloudinit/net/dhcp.py +++ b/cloudinit/net/dhcp.py @@ -215,6 +215,12 @@ def dhcp_discovery(dhclient_cmd_path, interface, cleandir): pid_file = os.path.join(cleandir, 'dhclient.pid') lease_file = os.path.join(cleandir, 'dhcp.leases') + # In some cases files in /var/tmp may not be executable, launching dhclient + # from there will certainly raise 'Permission denied' error. Try launching + # the original dhclient instead. + if not util.is_exe(sandbox_dhclient_cmd): + sandbox_dhclient_cmd = dhclient_cmd_path + # ISC dhclient needs the interface up to send initial discovery packets. # Generally dhclient relies on dhclient-script PREINIT action to bring the # link up before attempting discovery. Since we are using -sf /bin/true, 2) Make 'sandboxing' (the dhclient copying part to be precise) a configuration setting and disable it for RHEL. Personally, I think the right solution would be to kill the copying completely but I'm leaving this up to upstream. Here is a completely untested brew build with 1) implemented: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=30155195 It would be great if someone could give it a try. Upstream pull-request: https://github.com/canonical/cloud-init/pull/521 Verified the fix with cloud-init-20.3-5.el8 on Azure, PASS. Move to VERIFIED. Tested with RHEL8.4 nightly 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 (cloud-init bug fix and enhancement update), 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://access.redhat.com/errata/RHEA-2021:1827 Thanks for sharing such great information, the post you published have some great information which is quite beneficial for me. I highly appreciated with your work abilities. https://www.subwayliveiq.net/ |