overlay wa-linux-agent: apply patch to fix ssh public key override issue

Apply patch to fix an issue when overriding ssh public key from ignition
configuration. Since the fix is not available in releases of
wa-linux-agent, we should apply a separate patch.

See also https://github.com/Azure/WALinuxAgent/pull/3309.
This commit is contained in:
Dongsu Park 2025-02-26 14:52:29 +01:00
parent 08ed0f3988
commit a87844c13f
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,26 @@
From 0c8db73c3567039e50ffa7447bb093ca812dedf6 Mon Sep 17 00:00:00 2001
Message-Id: <0c8db73c3567039e50ffa7447bb093ca812dedf6.1740577844.git.dpark@linux.microsoft.com>
From: Peyton Robertson <93797227+peytonr18@users.noreply.github.com>
Date: Tue, 28 Jan 2025 14:17:43 -0800
Subject: [PATCH] Applying patch to prevent ssh public key override (#3309)
---
azurelinuxagent/common/osutil/default.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/azurelinuxagent/common/osutil/default.py b/azurelinuxagent/common/osutil/default.py
index 584515dc..746c4363 100644
--- a/azurelinuxagent/common/osutil/default.py
+++ b/azurelinuxagent/common/osutil/default.py
@@ -346,7 +346,7 @@ GEN2_DEVICE_ID = 'f8b3781a-1e82-4818-a1c3-63d806ec15bb'
raise OSUtilError("Bad public key: {0}".format(value))
if not value.endswith("\n"):
value += "\n"
- fileutil.write_file(path, value)
+ fileutil.write_file(path, value, append=True)
elif thumbprint is not None:
lib_dir = conf.get_lib_dir()
crt_path = os.path.join(lib_dir, thumbprint + '.crt')
--
2.39.5

View File

@ -30,4 +30,5 @@ S="${WORKDIR}/WALinuxAgent-${PV}"
PATCHES=( PATCHES=(
"${FILESDIR}/0001-flatcar-changes.patch" "${FILESDIR}/0001-flatcar-changes.patch"
"${FILESDIR}/0002-prevent-ssh-public-key-override.patch"
) )