Deliver packages#

How-to · Operators

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:

  1. On the operator host, shirudo bpm push publishes the package and a signed entry in the repository index <namespace>/bpm-index:stable.

  2. On the target, shirudo bpm repo update fetches 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.

  3. shirudo bpm upgrade installs, for every package installed from a repository, the highest version in the cached index that is newer than the installed one.

  4. The install checks the package archive against the digest in the index, refuses a package whose cert.der does not carry the public key of /var/lib/shirudo/keys/cert.der, and loads each upatch the way shirudo upatch load does. The kernel verifies each loader’s signature against the .bpf keyring, 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

etc/shirudo/bpm/registries.d/<name>.conf in the config image

New signed config, shirudo image update

Repository certificates

etc/shirudo/bpm/keys/ in the config image

New signed config, shirudo image update

Subscription to the upatch tree

etc/shirudo/bpm/upatch-tree.conf in the config image

New signed config, shirudo image update

Node labels for tree selectors

etc/shirudo/node.labels in the config image

New signed config, shirudo image update

Hosts allowed classical TLS key exchange

tls.classical_hosts in the runtime image’s etc/shirudo/shirudo.conf

New runtime image and a reboot

Registry credentials and transport

/etc/shirudo/bpm/environment on the host

Root on the target, no signature

Installed packages

/var/lib/shirudo/bpm/state.json

bpm install, bpm upgrade, bpm uninstall

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#

Add a repository#

  1. 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_repository is optional. If omitted, shirudo uses <name>/bpm-index; use the package namespace as <name> to match bpm push. Set the field explicitly when the source name differs.

    <name> is the repository name that bpm install uses. 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_repository names the index repository. Its namespace must match the namespace of the package repository passed to bpm push. key_file names a certificate inside the config image. The target refuses any other absolute path.

  2. Copy the certificate whose key signs the repository index, the one you pass to bpm push, to etc/shirudo/bpm/keys/<name>.der in the same directory.

  3. Build, sign and activate the config, as described in Change the signed config.

  4. List the repositories the target reads:

    target# shirudo bpm config register list
    

    The command prints Registered sources: and one repository name per line, or none.

  5. 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.

  1. 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 contain etc/shirudo/shirudo.conf, which accepts only eventlog.max_bytes and map_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>.roothash and <prefix>.p7s and refuses to replace an existing file. <config-keys-dir> holds the key whose certificate the runtime image lists in a config.verification_key entry. The path is the operator package’s. From a checkout, run tools/gen-image/shirudo-gen-image and add --builder with the path of shirudo-build.

  2. 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.

  3. Copy the four files to the target, or serve them over HTTPS under one URL prefix.

  4. Activate the config on the target:

    target# shirudo image update <prefix>
    

    <prefix> is the local path prefix of the four files, or their https:// URL prefix. The command fetches and verifies the bundle, extends the config PCR and switches to the new config.

  5. 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 hash is the root that image verify printed and Sequence is higher. Pending must be no and Consistent must be yes. The command exits 1 otherwise, and --json prints the same fields as one JSON document. If an activation stays pending, follow Back up, recover and decommission a target.

Install a package#

  1. 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 what shirudo upatch load prints.

  2. 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, or direct for an oci:// install. With no package installed it prints none.

  3. 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#

  1. Refresh the cached indexes:

    target# shirudo bpm repo update
    
  2. Upgrade every package that has a newer version in its index:

    target# shirudo bpm upgrade
    

    bpm upgrade reads 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.

  3. 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#

  1. 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> failed and stops.

  2. Check that shirudo bpm list no longer lists it and that shirudo upatch list no 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.

  1. 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 tag bpm tree append published to, stable unless you chose another.

  2. If operations select on labels, write the target’s labels to etc/shirudo/node.labels, one <key>=<value> per line.

  3. Build, sign and activate the config (Change the signed config).

  4. Preview what a sync would apply:

    target# shirudo bpm tree sync --dry-run
    

    The command prints a JSON report with the counts selected, skipped, applied and module_skipped and the sequence number last_seq the 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_evaluate and leaves the cursor on the operation, so the next sync tries again.

  • An add whose attach target is in a kernel module that is not loaded is recorded as skipped: 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

shirudo-bpm-repo-update.timer

bpm repo update, then bpm upgrade

At boot, then 60 s after each run ends

shirudo-bpm-tree-sync.timer

bpm tree sync

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#