1
0
mirror of https://github.com/lxc/lxc-templates.git synced 2024-12-22 14:30:31 +00:00

lxc-alpine: more specific SHA1 sig file match

that avoids matching the SHA256 file

Signed-off-by: Kaarle Ritvanen <kunkku@alpinelinux.org>
This commit is contained in:
Kaarle Ritvanen 2024-12-10 15:16:15 +02:00
parent 7c3b65b0ef
commit 7ff9ef0c48

View File

@ -222,10 +222,11 @@ fetch_apk_static() {
local apk=$dest/sbin/apk.static local apk=$dest/sbin/apk.static
[ -s "$apk" ] || die 2 'apk.static not found' [ -s "$apk" ] || die 2 'apk.static not found'
local keyname=$(echo "$apk".*.pub | sed 's/.*\.SIGN\.RSA\.//') local sigprefix=$apk.SIGN.RSA.
local keyfile=$(ls -1 "$sigprefix"alpine-*.pub 2>/dev/null | head -n 1)
openssl dgst -sha1 \ openssl dgst -sha1 \
-verify "$APK_KEYS_DIR/$keyname" \ -verify "$APK_KEYS_DIR/${keyfile#$sigprefix}" \
-signature "$dest/sbin/apk.static.SIGN.RSA.$keyname" \ -signature "$keyfile" \
"$apk" \ "$apk" \
|| die 2 'Signature verification for apk.static failed' || die 2 'Signature verification for apk.static failed'