diff options
| author | Hitendra Prajapati <hprajapati@mvista.com> | 2025-08-20 13:51:09 +0530 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2025-09-03 21:10:45 -0400 |
| commit | 5429fc0f5c2ebd7187e54913220f579417fcbaed (patch) | |
| tree | 7202722d23d043df1e774593dd9cf1cd59798c73 | |
| parent | 3e4dba95e6b5f5f68d0b3a5899b106c89da59428 (diff) | |
| download | meta-virtualization-5429fc0f5c2ebd7187e54913220f579417fcbaed.tar.gz | |
cloud-init: fix for CVE-2024-6174
Upstream-Status: Backport from https://github.com/canonical/cloud-init/commit/f43937f0b462734eb9c76700491c18fe4133c8e1
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
| -rw-r--r-- | recipes-extended/cloud-init/cloud-init/CVE-2024-6174.patch | 103 | ||||
| -rw-r--r-- | recipes-extended/cloud-init/cloud-init_21.4.bb | 1 |
2 files changed, 104 insertions, 0 deletions
diff --git a/recipes-extended/cloud-init/cloud-init/CVE-2024-6174.patch b/recipes-extended/cloud-init/cloud-init/CVE-2024-6174.patch new file mode 100644 index 00000000..797155ce --- /dev/null +++ b/recipes-extended/cloud-init/cloud-init/CVE-2024-6174.patch | |||
| @@ -0,0 +1,103 @@ | |||
| 1 | From f43937f0b462734eb9c76700491c18fe4133c8e1 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Brett Holman <brett.holman@canonical.com> | ||
| 3 | Date: Thu, 22 Aug 2024 16:54:53 -0600 | ||
| 4 | Subject: [PATCH] fix: Don't attempt to identify non-x86 OpenStack instances | ||
| 5 | |||
| 6 | This causes cloud-init to attempt to reach out to the OpenStack Nova | ||
| 7 | datasource in non-Nova deployments on non-x86 architectures. | ||
| 8 | |||
| 9 | Change default policy of ds-identify to disallow discovery of datasources | ||
| 10 | without strict identifiable artifacts in either kernel cmdline, DMI | ||
| 11 | platform information or system configuration files. This prevents | ||
| 12 | cloud-init from attempting to reach out to well-known hard-codded link-local | ||
| 13 | IP addresses for configuration information unless the platform strictly | ||
| 14 | identifies as a specific datasource. | ||
| 15 | |||
| 16 | CVE-2024-6174 | ||
| 17 | LP: #2069607 | ||
| 18 | BREAKING_CHANGE: This may break non-x86 OpenStack Nova users. Affected users | ||
| 19 | may wish to use ConfigDrive as a workaround. | ||
| 20 | |||
| 21 | CVE: CVE-2024-6174 | ||
| 22 | Upstream-Status: Backport [https://github.com/canonical/cloud-init/commit/f43937f0b462734eb9c76700491c18fe4133c8e1] | ||
| 23 | Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com> | ||
| 24 | --- | ||
| 25 | tests/unittests/test_ds_identify.py | 13 ++++++------- | ||
| 26 | tools/ds-identify | 8 ++++---- | ||
| 27 | 2 files changed, 10 insertions(+), 11 deletions(-) | ||
| 28 | |||
| 29 | diff --git a/tests/unittests/test_ds_identify.py b/tests/unittests/test_ds_identify.py | ||
| 30 | index f2d2b4949..aaa6999e1 100644 | ||
| 31 | --- a/tests/unittests/test_ds_identify.py | ||
| 32 | +++ b/tests/unittests/test_ds_identify.py | ||
| 33 | @@ -57,9 +57,9 @@ BLKID_UEFI_UBUNTU = [ | ||
| 34 | |||
| 35 | |||
| 36 | POLICY_FOUND_ONLY = "search,found=all,maybe=none,notfound=disabled" | ||
| 37 | -POLICY_FOUND_OR_MAYBE = "search,found=all,maybe=all,notfound=disabled" | ||
| 38 | -DI_DEFAULT_POLICY = "search,found=all,maybe=all,notfound=disabled" | ||
| 39 | -DI_DEFAULT_POLICY_NO_DMI = "search,found=all,maybe=all,notfound=enabled" | ||
| 40 | +POLICY_FOUND_OR_MAYBE = "search,found=all,maybe=none,notfound=disabled" | ||
| 41 | +DI_DEFAULT_POLICY = "search,found=all,maybe=none,notfound=disabled" | ||
| 42 | +DI_DEFAULT_POLICY_NO_DMI = "search,found=all,maybe=none,notfound=enabled" | ||
| 43 | DI_EC2_STRICT_ID_DEFAULT = "true" | ||
| 44 | OVF_MATCH_STRING = "http://schemas.dmtf.org/ovf/environment/1" | ||
| 45 | |||
| 46 | @@ -533,7 +533,7 @@ class TestDsIdentify(DsIdentifyBase): | ||
| 47 | self._test_ds_found("OpenStack-AssetTag-Compute") | ||
| 48 | |||
| 49 | def test_openstack_on_non_intel_is_maybe(self): | ||
| 50 | - """On non-Intel, openstack without dmi info is maybe. | ||
| 51 | + """On non-Intel, openstack without dmi info is none. | ||
| 52 | |||
| 53 | nova does not identify itself on platforms other than intel. | ||
| 54 | https://bugs.launchpad.net/cloud-init/+bugs?field.tag=dsid-nova""" | ||
| 55 | @@ -553,10 +553,9 @@ class TestDsIdentify(DsIdentifyBase): | ||
| 56 | |||
| 57 | # updating the uname to ppc64 though should get a maybe. | ||
| 58 | data.update({"mocks": [MOCK_VIRT_IS_KVM, MOCK_UNAME_IS_PPC64]}) | ||
| 59 | - (_, _, err, _, _) = self._check_via_dict( | ||
| 60 | - data, RC_FOUND, dslist=["OpenStack", "None"] | ||
| 61 | - ) | ||
| 62 | + (_, _, err, _, _) = self._check_via_dict(data, RC_NOT_FOUND) | ||
| 63 | self.assertIn("check for 'OpenStack' returned maybe", err) | ||
| 64 | + self.assertIn("No ds found", err) | ||
| 65 | |||
| 66 | def test_default_ovf_is_found(self): | ||
| 67 | """OVF is identified found when ovf/ovf-env.xml seed file exists.""" | ||
| 68 | diff --git a/tools/ds-identify b/tools/ds-identify | ||
| 69 | index 30d4b0f65..4dd0b5fcf 100755 | ||
| 70 | --- a/tools/ds-identify | ||
| 71 | +++ b/tools/ds-identify | ||
| 72 | @@ -14,7 +14,7 @@ | ||
| 73 | # The format is: | ||
| 74 | # <mode>,found=value,maybe=value,notfound=value | ||
| 75 | # default setting is: | ||
| 76 | -# search,found=all,maybe=all,notfound=disabled | ||
| 77 | +# search,found=all,maybe=none,notfound=disabled | ||
| 78 | # | ||
| 79 | # kernel command line option: ci.di.policy=<policy> | ||
| 80 | # example line in /etc/cloud/ds-identify.cfg: | ||
| 81 | @@ -40,7 +40,7 @@ | ||
| 82 | # first: use the first found do no further checking | ||
| 83 | # all: enable all DS_FOUND | ||
| 84 | # | ||
| 85 | -# maybe: (default=all) | ||
| 86 | +# maybe: (default=none) | ||
| 87 | # if nothing returned 'found', then how to handle maybe. | ||
| 88 | # no network sources are allowed to return 'maybe'. | ||
| 89 | # all: enable all DS_MAYBE | ||
| 90 | @@ -94,8 +94,8 @@ DI_MAIN=${DI_MAIN:-main} | ||
| 91 | |||
| 92 | DI_BLKID_EXPORT_OUT="" | ||
| 93 | DI_GEOM_LABEL_STATUS_OUT="" | ||
| 94 | -DI_DEFAULT_POLICY="search,found=all,maybe=all,notfound=${DI_DISABLED}" | ||
| 95 | -DI_DEFAULT_POLICY_NO_DMI="search,found=all,maybe=all,notfound=${DI_ENABLED}" | ||
| 96 | +DI_DEFAULT_POLICY="search,found=all,maybe=none,notfound=${DI_DISABLED}" | ||
| 97 | +DI_DEFAULT_POLICY_NO_DMI="search,found=all,maybe=none,notfound=${DI_ENABLED}" | ||
| 98 | DI_DMI_CHASSIS_ASSET_TAG="" | ||
| 99 | DI_DMI_PRODUCT_NAME="" | ||
| 100 | DI_DMI_SYS_VENDOR="" | ||
| 101 | -- | ||
| 102 | 2.50.1 | ||
| 103 | |||
diff --git a/recipes-extended/cloud-init/cloud-init_21.4.bb b/recipes-extended/cloud-init/cloud-init_21.4.bb index 5cb62272..02a89a58 100644 --- a/recipes-extended/cloud-init/cloud-init_21.4.bb +++ b/recipes-extended/cloud-init/cloud-init_21.4.bb | |||
| @@ -9,6 +9,7 @@ SRC_URI = "git://github.com/canonical/cloud-init;branch=main;protocol=https \ | |||
| 9 | file://cloud-init-source-local-lsb-functions.patch \ | 9 | file://cloud-init-source-local-lsb-functions.patch \ |
| 10 | file://0001-setup.py-check-for-install-anywhere-in-args.patch \ | 10 | file://0001-setup.py-check-for-install-anywhere-in-args.patch \ |
| 11 | file://0001-setup.py-respect-udevdir-variable.patch \ | 11 | file://0001-setup.py-respect-udevdir-variable.patch \ |
| 12 | file://CVE-2024-6174.patch \ | ||
| 12 | " | 13 | " |
| 13 | 14 | ||
| 14 | S = "${WORKDIR}/git" | 15 | S = "${WORKDIR}/git" |
