From cd4a5c7faece630d8a2593ee854a890be9e2b89a4abf9f6b190cb6688925a9b7 Mon Sep 17 00:00:00 2001 From: Robert Schweikert Date: Tue, 26 Jan 2021 16:53:57 +0000 Subject: [PATCH] Accepting request 866951 from home:jordimassaguerpla:branch:Cloud:Tools:fix_bsc_1181283 - Add use_arroba_to_include_sudoers_directory-bsc_1181283.patchfix (bsc#1181283) - Do not including sudoers.d directory twice OBS-URL: https://build.opensuse.org/request/show/866951 OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=182 --- cloud-init.changes | 6 ++++ cloud-init.spec | 2 ++ ...nclude_sudoers_directory-bsc_1181283.patch | 36 +++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 use_arroba_to_include_sudoers_directory-bsc_1181283.patch diff --git a/cloud-init.changes b/cloud-init.changes index 0ab168e..601e709 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jan 22 16:27:17 UTC 2021 - Jordi Massaguer + +- Add use_arroba_to_include_sudoers_directory-bsc_1181283.patchfix (bsc#1181283) + - Do not including sudoers.d directory twice + ------------------------------------------------------------------- Mon Jan 4 22:27:22 UTC 2021 - Robert Schweikert diff --git a/cloud-init.spec b/cloud-init.spec index bc113b7..6f86e66 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -41,6 +41,7 @@ Patch59: cloud-init-recognize-hpc.patch # FIXME https://github.com/canonical/cloud-init/commit/eea754492f074e00b601cf77aa278e3623857c5a Patch60: cloud-init-azure-def-usr-pass.patch Patch61: cloud-init-sle12-compat.patch +Patch70: use_arroba_to_include_sudoers_directory-bsc_1181283.patch BuildRequires: fdupes BuildRequires: filesystem # pkg-config is needed to find correct systemd unit dir @@ -141,6 +142,7 @@ Documentation and examples for cloud-init tools %patch60 %if 0%{?suse_version} < 1500 %patch61 +%patch70 %endif # patch in the full version to version.py version_pys=$(find . -name version.py -type f) diff --git a/use_arroba_to_include_sudoers_directory-bsc_1181283.patch b/use_arroba_to_include_sudoers_directory-bsc_1181283.patch new file mode 100644 index 0000000..2016078 --- /dev/null +++ b/use_arroba_to_include_sudoers_directory-bsc_1181283.patch @@ -0,0 +1,36 @@ +commit d62bd1f0efb25bc156a23b8e703ff264e479303c +Author: Jordi Massaguer Pla +Date: Fri Jan 22 17:10:17 2021 +0100 + + includedir in suoders can be prefixed by "arroba" + + Since version 1.9.1, @includedir can be used in the sudoers files + instead of #includedir: + + https://github.com/sudo-project/sudo/releases/tag/SUDO_1_9_1 + + This happens to be the default in SUSE Linux enterprise sudoer package, + so cloudinit should take this into account. + + Otherwise, cloudinit was adding an extra #includedir, which was + resulting on the files under /etc/sudoers.d being included twice, one by + @includedir from the SUSE package, one by the @includedir from + cloudinit. The consequence of this, was that if you were defining an + Cmnd_Alias inside any of those files, this was being defined twice and + creating an error when using sudo. + + Signed-off-by: Jordi Massaguer Pla + +diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py +index 1e118472..220bd11f 100755 +--- a/cloudinit/distros/__init__.py ++++ b/cloudinit/distros/__init__.py +@@ -673,7 +673,7 @@ class Distro(persistence.CloudInitPickleMixin, metaclass=abc.ABCMeta): + found_include = False + for line in sudoers_contents.splitlines(): + line = line.strip() +- include_match = re.search(r"^#includedir\s+(.*)$", line) ++ include_match = re.search(r"^[#|@]includedir\s+(.*)$", line) + if not include_match: + continue + included_dir = include_match.group(1).strip()