Skip to content

Conversation

@gerblesh
Copy link

Fixes systemd-boot signing, before the systemd-boot binary was signed on the buildroot but not on the target image, resulting in an unbootable image with secure boot enabled and the proper keys enrolled. This PR fixes it by first signing the systemd-boot on image (assumes it is installed), copying it over to the final image, then computing the digest, and then finally signing and creating the UKI with a different multi stage build. Definitely a little jank and #1498 does look like a better solution in the long term, however this at least gets the image in a bootable state on secure boot and allows for testing the secure boot in VMs. Would be happy to take a stab at proper image building UX but I'm not sure if that already has work done or if y'all have a particular vision in mind for the build system

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively addresses the systemd-boot signing issue for sealed images, which is a great step forward for secure boot testing. The introduction of a dedicated Dockerfile.sdboot for the signing process is a clean approach. My review includes a few suggestions to enhance the new Dockerfile's robustness and readability, and a note on a temporarily disabled lint check.

@gerblesh gerblesh force-pushed the sign-sdboot branch 2 times, most recently from 6bd32cd to 4ffe2f6 Compare December 1, 2025 16:23
@gerblesh
Copy link
Author

gerblesh commented Dec 1, 2025

added automatic key enrollment (with sdboot) in bootc install but one problem is that in Dockerfile.sdboot we need efitools for signing and preparing the certs for enrollment, which centos/RHEL doesn't seem to package. Let me know if it would also make sense to break out these changes (autoenrollment)

Copy link
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for starting this! Basically let's get the buildsystem rework in to properly sign systemd-boot first, and then look at the key autoenrollment as a distinct second step.

I can take a look at the first one, starting from the work here if you prefer!

Gareth Widlansky added 2 commits December 1, 2025 21:07
Signed-off-by: Gareth Widlansky <gareth.widlansky@proton.me>
Signed-off-by: Gareth Widlansky <gareth.widlansky@proton.me>
@gerblesh
Copy link
Author

gerblesh commented Dec 2, 2025

alright split out the code for autoenroll to just focus on signing systemd-boot in CI

@gerblesh
Copy link
Author

gerblesh commented Dec 2, 2025

#1818 new PR for auto enrollment here

certutil -N -d pesign --empty-password
openssl pkcs12 -export -password 'pass:' -inkey /run/secrets/key -in /run/secrets/cert -out db.p12
pk12util -i db.p12 -W '' -d pesign
subject=$(openssl x509 -in /run/secrets/cert -subject | grep '^subject=CN=' | sed 's/^subject=CN=//')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a second copy of this code isn't fatal, but I think we could factor out a shared helper for this too.

Copy link
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for starting this! Is it OK if I try some force pushing to this PR and we co-author?

@gerblesh
Copy link
Author

gerblesh commented Dec 2, 2025

Thanks again for starting this! Is it OK if I try some force pushing to this PR and we co-author?

Yeah go for it, just was cleaning up the comments and extra mounts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants