shirudo init#
Bring up enforcement on a target: enroll and seal the keyrings, attach the LSM programs, restore the archived upatches and bind the measurement register.
Runs on: target, as root. In production shirudo-initrd.service runs it
from the initrd and shirudo.service runs it again with the runtime
binary after the switch to the root file system. The image gate does not
apply. Requires: the pre-flight checks below, the bootstrap settings in
/etc/shirudo/shirudo.conf, and for the first run in a boot the kernel
parameters bpf.keyring_unsealed=1 and dm_verity.keyring_unsealed=1.
Changes measured state: yes.
Usage#
shirudo init [--check-only [--json]]
Description#
initloads the authenticated bootstrap settings: from/etc/shirudo/shirudo.conf, which must name the runtime image and its root hash, or from the frozen identity when enforcement is already up.It runs the pre-flight checks and prints them. With
--check-onlyit stops here.In the initrd (
/etc/initrd-releaseexists), it requires a tmpfs or ramfs root and binds/sysroot/var/lib/shirudowritable over/var/lib/shirudo. The bind is detached wheninitexits.It mounts the private bpffs at
/run/shirudo/bpffs.On the first run in a boot it mounts the runtime image, enrolls the config certificate into the
.dm-veritykeyring and seals it, selects the signed config for this boot, then enrolls the trusted certificate set into the.bpfkeyring and seals it. On a later run it checks that the frozen identity names the same.bpfkeyring and runtime image.It labels the persistent state, adopts the eventlog that the initrd run left in
/run/shirudo/eventlog.pending, and loads and pins the enforcement programs.It mounts the authenticated runtime image at
/run/shirudo/runtime.It begins the config
BOOTevent: it records the selection as pending, extends the config PCR named in the bootstrap settings and mounts the config image at/run/shirudo/config.It restores every upatch archived in
/var/lib/shirudo/upatcheswhose load the eventlog records without a later unload, all or nothing. An archive without such a record, one root brought back after its unload or one a load stopped before its extend left, is ignored with a warning. A upatch already loaded with the archived payload and every link its signed metadata implies is kept; one missing a link is refused as tampered. An archived upatch that is not loaded after this boot’s register was bound is refused as tampered.It binds the measurement register under PCRs 9 and 11 and records one init event that covers the certificate set, the restored upatches and the upatch tree root. Without tree state the root is 64 zeros; tree state that cannot be read or parsed stops
initbefore the register is bound, rather than being measured as no tree.It completes the config
BOOTevent.
Measurement: the config PCR receives one BOOT event per boot. The
measurement register receives one init event per boot. A second run in the
same boot after a successful first one adds no event.
A failure after the BOOT event began, in the restore or in binding the
register, leaves the config activation pending. The help text of
init calls it idempotent, but in that state a second run fails and the
image gate refuses every command except status until the next reboot.
The next boot restores the same archive. See
Troubleshoot by symptom.
Pre-flight checks#
Check |
Passes when |
|---|---|
|
|
|
The BPF LSM is active. |
|
The kernel supports bpffs. |
|
The kernel has the signed-loader interface. |
|
The kernel has every LSM hook the embedded programs attach to. |
|
The kernel checks module signatures, or loads no modules. |
|
The primary certificate exists: |
|
Every trusted certificate holds an ML-DSA-87 key. |
|
The kernel can parse every trusted certificate. The check adds each to the thread keyring and clears it again. |
|
The kernel has keyrings and a |
|
The enforcement BPF objects embedded in the binary are present. |
|
A TPM answers on the configured TCTI. |
--check-only changes no persistent or enforcement state. It reads the
TPM and probes the keyring as described.
Options#
Option |
Argument |
Default |
Description |
|---|---|---|---|
|
none |
off |
Run and print the pre-flight checks, then exit. |
|
none |
off |
With |
Exit status#
Status |
Meaning |
|---|---|
0 |
Enforcement is up, or with |
1 |
The bootstrap settings cannot be loaded
( |
2 |
A usage error: an unknown option, an option given twice or an
argument, or |
Files and environment#
Reads
/etc/shirudo/shirudo.conf,/etc/shirudo/keys/in the initrd, the runtime and config images the bootstrap settings name,/var/lib/shirudo/images,/var/lib/shirudo/upatches,/var/lib/shirudo/eventlogand/var/lib/shirudo/config-update.Writes
/run/shirudo/bpffs,/run/shirudo/eventlog.pendingin the initrd,/var/lib/shirudo/eventlogand the config activation records in/var/lib/shirudo/config-update.SHIRUDO_INIT_ARGSin/etc/shirudo/init.envis passed by the shippedshirudo.service. The runtime drop-in replaces that command line withinitalone.
Examples#
Run the pre-flight checks on a target:
target# shirudo init --check-only
Pre-flight checks:
OK root
OK bpf_lsm_active
OK bpffs_supported
OK signed_loader_kernel_abi
OK kernel_lsm_hooks
OK module_signatures
OK cert_on_disk
OK cert_algorithm
OK cert_kernel_support
OK kernel_keyring
OK embedded_loader
OK tpm2_reachable: TCTI from the config: device:/dev/tpmrm0
12 of 12 passed