aports/main/lxc-templates-legacy/0005-lxc-alpine-remove-unverified-apk.static.patch
Kaarle Ritvanen 19b3f4211e main/lxc-templates-legacy: upgrade to 3.0.4
and align the patch set with the commit history of the upstream main
branch
2024-12-12 06:39:14 +00:00

37 lines
1.1 KiB
Diff

From bcbec3930926e4dc4c39625b3b571c516183e0a9 Mon Sep 17 00:00:00 2001
From: Kaarle Ritvanen <kunkku@alpinelinux.org>
Date: Tue, 10 Dec 2024 15:16:18 +0200
Subject: [PATCH 05/11] lxc-alpine: remove unverified apk.static
to prevent its execution on the next run
Signed-off-by: Kaarle Ritvanen <kunkku@alpinelinux.org>
---
templates/lxc-alpine.in | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in
index beadd53..37f6248 100644
--- a/templates/lxc-alpine.in
+++ b/templates/lxc-alpine.in
@@ -224,11 +224,14 @@ fetch_apk_static() {
local sigprefix=$apk.SIGN.RSA.
local keyfile=$(ls -1 "$sigprefix"alpine-*.pub 2>/dev/null | head -n 1)
- openssl dgst -sha1 \
+ if ! openssl dgst -sha1 \
-verify "$APK_KEYS_DIR/${keyfile#$sigprefix}" \
-signature "$keyfile" \
- "$apk" \
- || die 2 'Signature verification for apk.static failed'
+ "$apk"; then
+
+ rm -f "$apk"
+ die 2 'Signature verification for apk.static failed'
+ fi
# Note: apk doesn't return 0 for --version
local out=$("$apk" --version)
--
2.47.1