Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure file signing hook is run when initrd is rebuilt #271

Merged
merged 3 commits into from
Dec 23, 2023
Merged

Ensure file signing hook is run when initrd is rebuilt #271

merged 3 commits into from
Dec 23, 2023

Conversation

Joseph-DiGiovanni
Copy link
Contributor

@Joseph-DiGiovanni Joseph-DiGiovanni commented Dec 19, 2023

Initrd is rebuilt when a DKMS module or firmware package is installed or updated as of these commits to mkinitcpio: https://gitlab.archlinux.org/archlinux/mkinitcpio/mkinitcpio/-/commit/aff81712789b9f2c1664fe1cfb5c1ecdbc5c993b https://gitlab.archlinux.org/archlinux/mkinitcpio/mkinitcpio/-/commit/3576b03d29420ccd1913eaa18c7f8950e7de3103

Without this change, images created by mkinitcpio will not be automatically signed for secure boot in the events mentioned above.

@Joseph-DiGiovanni Joseph-DiGiovanni temporarily deployed to Build, sign, release binaries December 19, 2023 08:18 — with GitHub Actions Inactive
@Joseph-DiGiovanni Joseph-DiGiovanni temporarily deployed to Build, sign, release binaries December 19, 2023 08:18 — with GitHub Actions Inactive
@Joseph-DiGiovanni Joseph-DiGiovanni temporarily deployed to Build, sign, release binaries December 19, 2023 08:18 — with GitHub Actions Inactive
@agowa
Copy link

agowa commented Dec 20, 2023

How about also adding an initcpio hook? That way it it almost guaranteed to call sbctl every time when the kernel gets rebuilt. Regardless what triggered it (or if the user itself triggered it and forgot that they have to sign the kernel too, *not me*)

Also see #218

@Foxboron
Copy link
Owner

At that point I'd rather just deprecate the pacman hook and replace with kernel-install or mkinitcpio hooks.

@agowa
Copy link

agowa commented Dec 20, 2023

It doesn't hurt to have it. I kinda like have the "double protection" of two independent hooks making sure that the image is really signed. But yea, the pacman one is then basically completely useless...

@Joseph-DiGiovanni
Copy link
Contributor Author

I agree the mkinitcpio post hook is the way to go. However, I think the best solution is to just keep the sign-all command from the pacman hook rather than the hook making assumptions of what files should be signed.

This should close #263 and #218.

@Foxboron
Copy link
Owner

Actually, I realized this would be a bad idea, maybe.

We do sign more then just the initrd. Namely things like sd-boot and fwudpmgr. And I'm not sure if signing those as part of a post-hook in mkinitcpio makes sense?

@Joseph-DiGiovanni
Copy link
Contributor Author

Good point. So we should keep both. For the sake of not breaking anything we should keep it as is with the exception of the usr/lib/initcpio/* target and my other additions. It will attempt to sign twice most of the time but this is preferable to not signing at all.

@agowa
Copy link

agowa commented Dec 21, 2023

And I'm not sure if signing those as part of a post-hook in mkinitcpio makes sense?

It doesn't hurt and sbctl noops already if these files are already signed.

I'd say still stick with it is better to have a potentially useless pacman hook in addition to the initcpio one than risking a non bootable system because of unforeseen circumstances....

contrib/mkinitcpio/sbctl Outdated Show resolved Hide resolved
Copy link
Owner

@Foxboron Foxboron left a comment

Choose a reason for hiding this comment

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

lgtm

Co-authored-by: Morten Linderud <morten@linderud.pw>
@Foxboron
Copy link
Owner

Thanks!

@Joseph-DiGiovanni Joseph-DiGiovanni temporarily deployed to Build, sign, release binaries December 22, 2023 14:13 — with GitHub Actions Inactive
@Joseph-DiGiovanni Joseph-DiGiovanni temporarily deployed to Build, sign, release binaries December 22, 2023 14:13 — with GitHub Actions Inactive
@Joseph-DiGiovanni Joseph-DiGiovanni temporarily deployed to Build, sign, release binaries December 22, 2023 14:13 — with GitHub Actions Inactive
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.

None yet

3 participants