Add secure boot helper
This commit is contained in:
+42
-17
@@ -82,28 +82,53 @@ where this is scripted into provisioning.
|
||||
> needed. If a host must also boot vendor-signed media, *add* your `db` alongside
|
||||
> Microsoft's UEFI CA instead of clearing it.
|
||||
|
||||
### Manual enrollment on a fleet workstation (over SSH)
|
||||
### On a fleet workstation: read state over SSH, enrol via firmware
|
||||
|
||||
The build bakes the EFI management tools into the image (`efitools` +
|
||||
`efivar`/`mokutil`/`efibootmgr`, installed in the main package provisioner), so
|
||||
you can enrol keys **manually over SSH** on a booted workstation that is in Setup
|
||||
Mode — handy for provisioning before the automated flow (TODO #10) exists. The
|
||||
tools write to `efivarfs` (`/sys/firmware/efi/efivars`), not the read-only root,
|
||||
so they work at runtime; they're RPM-installed so fapolicyd already trusts them.
|
||||
> **`efitools` (`efi-readvar`/`efi-updatevar`/`KeyTool`) is NOT packaged for EL9**
|
||||
> (confirmed on Rocky 9, 2026-06-20). The image therefore ships only
|
||||
> `efivar`/`mokutil`/`efibootmgr` (base repos). That's enough to **read** Secure
|
||||
> Boot state over SSH, but **enrolment of custom PK/KEK/db is done in the firmware
|
||||
> setup UI**, not from the OS.
|
||||
|
||||
Read Secure Boot state over SSH (`mokutil` is the `efi-readvar` replacement; acts
|
||||
on efivarfs, works on the read-only root, RPM-installed so fapolicyd-trusted):
|
||||
|
||||
```bash
|
||||
# on the workstation (as the sudo admin):
|
||||
mokutil --sb-state # check Secure Boot / Setup Mode
|
||||
efi-readvar # dump current PK/KEK/db/dbx
|
||||
# copy your PK.auth/KEK.auth/db.auth (or .esl) onto the host, then in Setup Mode:
|
||||
sudo efi-updatevar -f db.auth db
|
||||
sudo efi-updatevar -f KEK.auth KEK
|
||||
sudo efi-updatevar -f PK.auth PK # last — leaves Setup Mode
|
||||
efi-readvar # read back + confirm fingerprints match
|
||||
mokutil --sb-state # enabled / setup mode
|
||||
mokutil --pk # Platform Key
|
||||
mokutil --kek # KEK
|
||||
mokutil --db # signature db — your enrolled fleet db cert appears here
|
||||
mokutil --dbx # revocations
|
||||
```
|
||||
|
||||
Only the **public** certs/`.esl`/`.auth` need to reach the workstation — never
|
||||
copy `PK.key`/`KEK.key`/`db.key` onto a host.
|
||||
**Enrol — two paths:**
|
||||
|
||||
**(a) Baked helper over SSH (`fleet-sb-enroll`)** — the OS-side, efitools-free
|
||||
path. The build bakes `/usr/local/bin/fleet-sb-enroll` plus the public
|
||||
`PK/KEK/db.auth` at `/usr/share/fleet-secureboot/` (supplied via
|
||||
`files/secureboot/keys/` or the `SB_*_AUTH_B64` CI secrets). On a workstation in
|
||||
**Setup Mode**:
|
||||
```bash
|
||||
sudo fleet-sb-enroll --check # show SB state + which keys are baked
|
||||
sudo fleet-sb-enroll # enrol db -> KEK -> PK (PK last; exits Setup Mode)
|
||||
mokutil --db ; mokutil --sb-state # verify
|
||||
```
|
||||
It writes the signed `.auth` updates to efivarfs directly (the EL9-native
|
||||
equivalent of `efi-updatevar`), refuses to run outside Setup Mode without
|
||||
`--force`, and is added to fapolicyd's trust DB at build (it's a non-RPM exec).
|
||||
⚠ This is a deliberate trust-bootstrap action — run it only on a host you control,
|
||||
on a trusted/isolated network (see TODO #10).
|
||||
|
||||
**(b) Firmware UI** — no OS tooling, the most robust for one-off laptop bring-up:
|
||||
1. Put the public `db.crt` (and `KEK.crt`/`PK.crt`, or the `.esl`/`.auth`) on a
|
||||
**FAT USB stick** (or the ESP).
|
||||
2. Firmware setup → Secure Boot → **Custom**, **Clear/Reset** keys (Setup Mode),
|
||||
then **Enrol / Load key from file** for db, then KEK, then PK. On **HP
|
||||
EliteBooks**: `F10` → *Security* → *Secure Boot Configuration*.
|
||||
3. Save & exit; re-check over SSH with `mokutil --db`.
|
||||
|
||||
Only the **public** certs/`.esl`/`.auth` reach the workstation — never copy
|
||||
`PK.key`/`KEK.key`/`db.key` onto a host.
|
||||
|
||||
## 4. Wire `db` into the build
|
||||
|
||||
|
||||
Reference in New Issue
Block a user