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

feat: use cached kernel #605

Merged
merged 11 commits into from
Jul 12, 2024
Merged

feat: use cached kernel #605

merged 11 commits into from
Jul 12, 2024

Conversation

m2Giles
Copy link
Member

@m2Giles m2Giles commented Jul 11, 2024

Thank you for contributing to the Universal Blue project!

Please read the Contributor's Guide before submitting a pull request.

@m2Giles m2Giles requested a review from castrojo as a code owner July 11, 2024 23:08
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request labels Jul 11, 2024
@bsherman bsherman marked this pull request as draft July 12, 2024 01:48
@bsherman
Copy link
Contributor

I built a local image pushed to local registry to test the approach of direct replacing the signed vmlinuz file.

This main kernel, as provided by kernel-cache repo, has 3 signatures:

  • upstream fedora
  • ublue akmods (our traditional akmods sig)
  • ublue kernel (new sig to align with full kernel signing and Fedora 41 release)

Note: non-main kernels are not "Fedora Official" so we strip any signatures from them and they will only have the latter 2.

Output to verify above:

herman@fedora:~$ sbverify --list /usr/lib/modules/6.9.7-200.fc40.x86_64/vmlinuz 
signature 1
image signature issuers:
 - /C=US/ST=Massachusetts/L=Cambridge/O=Red Hat, Inc./OU=Fedora Secure Boot CA 20200709/CN=fedoraca
image signature certificates:
 - subject: /C=US/ST=Massachusetts/L=Cambridge/O=Red Hat, Inc./OU=Fedora Secure Boot Signer/OU=bkernel01 kernel/CN=kernel-signer
   issuer:  /C=US/ST=Massachusetts/L=Cambridge/O=Red Hat, Inc./OU=Fedora Secure Boot CA 20200709/CN=fedoraca
signature 2
image signature issuers:
 - /O=Universal Blue/OU=kernel signing/CN=ublue kernel/[email protected]
image signature certificates:
 - subject: /O=Universal Blue/OU=kernel signing/CN=ublue kernel/[email protected]
   issuer:  /O=Universal Blue/OU=kernel signing/CN=ublue kernel/[email protected]
signature 3
image signature issuers:
 - /O=Universal Blue/OU=akmods/[email protected]/L=None/ST=None/C=XX/CN=ublue akmods 
image signature certificates:
 - subject: /O=Universal Blue/OU=akmods/[email protected]/L=None/ST=None/C=XX/CN=ublue akmods 
   issuer:  /O=Universal Blue/OU=akmods/[email protected]/L=None/ST=None/C=XX/CN=ublue akmods 

Observations:

  1. kernel boots with SecureBoot disabled
  2. kernel fails to boot with SecureBoot enabled if a ublue MOK NOT enrolled (qemu kvm uefi, lacking Microsoft key)
  3. kernel boots with SecureBoot enabled if a ublue MOK NOT enrolled (on physical hardware with Microsoft key)
  4. kernel boots with SecureBoot enabled if ublue akmods MOK is enrolled (qemu kvm uefi, lacking Microsoft key)
  5. can rebase to another image, and rollback to image with this custom signed kernel, booting still works

All this seems good... yes, the process feels a bit janky, but it works.

@bsherman
Copy link
Contributor

Next step as discussed with @m2Giles:

Add support to install.sh such that, if the kernel-cache (and thus akmods) provides a different kernel version than what is on the building image, we'll do an rpm-ostree override replace to the kernel-cache RPMs.

But for identically matching kernels, the rpm-ostree override replace fails to work (since the RPMs are otherwise identical), and in that case we'll just replace the vmlinuz file with our signed copy.

I'm waiting for this to be solid here, then I'll use this approach on uCore, too.

@m2Giles m2Giles marked this pull request as ready for review July 12, 2024 15:53
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 12, 2024
@m2Giles m2Giles enabled auto-merge July 12, 2024 16:02
@m2Giles m2Giles requested review from KyleGospo, EyeCantCU and p5 July 12, 2024 21:08
@m2Giles m2Giles added this pull request to the merge queue Jul 12, 2024
Merged via the queue into main with commit a7af108 Jul 12, 2024
18 checks passed
@m2Giles m2Giles deleted the cache-kernel branch July 12, 2024 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants