| From d9d724e36eea7d5464f4e55d27b7929beac0cc7f Mon Sep 17 00:00:00 2001 |
| From: varsha teratipally <teratipally@google.com> |
| Date: Sat, 5 Jun 2021 00:56:19 +0000 |
| Subject: [PATCH] cloud-init on azure required dhclient not to be included in |
| /tmp. |
| |
| --- |
| cloudinit/net/dhcp.py | 6 +----- |
| cloudinit/sources/helpers/azure.py | 4 ++-- |
| 2 files changed, 3 insertions(+), 7 deletions(-) |
| |
| diff --git a/cloudinit/net/dhcp.py b/cloudinit/net/dhcp.py |
| index 4394c68b..f21f0f3c 100644 |
| --- a/cloudinit/net/dhcp.py |
| +++ b/cloudinit/net/dhcp.py |
| @@ -210,13 +210,9 @@ def dhcp_discovery(dhclient_cmd_path, interface, cleandir, dhcp_log_func=None): |
| """ |
| LOG.debug('Performing a dhcp discovery on %s', interface) |
| |
| - # XXX We copy dhclient out of /sbin/dhclient to avoid dealing with strict |
| - # app armor profiles which disallow running dhclient -sf <our-script-file>. |
| # We want to avoid running /sbin/dhclient-script because of side-effects in |
| # /etc/resolv.conf any any other vendor specific scripts in |
| # /etc/dhcp/dhclient*hooks.d. |
| - sandbox_dhclient_cmd = os.path.join(cleandir, 'dhclient') |
| - util.copy(dhclient_cmd_path, sandbox_dhclient_cmd) |
| pid_file = os.path.join(cleandir, 'dhclient.pid') |
| lease_file = os.path.join(cleandir, 'dhcp.leases') |
| |
| @@ -231,7 +227,7 @@ def dhcp_discovery(dhclient_cmd_path, interface, cleandir, dhcp_log_func=None): |
| # link up before attempting discovery. Since we are using -sf /bin/true, |
| # we need to do that "link up" ourselves first. |
| subp.subp(['ip', 'link', 'set', 'dev', interface, 'up'], capture=True) |
| - cmd = [sandbox_dhclient_cmd, '-1', '-v', '-lf', lease_file, |
| + cmd = ['dhclient', '-1', '-v', '-lf', lease_file, |
| '-pf', pid_file, interface, '-sf', '/bin/true'] |
| out, err = subp.subp(cmd, capture=True) |
| |
| diff --git a/cloudinit/sources/helpers/azure.py b/cloudinit/sources/helpers/azure.py |
| index ad476076..dc192340 100755 |
| --- a/cloudinit/sources/helpers/azure.py |
| +++ b/cloudinit/sources/helpers/azure.py |
| @@ -112,7 +112,7 @@ def get_boot_telemetry(): |
| ) from e |
| |
| try: |
| - out, _ = subp.subp(['/bin/systemctl', |
| + out, _ = subp.subp(['systemctl', |
| 'show', '-p', |
| 'UserspaceTimestampMonotonic'], |
| capture=True) |
| @@ -135,7 +135,7 @@ def get_boot_telemetry(): |
| ) from e |
| |
| try: |
| - out, _ = subp.subp(['/bin/systemctl', 'show', |
| + out, _ = subp.subp(['systemctl', 'show', |
| 'cloud-init-local', '-p', |
| 'InactiveExitTimestampMonotonic'], |
| capture=True) |
| -- |
| 2.32.0.rc1.229.g3e70b5a671-goog |
| |
| |