From e2c44d9b34bbb9f9882be808cc44b6d551d75edb Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 25 Sep 2026 07:53:26 -0400 Subject: [PATCH] build: Key the Secure Boot signing layers on the certificate Build secrets aren't part of the layer cache key, so the steps that sign systemd-boot and the UKIs can be served from cache after the test keys change: after `target/` is wiped and the keys regenerated, or from another checkout sharing the same container storage. The result is an image signed with a key the VM firmware doesn't trust, which fails to boot with "Access Denied" in a way that looks like a real Secure Boot bug. Copy the public certificate into each signing stage from a build context, and print its checksum when signing. Copied content is part of the cache key, so a different certificate rebuilds those steps. Only the certificate is copied; the private key stays a secret. Generated-by: AI Signed-off-by: Colin Walters --- Dockerfile | 8 ++++++++ Justfile | 4 +++- tmt/tests/Dockerfile.upgrade | 4 ++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 963ec12c7..c6b825dba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -251,6 +251,9 @@ EORUN # This image signs systemd-boot using our key, and writes the resulting binary into /out FROM tools as sdboot-signed +# The certificate is also a build secret, but secrets aren't part of the layer +# cache key. Copying it in makes the signing below rebuild when it changes. +COPY --from=secureboot db.crt /usr/lib/bootc-test/secureboot-db.crt # The secureboot key and cert are passed via Justfile # We write the signed binary into /out # Note: /out already contains systemd-boot-unsigned RPM from initialize-sealing-tools @@ -258,6 +261,7 @@ RUN --network=none --mount=type=tmpfs,target=/run --mount=type=tmpfs,target=/tmp --mount=type=secret,id=secureboot_key \ --mount=type=secret,id=secureboot_cert <