From 40ec916bbbe19ad64a2f4a6194c70dcb49f1b166 Mon Sep 17 00:00:00 2001 From: Miroslav Rezanina Date: Mon, 21 Jun 2021 07:18:37 -0400 Subject: [PATCH] * Mon Jun 21 2021 Miroslav Rezanina - 21.1-2 - ci-rhel-cloud.cfg-remove-ssh_genkeytypes-in-settings.py.patch [bz#1970909] - ci-Use-_systemdgeneratordir-macro-for-cloud-init-genera.patch [bz#1971480] - Resolves: bz#1970909 ([cloud-init] From RHEL 82+ cloud-init no longer displays sshd keys fingerprints from instance launched from a backup image[rhel-9]) - Resolves: bz#1971480 (Use systemdgenerators macro in spec file) --- ...emove-ssh_genkeytypes-in-settings.py.patch | 65 +++++++++++++++++++ cloud-init.spec | 22 +++++-- 2 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 ci-rhel-cloud.cfg-remove-ssh_genkeytypes-in-settings.py.patch diff --git a/ci-rhel-cloud.cfg-remove-ssh_genkeytypes-in-settings.py.patch b/ci-rhel-cloud.cfg-remove-ssh_genkeytypes-in-settings.py.patch new file mode 100644 index 0000000..b88a099 --- /dev/null +++ b/ci-rhel-cloud.cfg-remove-ssh_genkeytypes-in-settings.py.patch @@ -0,0 +1,65 @@ +From 5069e58c009bc8c689f00de35391ae6d860197a4 Mon Sep 17 00:00:00 2001 +From: Emanuele Giuseppe Esposito +Date: Thu, 20 May 2021 08:53:55 +0200 +Subject: [PATCH 1/2] rhel/cloud.cfg: remove ssh_genkeytypes in settings.py and + set in cloud.cfg + +RH-Author: Emanuele Giuseppe Esposito +RH-MergeRequest: 16: rhel/cloud.cfg: remove ssh_genkeytypes in settings.py and set in cloud.cfg +RH-Commit: [1/1] 67a4904f4d7918be4c9b3c3dbf340b3ecb9e8786 +RH-Bugzilla: 1970909 +RH-Acked-by: Mohamed Gamal Morsy +RH-Acked-by: Eduardo Otubo +RH-Acked-by: Vitaly Kuznetsov + +Currently genkeytypes in cloud.cfg is set to None, so together with +ssh_deletekeys=1 cloudinit on first boot it will just delete the existing +keys and not generate new ones. + +Just removing that property in cloud.cfg is not enough, because +settings.py provides another empty default value that will be used +instead, resulting to no key generated even when the property is not defined. + +Removing genkeytypes also in settings.py will default to GENERATE_KEY_NAMES, +but since we want only 'rsa', 'ecdsa' and 'ed25519', add back genkeytypes in +cloud.cfg with the above defaults. + +Also remove ssh_deletekeys in settings.py as we always need +to 1 (and it also defaults to 1). + +Signed-off-by: Emanuele Giuseppe Esposito +Signed-off-by: Miroslav Rezanina +--- + cloudinit/settings.py | 2 -- + rhel/cloud.cfg | 2 +- + 2 files changed, 1 insertion(+), 3 deletions(-) + +diff --git a/cloudinit/settings.py b/cloudinit/settings.py +index 43a1490c..2acf2615 100644 +--- a/cloudinit/settings.py ++++ b/cloudinit/settings.py +@@ -49,8 +49,6 @@ CFG_BUILTIN = { + 'def_log_file_mode': 0o600, + 'log_cfgs': [], + 'mount_default_fields': [None, None, 'auto', 'defaults,nofail', '0', '2'], +- 'ssh_deletekeys': False, +- 'ssh_genkeytypes': [], + 'syslog_fix_perms': [], + 'system_info': { + 'paths': { +diff --git a/rhel/cloud.cfg b/rhel/cloud.cfg +index 9ecba215..cbee197a 100644 +--- a/rhel/cloud.cfg ++++ b/rhel/cloud.cfg +@@ -7,7 +7,7 @@ ssh_pwauth: 0 + mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service', '0', '2'] + resize_rootfs_tmp: /dev + ssh_deletekeys: 1 +-ssh_genkeytypes: ~ ++ssh_genkeytypes: ['rsa', 'ecdsa', 'ed25519'] + syslog_fix_perms: ~ + disable_vmware_customization: false + +-- +2.27.0 + diff --git a/cloud-init.spec b/cloud-init.spec index 77e27ab..41b34c0 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -1,6 +1,6 @@ Name: cloud-init Version: 21.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Cloud instance init scripts License: ASL 2.0 or GPLv3 URL: http://launchpad.net/cloud-init @@ -10,6 +10,10 @@ Source1: cloud-init-tmpfiles.conf Patch0001: 0001-Add-initial-redhat-setup.patch Patch0002: 0002-Do-not-write-NM_CONTROLLED-no-in-generated-interface.patch Patch0003: 0003-limit-permissions-on-def_log_file.patch +# For bz#1970909 - [cloud-init] From RHEL 82+ cloud-init no longer displays sshd keys fingerprints from instance launched from a backup image[rhel-9] +Patch4: ci-rhel-cloud.cfg-remove-ssh_genkeytypes-in-settings.py.patch + +# Source-git patches BuildArch: noarch @@ -106,9 +110,9 @@ mv $RPM_BUILD_ROOT/etc/NetworkManager/dispatcher.d/hook-network-manager \ mkdir -p $RPM_BUILD_ROOT%{_unitdir} cp rhel/systemd/* $RPM_BUILD_ROOT%{_unitdir}/ -[ ! -d $RPM_BUILD_ROOT/usr/lib/systemd/system-generators ] && mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system-generators -python3 tools/render-cloudcfg --variant rhel systemd/cloud-init-generator.tmpl > $RPM_BUILD_ROOT/usr/lib/systemd/system-generators/cloud-init-generator -chmod 755 $RPM_BUILD_ROOT/usr/lib/systemd/system-generators/cloud-init-generator +[ ! -d $RPM_BUILD_ROOT%{_systemdgeneratordir} ] && mkdir -p $RPM_BUILD_ROOT%{_systemdgeneratordir} +python3 tools/render-cloudcfg --variant rhel systemd/cloud-init-generator.tmpl > $RPM_BUILD_ROOT%{_systemdgeneratordir}/cloud-init-generator +chmod 755 $RPM_BUILD_ROOT%{_systemdgeneratordir}/cloud-init-generator [ ! -d $RPM_BUILD_ROOT/usr/lib/%{name} ] && mkdir -p $RPM_BUILD_ROOT/usr/lib/%{name} cp -p tools/ds-identify $RPM_BUILD_ROOT%{_libexecdir}/%{name}/ds-identify @@ -195,13 +199,21 @@ fi %{_sysconfdir}/bash_completion.d/cloud-init %{_bindir}/cloud-id %{_libexecdir}/%{name}/ds-identify -/usr/lib/systemd/system-generators/cloud-init-generator +%{_systemdgeneratordir}/cloud-init-generator %dir %{_sysconfdir}/rsyslog.d %config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf %changelog +* Mon Jun 21 2021 Miroslav Rezanina - 21.1-2 +- ci-rhel-cloud.cfg-remove-ssh_genkeytypes-in-settings.py.patch [bz#1970909] +- ci-Use-_systemdgeneratordir-macro-for-cloud-init-genera.patch [bz#1971480] +- Resolves: bz#1970909 + ([cloud-init] From RHEL 82+ cloud-init no longer displays sshd keys fingerprints from instance launched from a backup image[rhel-9]) +- Resolves: bz#1971480 + (Use systemdgenerators macro in spec file) + * Thu Jun 10 2021 Miroslav Rezanina - 21.1-1 - Rebase to 21.1 [bz#1958209] - Resolves: bz#1958209