Operator and target#
Every shirudo deployment has two roles. The operator decides which BPF
code a target may run, and the target enforces that decision. One binary serves both, and
what is on a machine decides its role: a machine with the private signing
key acts as an operator, and a machine whose kernel enrolled shirudo’s
certificates and attached its enforcement acts as a target. shirudo
status prints the roles it detects. A development host can hold both.
Why the roles are separate#
The main adversary on a target is root without the signing key: a compromised administrator account, a container escape, an implant. Root can read any file, so any key stored on a target is root’s key. If the target held the signing key, root could sign its own BPF, and the kernel’s signature check would admit it. We therefore keep the key on a separate operator host and give targets only public certificates.
The obvious way to connect the two is a management service that pushes signed code to every target. That service needs a listener on each target, credentials to reach it, and an inventory of the fleet, and each of those is something to attack and something to trust. The design has no such service. The operator publishes to an OCI registry, and each target pulls and verifies on its own.
Operator#
The operator host holds the private signing key, signing_key.pem, and
its certificate, cert.der. shirudo genkey creates both, with an
ML-DSA-87 key, in the keys directory: --keys-dir, else
SHIRUDO_KEYS_DIR, else /var/lib/shirudo/keys. The operator signs
upatches and unload directives, package indexes and tree publications,
config image roots and vouches for further keys, all with ML-DSA-87.
The operator also verifies. shirudo attest verify, shirudo attest
predict and shirudo attest challenge work offline on the operator
host, from files. The operator never opens a TPM and never touches a
kernel keyring. Manage signing keys covers the custody of the key.
shirudo-build helper#
The code that signs artifacts is not in the core shirudo binary.
Every operator command except genkey and the offline attest
commands executes a separate helper, shirudo-build: build, bpm
build, bpm push, bpm tree append, bpm tree show, bpm
config update, image
build, image verify and keys vouch. The helper links the
signer, runs clang to compile BPF and runs veritysetup to build and
check images. The core binary finds it through SHIRUDO_BUILD, then
the installed path under libexec, then PATH.
The operator package installs the helper and the target package does not. On a target the operator commands fail with exit status 127, and neither a signer nor a compiler driver is code that root could reach there.
Stateless operator#
The operator writes only the key pair and the files the caller names: artifacts, packages, images, challenges and reports. It keeps no cache, no inventory of targets and no record of what it published.
Everything a check needs comes from the caller. To verify a target, the
operator names the certificates, the artifacts that should be installed
and, when events happened after boot, the expected register value, which
shirudo attest predict computes from the same inputs. The registry
holds what was published, and each target’s TPM holds what was installed.
An operator host can therefore be rebuilt from the key and the artifacts,
and every expectation a verification applies is on its command line rather
than in a local file.
Target#
A target is a Linux machine with a TPM 2.0 that runs the core binary from an authenticated image, enforces signatures in its kernel and keeps a measurement of its BPF state. It never holds the private signing key. Table 1 lists what it does hold.
What |
Where |
Protected by |
|---|---|---|
The |
Runtime image, mounted at |
dm-verity, with the root hash taken from the initrd in the UKI |
Repositories and their certificates, the tree subscription, node labels, vouched and revoked certificates, export settings |
Config image, mounted at |
dm-verity, with a signed root hash |
The trusted certificates |
The kernel’s |
Sealed by |
Enforcement links, the identity map, the tamper and integrity counters, upatch links and maps |
The private bpffs at |
BPF LSM hooks on unlink, rename, mount and descriptor access |
Archived upatches, the eventlog, package and tree state, cached images, the config activation journal |
|
Seal labels |
The measurement register |
An NV index in the TPM |
The index’s write policy and |
Runtime and config images#
Two dm-verity images carry what root must not be able to change. The kernel checks every block it reads from them against a root hash, so a changed byte fails the read (dm-verity).
The runtime image holds the executable and what it must trust before anything else: the initial BPF certificate, the certificate that verifies config images, and the bootstrap settings that name the config image and its measurement PCR. The UKI’s initrd carries the runtime image’s root hash, so the measured boot covers it.
The config image holds what an operator changes during operation. Its
root hash is signed. shirudo verifies the signature against the runtime
image’s config certificates before it maps the image. The kernel then
checks it again against its trusted keys and the .dm-verity keyring,
into which init enrolls those certificates before sealing it. A key
that only the kernel trusts, in its built-in, secondary or platform
keyring, fails shirudo’s check. shirudo image update activates a new
config image without a reboot and measures it into a separate PCR.
Neither image replaces the host’s root file system. Both are read-only,
and the config image is mounted noexec. Config images and dm-verity
describes their layout, activation and measurement.
Agentless target#
A target runs no daemon and listens on no socket. Every operation is a
one-shot command, started by root or by a systemd unit, that does its work
and exits: init at boot from the initrd and again from the root file
system, package and tree updates and status keepalives every minute,
and map export every five seconds.
systemd units and timers lists the units and timers.
What must outlive a command is pinned in the private bpffs, and what must
outlive the boot is archived under /var/lib/shirudo and restored by
init. We accept the cost of this design, which is latency: a target
learns of a new package at its next timer run, and besides a new network
device starting upatch reconcile, nothing on it reacts between runs.
In return there is no long-running process for root to
attack, no socket for the network to reach, and less code in the target’s
trusted computing base.
Limits#
The separation protects the key only while the operator host is trustworthy. An adversary who holds the signing key can sign BPF that every target accepts, and the design treats that adversary as the operator.
A registry cannot forge what the operator signed, but it can withhold new publications or serve older signed ones. A target accepts any upatch whose signature verifies against its trusted set, including an old one.
Signers are added only at boot. A live config activation can revoke a
key, but a new signer enters the .bpf keyring only when init
enrolls the trusted set. Manage signing keys describes what can change
when.