Deliver packages#
Targets pull signed packages from OCI registries. You publish a package on the operator host, and every target that follows the repository installs or upgrades it on its own. This page shows how to point targets at a repository, how to install, upgrade and remove packages by hand, and how the timers and the upatch tree deliver them without you.
How a package reaches a target#
Delivery is a pull in four steps, which Figure 1 shows together with the upatch tree:
On the operator host,
shirudo bpm pushpublishes the package and a signed entry in the repository index<namespace>/bpm-index:stable.On the target,
shirudo bpm repo updatefetches that index from each repository, verifies its signature against the repository’s certificate and caches it under/var/lib/shirudo/bpm/repos/<name>/index.json.shirudo bpm upgradeinstalls, for every package installed from a repository, the highest version in the cached index that is newer than the installed one.The install checks the package archive against the digest in the index, refuses a package whose
cert.derdoes not carry the public key of/var/lib/shirudo/keys/cert.der, and loads each upatch the wayshirudo upatch loaddoes. The kernel verifies each loader’s signature against the.bpfkeyring, and shirudo measures each load into the TPM register.
shirudo-bpm-repo-update.service runs bpm repo update and then
bpm upgrade. Its timer starts it at boot and again 60 seconds after
each run ends. A version you push to a repository index therefore
reaches every target that follows the repository about a minute later,
with nobody logged in. Treat every push to an index as a fleet-wide
rollout.
Figure 1. How a package and a tree operation reach a target.#
What is configured where#
A target reads its package inputs from the signed config image, not from
the host’s /etc/shirudo. Copies of these files on the host root file
system have no effect while a config image is active.
Input |
Location on the target |
How you change it |
|---|---|---|
Repository definitions |
|
New signed config, |
Repository certificates |
|
New signed config, |
Subscription to the upatch tree |
|
New signed config, |
Node labels for tree selectors |
|
New signed config, |
Hosts allowed classical TLS key exchange |
|
New runtime image and a reboot |
Registry credentials and transport |
|
Root on the target, no signature |
Installed packages |
|
|
While a config image is active, the target refuses local changes to
these inputs. bpm config register add, remove and rm exit 1
with image mode: change repository definitions and keys in a signed
config image, then run `shirudo image update`. bpm key add exits 1
with image mode: add vouched BPF signers to the signed config selected
for boot and reboot to enroll them.
systemd reads /etc/shirudo/bpm/environment for the two package
services. The file can set registry credentials (BPM_OCI_USERNAME
with BPM_OCI_PASSWORD, BPM_OCI_BEARER_TOKEN,
REGISTRY_AUTH_FILE, DOCKER_CONFIG), cleartext transport
(BPM_OCI_SCHEME=http) and an extra CA certificate
(BPM_OCI_CA_FILE). It is host state outside the signed config, and
root on the target can change it. The signatures on the index, the
package and the upatches do not depend on it, but the transport does.
Environment variables lists every variable, and
Threat model describes what root on the target can do
with it.
If you keep the auth file or the CA certificate under /etc/shirudo,
make the file and each directory its path leads through root’s and not
writable by group or others, and each symbolic link on the path root’s.
A link of root’s to the distribution’s CA certificates passes;
Ownership and mode gives the rules.
Before you begin#
An initialized target (Initialize a target) whose services run the runtime binary (Install the unit drop-ins).
On the target,
shirudostands for the runtime image’s binary,/run/shirudo/runtime/usr/bin/shirudo(Run shirudo on the target).A package published to a repository (Publish and install a package).
On the operator host, the source directory of the target’s config image and the key that signs config images.
Add a repository#
In the config source directory, create
etc/shirudo/bpm/registries.d/<name>.conf:endpoint = oci://<registry-host> key_file = /etc/shirudo/bpm/keys/<name>.der
index_repositoryis optional. If omitted, shirudo uses<name>/bpm-index; use the package namespace as<name>to matchbpm push. Set the field explicitly when the source name differs.<name>is the repository name thatbpm installuses. When the default index location is used, it must also be the package namespace.<registry-host>is the registry’s host name with an optional port and no path.index_repositorynames the index repository. Its namespace must match the namespace of the package repository passed tobpm push.key_filenames a certificate inside the config image. The target refuses any other absolute path.Copy the certificate whose key signs the repository index, the one you pass to
bpm push, toetc/shirudo/bpm/keys/<name>.derin the same directory.Build, sign and activate the config, as described in Change the signed config.
List the repositories the target reads:
target# shirudo bpm config register list
The command prints
Registered sources:and one repository name per line, ornone.Fetch the repository’s index now instead of waiting for the timer:
target# shirudo bpm repo update <name>
The command prints nothing when it succeeds. When it fails, it prints
bpm repo update: <reason>and exits 1. Without<name>it updates every repository, continues past one that fails and exits 1 at the end.
Change the signed config#
Every change to repositories, the tree subscription, node labels and export settings is a new signed config image that the target activates while it runs.
Build and sign the image from the config source directory:
operator$ /usr/libexec/shirudo/gen-image/shirudo-gen-image \ --source <config-root> --output <prefix> \ --keys-dir <config-keys-dir> --kind config
<config-root>is the source directory. It must containetc/shirudo/shirudo.conf, which accepts onlyeventlog.max_bytesandmap_export.*keys, and it must not contain symbolic links or special files.<prefix>is the output path without a suffix: the command writes<prefix>.img,<prefix>.verity,<prefix>.roothashand<prefix>.p7sand refuses to replace an existing file.<config-keys-dir>holds the key whose certificate the runtime image lists in aconfig.verification_keyentry. The path is the operator package’s. From a checkout, runtools/gen-image/shirudo-gen-imageand add--builderwith the path ofshirudo-build.Verify the bundle offline:
operator$ shirudo image verify <prefix> --cert <config-cert>
<config-cert>is the config verification certificate in DER. The command prints the root hash.Copy the four files to the target, or serve them over HTTPS under one URL prefix.
Activate the config on the target:
target# shirudo image update <prefix>
<prefix>is the local path prefix of the four files, or theirhttps://URL prefix. The command fetches and verifies the bundle, extends the config PCR and switches to the new config.Check the activation:
target# shirudo image status Config root hash: 6d5ed552f4487728d1ccec8604ddb44b66b18e3430614c20bb4d284995f99f63 PCR: 14 Sequence: 1 TPM reset count: 1 Restart count: 0 Pending: no Consistent: yes
This output is from a target that runs its boot config. After an update,
Config root hashis the root thatimage verifyprinted andSequenceis higher.Pendingmust benoandConsistentmust beyes. The command exits 1 otherwise, and--jsonprints the same fields as one JSON document. If an activation stays pending, follow Back up, recover and decommission a target.
Install a package#
Install the package from a repository:
target# shirudo bpm install <name>/<package>
<name>is the repository name and<package>the package name. Without a version, the command installs the highest version in the cached index. Append@<version>to choose one. The command loads each upatch of the package and prints whatshirudo upatch loadprints.Check that the package is installed:
target# shirudo bpm list
The command prints
Installed packages:, a header and one line per installed package: its name, its version and the repository it came from, ordirectfor anoci://install. With no package installed it printsnone.Check that its upatches are loaded:
target# shirudo upatch list Archived upatches (/var/lib/shirudo/upatches): NAME LOADED TYPE KIND PAYLOAD shirudo-test-basic yes load bpf 8aee7072a1a15e4d..
This target holds one upatch, loaded by hand. A package’s upatches appear the same way, one line each.
bpm install does nothing and exits 0 when a package of that name is
already installed, whatever its version. The repository timer moves an
installed package to the highest version in its index at its next run,
so @<version> does not hold a package at that version.
A package can also be installed straight from a registry reference:
target# shirudo bpm install oci://<registry-host>/<repository>:<tag>
No signed index covers such an install: the registry decides which
package the tag names. Its upatches still load only when a key in the
.bpf keyring signed them. bpm upgrade leaves direct installs
alone.
Upgrade packages#
Refresh the cached indexes:
target# shirudo bpm repo update
Upgrade every package that has a newer version in its index:
target# shirudo bpm upgrade
bpm upgradereads only the cached indexes. For each package it runs the old version’s unload directives in reverse name order and then loads the new version’s upatches. When a load fails, it unloads what it loaded, tries to load the old version again and exits 1. Packages it upgraded before the failure stay upgraded.Check the versions with
shirudo bpm list.
The repository timer runs both steps every minute, so you need them only to upgrade before the timer does.
Uninstall a package#
Uninstall the package:
target# shirudo bpm uninstall <package>
The command runs the package’s unload directives in reverse name order, removes the package’s files and removes it from the installed state. Each unload is measured. When an unload fails, the command prints
bpm uninstall: unload <path> failedand stops.Check that
shirudo bpm listno longer lists it and thatshirudo upatch listno longer shows its upatches.
Removing a package from its index does not uninstall it from targets:
bpm upgrade skips an installed package that its index no longer
lists.
Follow the upatch tree#
The upatch tree is a signed, ordered list of add and delete
operations that you append on the operator host with
shirudo bpm tree append. Each operation can carry selectors on the
kernel release, kernel build ID, architecture, kernel configuration and
node labels, so one publication serves a mixed fleet.
In the config source directory, create
etc/shirudo/bpm/upatch-tree.conf:endpoint = oci://<registry-host>/<repository> reference = <reference>
<repository>is the tree’s repository and<reference>the tagbpm tree appendpublished to,stableunless you chose another.If operations select on labels, write the target’s labels to
etc/shirudo/node.labels, one<key>=<value>per line.Build, sign and activate the config (Change the signed config).
Preview what a sync would apply:
target# shirudo bpm tree sync --dry-run
The command prints a JSON report with the counts
selected,skipped,appliedandmodule_skippedand the sequence numberlast_seqthe target has reached. A dry run changes nothing.
shirudo-bpm-tree-sync.timer runs bpm tree sync 60 seconds after
boot and every 60 seconds after that. Without a tree configuration the
command exits 0 and does nothing. Each applied operation is measured.
Keep these rules of the tree in mind. Figure 2 shows them on one publication:
A sync moves the target’s cursor past an operation whose selectors do not match. The target never applies that operation later, even when its labels or kernel change. A selector the target cannot evaluate, because its kernel config or its node labels cannot be read, stops the sync with
selector_evaluateand leaves the cursor on the operation, so the next sync tries again.An
addwhose attach target is in a kernel module that is not loaded is recorded asskipped: module not loaded, and the cursor moves past it.The target verifies tree publications against the BPF signers of the active config: the runtime image’s primary certificate and the certificates the config vouches for, less the ones it revokes. Manage signing keys describes the signer set.
Figure 2. One target going through a tree publication. Skipped operations stay skipped.#
Timers and locks#
Timer |
Runs |
When |
|---|---|---|
|
|
At boot, then 60 s after each run ends |
|
|
60 s after boot, then every 60 s |
Both services run the host’s shirudo unless you installed the
runtime drop-ins (Install the unit drop-ins). An enforcing target refuses
that binary, so without the drop-ins nothing is delivered.
bpm install, upgrade, uninstall, repo update and
tree sync take /var/lib/shirudo/locks/bpm.lock and wait for it
without a time limit. Every shirudo command on a target also holds
the config operation lock for its whole run, and a command that waits
longer than 30 seconds for it fails. A long download therefore delays
the status keepalive and the map export, and a keepalive can fail while
it runs. Troubleshoot by symptom has the message.
Every command except status and image status is refused while a
config activation is pending, bpm uninstall included. Back up, recover and decommission a target
describes that state.
Next steps#
Publish and install a package to publish a package
Publish a package for packages, indexes and the tree on the operator side
Monitor and export telemetry to export what the installed upatches collect
shirudo bpm for every
bpmoptionPackage and index formats for the index and package formats
upatch tree for the tree format formats