secure boot for nixos ~ personal fork
Go to file
Julian Stecklina 16d40d702d
Merge pull request #52 from nix-community/pre-commit
Switch to flake-parts
2023-01-08 10:10:02 +01:00
docs documentation: add a simple quick start 2022-12-25 18:16:14 +01:00
nix lanzatool: generate custom os-release 2023-01-06 21:27:51 +01:00
pki nixos: add a lanzaboote module 2022-11-24 17:07:05 +01:00
rust lanzatool: spell specialised consistently 2023-01-06 23:20:31 +01:00
.envrc Initial import of Rust files 2022-11-21 12:31:23 +01:00
.gitignore .gitignore.nix: block result* in subdirectories too 2022-11-23 00:20:27 +01:00
LICENSE Add GPLv3 license 2022-11-26 03:12:24 +01:00
README.md fix: typo in README.md 2023-01-07 12:21:41 +00:00
default.nix chore: support non-flake users 2022-12-26 01:22:34 +01:00
flake.lock flake.lock: Update 2023-01-07 20:25:04 +01:00
flake.nix flake: move attributes over to flake-parts 2023-01-07 20:25:04 +01:00

README.md

Lanzaboote: Secure Boot for NixOS

Chat on Matrix GitHub branch checks state made-with-rust GitHub

This repository contains tooling for UEFI Secure Boot on NixOS. The goal is to make Secure Boot available from nixpkgs for any platform that supports UEFI.

Quickstart

If you want to try this out, head over here for instructions.

🪛 Get Involved 🪛

There is still a bunch of work to do before this work can be upstreamed into nixpkgs. Please coordinate in the Matrix room or check the issues, if you want to take something up.

Overview

Secure Boot

The goal of UEFI Secure Boot is to allow only trusted operating systems to boot on a system. This can be used to defend against certain classes of attacks that compromise the boot flow of a system. For example, an attacker will have difficulty replacing the Linux kernel that boots a system when Secure Boot is active.

UEFI Secure Boot works by digitally signing all drivers, bootloaders, the Linux kernel and its initrd. This establishes a chain of trust where one trusted component only hands off control to the next part of the boot flow when the integrity of the chain is cryptographically validated.

Caveats

There are some additional steps that are required to make UEFI Secure Boot effective:

  • There must be a BIOS password or a similar restriction that prevents unauthorized changes to the Secure Boot policy.
  • The booted system must have some form of integrity protection.
  • The firmware must be kept up-to-date.

These steps will not be covered here.

Lanzatool

At the moment, boot loaders, kernels and initrds on NixOS are signed on the current system. These then need to be prepared as Unified Kernel Images (UKI) and placed on the EFI System Partition (ESP).

lanzatool is a Linux command line application that takes care of this flow. It takes a NixOS bootspec document, signs the relevant files, creates a UKI using lanzaboote (see below) and installs the UKI along with other required files to the ESP. lanzatool is also aware of multiple NixOS generations and will sign all configurations that should be bootable.

Lanzaboote

When the Linux kernel and initrd are packed into a UKI, they need an UEFI application stub. This role is typically filled by systemd-stub.

The downside of systemd-stub is that it requires the kernel and initrd to be packed into the UKI, which makes it pretty large. As we need one UKI per NixOS configuration, systems with many configurations quickly run out of the limited disk space in the ESP.

lanzaboote is a UEFI stub that solves the same problem as systemd-stub, but allows kernel and initrd to be stored separately on the ESP. The chain of trust is maintained by validating the signature on the Linux kernel and embedding a cryptographic hash of the initrd into the signed UKI.

lanzaboote lives in rust/lanzaboote.

State of Upstreaming to Nixpkgs

Secure Boot is available as an Nixpkgs out-of-tree feature using the bootspec feature preview. It works with current nixpkgs-unstable.

Funding

Logo of NLnet Foundation     Logo of NGI Assure

This project was funded through the NGI Assure Fund, a fund established by NLnet with financial support from the European Commission's Next Generation Internet programme, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 957073. Applications are still open, you can apply today.

If your organization wants to support the project with extra funding in order to add support for more architectures, PKCS#11 workflows or integration, please contact one of the maintainers.