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

T861: add UEFI Secure Boot support #763

Merged
merged 13 commits into from
Sep 16, 2024
Merged

Conversation

c-po
Copy link
Member

@c-po c-po commented Sep 14, 2024

Change Summary

This adds support for UEFI Secure Boot. It adds the missing pieces to the Linux Kernel and enforces module signing. This results in an additional security layer where untrusted (unsigned) Kernel modules can no longer be loaded into the live system.

NOTE: This commit will not work unless signing keys are present.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Related PR(s)

How to test

You can see in a Kernel log if keys are embedded by searching for Loaded X.509

Loaded X.509 cert 'VyOS Secure Boot Signer 2024 - linux: 3a81127b8ffefa011cfa6e368d2575a45804f8d6'
Loaded X.509 cert 'VyOS Secure Boot CA: 4f8da9e85197d36ce6cf61ef31731f0e0c1aa4ef'

Arbitrary keys can be generated using

CA

Create Certificate Authority used for Kernel signing. CA is loaded into the
Machine Owner Key store on the target system.

openssl req -new -x509 -newkey rsa:2048 -keyout MOK.key -outform DER -out MOK.der -days 36500 -subj "/CN=VyOS Secure Boot CA/" -nodes
openssl x509 -inform der -in MOK.der -out MOK.pem

Kernel Module Signing Key

We do not make use of ephemeral keys for Kernel module signing. Instead a key
is generated and signed by the VyOS Secure Boot CA which signs all the Kernel
modules during ISO assembly if present.

openssl req -newkey rsa:2048 -keyout kernel.key -out kernel.csr -subj "/CN=VyOS Secure Boot Signer 2024 - linux/" -nodes
openssl x509 -req -in kernel.csr -CA MOK.pem -CAkey MOK.key -CAcreateserial -out kernel.pem -days 730 -sha256

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

When moving to UEFI and secure-boot it's better to just reboot the system
for Machine Owner Key installation, then powercycling the machine.

This commit will use `reboot now` over `poweroff` after base system installation
and boot into installed image for smoketest handling.
To use VNC you could run "make test -- --vnc"
…e disks

This is required to support proper disk ejection and not reloading the disk on
system reboot when operation in BIOS mode.
In the past the CLI based smoketest was always executed under an else branch in
the testcase if-statement. Instead of using negative logic move all testcases
to positive logic adding an empty "catch all" else path.
Copy link

github-actions bot commented Sep 14, 2024

👍
No issues in PR Title / Commit Title

This adds support for UEFI Secure Boot. It adds the missing pieces to the Linux
Kernel and enforces module signing. This results in an additional security
layer where untrusted (unsigned) Kernel modules can no longer be loaded into
the live system.

NOTE: This commit will not work unless signing keys are present. Arbitrary
keys can be generated using instructions found in:

  data/live-build-config/includes.chroot/var/lib/shim-signed/mok/README.md
Rise upper limit for UID when working in an Active Direcotry integrated
environment. This solves the warning: vyos_bld's uid 1632000007 outside of the
UID_MIN 1000 and UID_MAX 60000 range.
@sever-sever sever-sever merged commit 5255ad1 into vyos:current Sep 16, 2024
10 checks passed
@c-po c-po deleted the secure-boot branch September 16, 2024 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

4 participants