From cd2b81ea611662420ad87383955e94bc35d030b3 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Mon, 23 May 2022 05:17:33 -0400 Subject: [PATCH] import cloud-init-21.1-15.el8_6.1 --- ...-r-n-check-for-SSH-keys-in-Azure-889.patch | 62 +++++++++++++++++++ SPECS/cloud-init.spec | 9 ++- 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 SOURCES/ci-Add-r-n-check-for-SSH-keys-in-Azure-889.patch diff --git a/SOURCES/ci-Add-r-n-check-for-SSH-keys-in-Azure-889.patch b/SOURCES/ci-Add-r-n-check-for-SSH-keys-in-Azure-889.patch new file mode 100644 index 0000000..154b62e --- /dev/null +++ b/SOURCES/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/SPECS/cloud-init.spec b/SPECS/cloud-init.spec index 04b8907..c6648b8 100644 --- a/SPECS/cloud-init.spec +++ b/SPECS/cloud-init.spec @@ -6,7 +6,7 @@ Name: cloud-init Version: 21.1 -Release: 15%{?dist} +Release: 15%{?dist}.1 Summary: Cloud instance init scripts Group: System Environment/Base @@ -72,6 +72,8 @@ 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' @@ -271,6 +273,11 @@ fi %config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf %changelog +* 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] - ci-Fix-MIME-policy-failure-on-python-version-upgrade-93.patch [bz#1935826]