Initialize a target#
shirudo init brings enforcement up on every boot. It runs twice: once
from the initrd, where it does the work, and once from the root file
system, where it checks that work and records it. You do not run it by
hand. This page tells you what each run does, how to check that it
worked, and what to do when it did not.
Before you begin#
A target set up as described in Boot integration.
A root shell on the target. On the target,
shirudomeans the runtime image’s binary,/run/shirudo/runtime/usr/bin/shirudo. See Run shirudo on the target.
What init does#
Run |
Unit and binary |
What it does |
|---|---|---|
Initrd |
|
Steps 1 to 14 of Figure 1. It binds |
Root file system |
|
Checks that the keyring and the runtime image are the ones the
initrd recorded, appends the pending init record to
|
Figure 1 shows the steps of both runs in order, and the three bands that
When init fails sorts a failed initrd run into. The mounts under
/run/shirudo survive the switch to the root file system.
Boot from initrd to root explains each step.
Figure 1. The steps of init in the initrd and on the root file system, and what a failure of the initrd run leaves in each band.#
Check that init worked#
Read the status report:
target# shirudo status Host: docs Roles: target Status: ok Version ID: d0d7aa800303439023907d1979d917d46a21bec21f816689c138728a28e84af9 Conditions: TYPE STATUS DETAIL LsmAttached OK lsm/bpf link present and pinned KeyringSealed OK bpf serial 272801410, dm-verity serial 799624487, pins match ChainIntact OK live register equals the eventlog replay UpatchesMeasured OK every pinned or archived upatch is in this boot's records TpmMeasured OK NV index 0x01818E00 readable ConfigActive OK config 6d5ed552f448.. is active XdpCovered OK every device an XDP upatch selects runs it Tamper attempts (this boot): LoadNotLoader 15 program load that is not a signed loader MapCreate 1 map creation by another executable BpfCommand 8 detach, update, delete or unclassified bpf() command BpffsUmount 1 unmount of the private bpffs SealWrite 1 write open of a sealed file SealEntry 2 entry into a sealed directory, or a sealed inode linked Integrity attempts (this boot): none Loaded upatches (1): NAME LOCATION MAPS MISSED STATUS AGE shirudo-test-basic fentry/do_nanosleep 0 0 success 1s Folded: keyrings, TPM measurement, assets (--show-full)
Status: okand every conditionOKmean that enforcement is attached, the.bpfkeyring is the one init sealed, the register matches the eventlog, every pinned upatch is measured, the config is active and every device an XDP upatch selects runs it.Read where the register was bound:
target# shirudo status --show-full ... TPM measurement: TPM: reachable (device:/dev/tpmrm0) NV index: 0x01818E00 (anchored in PCR 9) Chain: 7f63313a31ac8ddd3a6a16fce2038322c9c782d5787155d2dc18dfa582dff548 Register name: 000b21eb0d45ac9ee1bb0a87dbb069120e3b8cb251b3d40cc2a86a307ab73f728789 Anchored: yes, name on record PCR before init: 0000000000000000000000000000000000000000000000000000000000000000 Phase at init: 0000000000000000000000000000000000000000000000000000000000000000 (PCR 11) Bound in: initrd Chain vs eventlog: matches Eventlog: /var/lib/shirudo/eventlog (2 entries, 2324 bytes) ...
The report folds the TPM measurement section while
ChainIntactandTpmMeasuredareOK, and--show-fullprints it.Bound in: initrdsays that the initrd run bound the register.PCR before initandPhase at initare PCR 9 and PCR 11 as init found them. The output comes from the test VM, which boots the kernel and initrd without a UKI, so both are zero. A target that boots a measured UKI shows its own values, and a verifier pins them as Attest targets describes.Check the fields a script reads:
target# shirudo status --json
Field
Value after a good boot
status"ok"keyring_mode "bpf"tpm.bound_ in "initrd"tpm.chain_ matches_ eventlog truetpm.register_ rebound falseconfig.activation_ pending falsestatus JSON describes every field.
Check that the root run adopted the initrd’s record:
target# ls /run/shirudo/eventlog.pending
The file must not exist. When it remains,
shirudo.servicedid not run or failed, and its journal says why.Read both runs in the journal:
target# journalctl -b -u shirudo-initrd.service -u shirudo.service
A complete initrd run logs
tpm: register bound in the initrd and extended (index 0x01818E00, PCR 9 anchored, <n> upatches in set)andinit: complete (LSM active, writable state sealed). The root run logstpm: register already bound this boot; chain unchanged (index 0x01818E00)and the same last line.
To see which prerequisites init checks first, run the pre-flight alone. It changes no persistent or enforcement state:
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
shirudo init describes each check.
When init fails#
A failed initrd run does not stop the boot. shirudo-initrd.service is
only wanted by initrd.target, and nothing acts on its failure. The
host boots, and what it runs depends on the band of Figure 1 where init
stopped.
When the initrd lacks the shirudo module or its certificate, init does
not run at all and nothing reports an error.
shirudo-gen-initrd --check detects such an initrd before you boot it.
Where init stopped |
What you see |
What to do |
|---|---|---|
Before the LSM programs attach, steps 1 to 7: the pre-flight, the image settings, the bpffs, verifying the images and enrolling the keys, sealing state or loading enforcement. |
The host runs without enforcement. |
Read the initrd journal, fix the cause and reboot. |
After the LSM programs attach and before the config BOOT event, steps 8 and 9: mounting the runtime image, or checking the activation record and verifying the config again. |
Enforcement is on. Depending on the step, the runtime binary is
missing, commands fail with |
Keep the journal, fix the cause and reboot. When the journal does not explain the state, follow Respond to a tampered target. |
From the config BOOT event on, steps 10 to 14: extending the config PCR, applying the revocations, restoring upatches, binding the register or completing the activation. |
Enforcement is on and the config activation stays pending.
|
Fix the cause and reboot. A reboot without a fix fails at the same step. |
Do not run shirudo init again in the same boot. After a failure past
the config BOOT event, init refuses with
image: activation is pending; further changes are blocked and
init: loading authenticated boot settings failed: Operation now in
progress. Only a reboot clears the pending activation. A re-run after a
successful init changes nothing.
Do not run init from the root file system to make up for a failed initrd run either. Workloads have already run without enforcement by then, and the register would record a binding from the root file system, which a verifier that pins PCR 11 rejects. Reboot instead.
Failures to restore upatches#
Init restores the archived upatches in name order and stops at the first
one that fails, with boot-restore: failed to apply <file> and
init: boot-restore failed; further changes and attestation remain
blocked. The upatches it loaded before that one stay loaded, and no
register measures them. The archive is sealed, so the next boot tries
the same upatch again. The usual cause is a kernel on which the upatch
no longer loads, or a device that an XDP upatch selects whose driver
refuses it. An archived upatch no longer loads at boot describes the way out.
Register binding failures#
When init cannot bind the register, it logs
init: incomplete: LSM active and upatches loaded, but the TPM register
did not advance after one of these lines:
Message |
Cause and action |
|---|---|
|
No usable TPM answered on |
|
The TPM refused the authorization, usually because the owner
hierarchy has a password that shirudo does not have. Set
|
|
The register could not be defined or extended. Read the journal for the TPM error before it. |
|
Something removed or replaced the register after init bound it this boot. Handle it as an incident: Respond to a tampered target. |
The threat model lists the boot paths that leave a target unprotected and what detects them: Threat model.
Next steps#
Read shirudo status for every section and verdict of the status report
Troubleshoot by symptom for refusals after init
Attest targets to prove the boot to a remote verifier