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

Secure boot enabled systems booting in user mode are unable to boot default bootloader in flasher images #3140

Open
jakogut opened this issue May 17, 2023 · 0 comments

Comments

@jakogut
Copy link
Contributor

jakogut commented May 17, 2023

Secure boot enabled systems can enroll a provisioning key (PK), key exchange key (KEK), and key database (db, dbx) for whitelisted/blacklisted binaries to boot respectively.

Flasher images ship both an insecure bootloader image that does not validate signatures of modules, configuration, and binaries, as well as a secure bootloader image that does. Only the hash of the secured bootloader image is present in the db, so a system booting in user mode with keys enrolled will only boot the secured bootloader.

When flashing a system in setup mode, the insecure bootloader image is loaded from the EFI system partition (ESP) at the default path for the platform (/EFI/BOOT/bootx64.efi for x86-64). When the flasher runs, it attempts to enroll keys automatically using efi-updatevar. If this succeeds, the next boot will be in user mode. The firmware will verify the bootloader, the bootloader will verify configs, modules, and binaries (including the kernel and initramfs), and the kernel will boot in lockdown mode, verifying module signatures.

If the flasher is unable to automatically enroll keys due to a firmware quirk or inability to enter UEFI secure boot setup mode, keys may need to be enrolled manually. The process for doing this is firmware and platform specific, but generally the PK, KEK, and db keys from the flasher boot partition (/balena-keys) need to be manually enrolled in the setup menu.

After doing this, the system should boot next in user mode, and will not boot binaries that do not validate against the key database. This will prevent the flasher image from booting, as the default EFI binary path will not be present in db.

A workaround for this is to modify the flasher boot media to move the secure bootloader variant to the default EFI bootloader path.

More information on secure boot keys and behavior here.

@jakogut jakogut changed the title Secure boot enabled systems booting in user mode are unable to boot insecure bootloader in flasher images Secure boot enabled systems booting in user mode are unable to boot default bootloader in flasher images May 17, 2023
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

No branches or pull requests

1 participant