From f93cebdb61651e000f050f92999dda312fffa017 Mon Sep 17 00:00:00 2001 From: renbo02 Date: Tue, 24 May 2022 10:24:40 +0800 Subject: [PATCH 1/2] update to cloud-init-21.1-15.el8_6.1 Signed-off-by: renbo02 --- ...-r-n-check-for-SSH-keys-in-Azure-889.patch | 62 +++++++++++++++++++ cloud-init-anolis-user.patch | 25 -------- cloud-init.spec | 12 ++-- 3 files changed, 69 insertions(+), 30 deletions(-) create mode 100644 ci-Add-r-n-check-for-SSH-keys-in-Azure-889.patch delete mode 100644 cloud-init-anolis-user.patch diff --git a/ci-Add-r-n-check-for-SSH-keys-in-Azure-889.patch b/ci-Add-r-n-check-for-SSH-keys-in-Azure-889.patch new file mode 100644 index 0000000..154b62e --- /dev/null +++ b/ci-Add-r-n-check-for-SSH-keys-in-Azure-889.patch @@ -0,0 +1,62 @@ +From f73d2460e5ad205a1cd2d74a73c2d1308265d9f9 Mon Sep 17 00:00:00 2001 +From: Miroslav Rezanina +Date: Wed, 18 May 2022 05:23:48 -0400 +Subject: [PATCH] Add \r\n check for SSH keys in Azure (#889) + +RH-Author: Miroslav Rezanina +RH-MergeRequest: 64: Properly handle \r\n in SSH keys in Azure +RH-Commit: [1/1] c0868258fd63f6c531acd8da81e0494a8412d5ea (mrezanin/src_rhel_cloud-init) +RH-Bugzilla: 2088028 +RH-Acked-by: xiachen +RH-Acked-by: Eduardo Otubo +RH-Acked-by: Emanuele Giuseppe Esposito + +See https://bugs.launchpad.net/cloud-init/+bug/1910835 + +(cherry picked from commit f17f78fa9d28e62793a5f2c7109fc29eeffb0c89) +Signed-off-by: Miroslav Rezanina +--- + cloudinit/sources/DataSourceAzure.py | 3 +++ + tests/unittests/test_datasource/test_azure.py | 12 ++++++++++++ + 2 files changed, 15 insertions(+) + +diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py +index a66f023d..247284ad 100755 +--- a/cloudinit/sources/DataSourceAzure.py ++++ b/cloudinit/sources/DataSourceAzure.py +@@ -1551,6 +1551,9 @@ def _key_is_openssh_formatted(key): + """ + Validate whether or not the key is OpenSSH-formatted. + """ ++ # See https://bugs.launchpad.net/cloud-init/+bug/1910835 ++ if '\r\n' in key.strip(): ++ return False + + parser = ssh_util.AuthKeyLineParser() + try: +diff --git a/tests/unittests/test_datasource/test_azure.py b/tests/unittests/test_datasource/test_azure.py +index f8433690..742d1faa 100644 +--- a/tests/unittests/test_datasource/test_azure.py ++++ b/tests/unittests/test_datasource/test_azure.py +@@ -1764,6 +1764,18 @@ scbus-1 on xpt0 bus 0 + self.assertEqual(ssh_keys, ["ssh-rsa key1"]) + self.assertEqual(m_parse_certificates.call_count, 0) + ++ def test_key_without_crlf_valid(self): ++ test_key = 'ssh-rsa somerandomkeystuff some comment' ++ assert True is dsaz._key_is_openssh_formatted(test_key) ++ ++ def test_key_with_crlf_invalid(self): ++ test_key = 'ssh-rsa someran\r\ndomkeystuff some comment' ++ assert False is dsaz._key_is_openssh_formatted(test_key) ++ ++ def test_key_endswith_crlf_valid(self): ++ test_key = 'ssh-rsa somerandomkeystuff some comment\r\n' ++ assert True is dsaz._key_is_openssh_formatted(test_key) ++ + @mock.patch( + 'cloudinit.sources.helpers.azure.OpenSSLManager.parse_certificates') + @mock.patch(MOCKPATH + 'get_metadata_from_imds') +-- +2.31.1 + diff --git a/cloud-init-anolis-user.patch b/cloud-init-anolis-user.patch deleted file mode 100644 index f8937f4..0000000 --- a/cloud-init-anolis-user.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 6bc781889769414e715317de72b2d558afe0e270 Mon Sep 17 00:00:00 2001 -From: Chunmei Xu -Date: Wed, 20 Apr 2022 04:02:19 -0400 -Subject: [PATCH] cloud-init anolis user - ---- - rhel/cloud.cfg | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/rhel/cloud.cfg b/rhel/cloud.cfg -index cbee197..d6133fb 100644 ---- a/rhel/cloud.cfg -+++ b/rhel/cloud.cfg -@@ -54,7 +54,7 @@ cloud_final_modules: - - system_info: - default_user: -- name: cloud-user -+ name: anolis - lock_passwd: true - gecos: Cloud User - groups: [adm, systemd-journal] --- -2.27.0 - diff --git a/cloud-init.spec b/cloud-init.spec index 05a2b5d..c6648b8 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -1,4 +1,3 @@ -%define anolis_release .0.1 %{!?license: %global license %%doc} # The only reason we are archful is because dmidecode is ExclusiveArch @@ -7,7 +6,7 @@ Name: cloud-init Version: 21.1 -Release: 15%{anolis_release}%{?dist} +Release: 15%{?dist}.1 Summary: Cloud instance init scripts Group: System Environment/Base @@ -73,9 +72,10 @@ Patch31: ci-Fix-IPv6-netmask-format-for-sysconfig-1215.patch Patch32: ci-Detect-a-Python-version-change-and-clear-the-cache-8.patch # For bz#1935826 - [rhel-8] Cloud-init init stage fails after upgrade from RHEL7 to RHEL8. Patch33: ci-Fix-MIME-policy-failure-on-python-version-upgrade-93.patch +# For bz#2088028 - [RHEL-8.7] SSH keys with \r\n line breaks are not properly handled on Azure [rhel-8.6.0.z] +Patch34: ci-Add-r-n-check-for-SSH-keys-in-Azure-889.patch # For bz#2026587 - [cloud-init][RHEL8] Support for cloud-init datasource 'cloud-init-vmware-guestinfo' -Patch9999: cloud-init-anolis-user.patch BuildArch: noarch @@ -273,8 +273,10 @@ fi %config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf %changelog -* Fri May 13 2022 Liwei Ge - 21.1-15.0.1 -- Rebrand to Anolis OS +* Wed May 18 2022 Miroslav Rezanina - 21.1-15.el8_6.1 +- ci-Add-r-n-check-for-SSH-keys-in-Azure-889.patch [bz#2088028] +- Resolves: bz#2088028 + ([RHEL-8.7] SSH keys with \r\n line breaks are not properly handled on Azure [rhel-8.6.0.z]) * Fri Apr 01 2022 Camilla Conte - 21.1-15 - ci-Detect-a-Python-version-change-and-clear-the-cache-8.patch [bz#1935826] -- Gitee From c2ca3017d6bfecb51091017e48acd7997f297925 Mon Sep 17 00:00:00 2001 From: pangqing Date: Thu, 21 Apr 2022 15:27:53 +0800 Subject: [PATCH 2/2] rebrand: init anolis user Signed-off-by: Liwei Ge --- cloud-init-anolis-user.patch | 25 +++++++++++++++++++++++++ cloud-init.spec | 7 ++++++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 cloud-init-anolis-user.patch diff --git a/cloud-init-anolis-user.patch b/cloud-init-anolis-user.patch new file mode 100644 index 0000000..f8937f4 --- /dev/null +++ b/cloud-init-anolis-user.patch @@ -0,0 +1,25 @@ +From 6bc781889769414e715317de72b2d558afe0e270 Mon Sep 17 00:00:00 2001 +From: Chunmei Xu +Date: Wed, 20 Apr 2022 04:02:19 -0400 +Subject: [PATCH] cloud-init anolis user + +--- + rhel/cloud.cfg | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/rhel/cloud.cfg b/rhel/cloud.cfg +index cbee197..d6133fb 100644 +--- a/rhel/cloud.cfg ++++ b/rhel/cloud.cfg +@@ -54,7 +54,7 @@ cloud_final_modules: + + system_info: + default_user: +- name: cloud-user ++ name: anolis + lock_passwd: true + gecos: Cloud User + groups: [adm, systemd-journal] +-- +2.27.0 + diff --git a/cloud-init.spec b/cloud-init.spec index c6648b8..4802036 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -1,3 +1,4 @@ +%define anolis_release .0.1 %{!?license: %global license %%doc} # The only reason we are archful is because dmidecode is ExclusiveArch @@ -6,7 +7,7 @@ Name: cloud-init Version: 21.1 -Release: 15%{?dist}.1 +Release: 15%{anolis_release}%{?dist}.1 Summary: Cloud instance init scripts Group: System Environment/Base @@ -76,6 +77,7 @@ Patch33: ci-Fix-MIME-policy-failure-on-python-version-upgrade-93.patch Patch34: ci-Add-r-n-check-for-SSH-keys-in-Azure-889.patch # For bz#2026587 - [cloud-init][RHEL8] Support for cloud-init datasource 'cloud-init-vmware-guestinfo' +Patch9999: cloud-init-anolis-user.patch BuildArch: noarch @@ -273,6 +275,9 @@ fi %config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf %changelog +* Tue May 24 2022 Liwei Ge - 21.1-15.0.1.1 +- Rebrand to Anolis OS + * Wed May 18 2022 Miroslav Rezanina - 21.1-15.el8_6.1 - ci-Add-r-n-check-for-SSH-keys-in-Azure-889.patch [bz#2088028] - Resolves: bz#2088028 -- Gitee