shirudo genkey#

Reference · Operators

Generate an ML-DSA-87 private key and a self-signed X.509 certificate for signing upatches.

Runs on: operator host, without the image gate; refused on a target where shirudo enforces. Requires: write access to the keys directory. Changes measured state: no.

Usage#

shirudo genkey [--force | -f] [--keys-dir <dir> | --keys-dir=<dir>]

Description#

  1. genkey selects the keys directory: --keys-dir, else $SHIRUDO_KEYS_DIR, else /var/lib/shirudo/keys.

  2. It creates the directory with mode 0700 when it is missing.

  3. Run as a user other than root with the default directory, it requires every component of the path to be owned by root or that user and not writable by group or others, and the directory itself to be owned by that user.

  4. Without --force, it refuses when signing_key.pem or cert.der exists in the directory.

  5. It generates an ML-DSA-87 key and writes:

    • <dir>/signing_key.pem: the private key, PEM, mode 0600

    • <dir>/cert.der: a self-signed X.509 certificate, DER, mode 0600, subject and issuer CN=shirudo, valid from its creation and without an expiration date (notAfter 99991231235959Z, the value RFC 5280 gives a certificate without one)

  6. It logs genkey: created shirudo ML-DSA-87 signing material at <dir> at audit priority.

With --force, genkey writes the new pair as *.new, keeps the old key as signing_key.pem.old until both new files are in place, then removes the old key. A failure between the two renames puts the old key back.

The signing commands read a key only when it is a regular file with mode 0600. Pass the same --keys-dir to shirudo build, shirudo keys vouch, shirudo bpm build and tree append, and shirudo image build. bpm push ignores SHIRUDO_KEYS_DIR and signs only with an explicit --keys-dir or --index-key and --index-cert.

Warning

--force deletes the old private key. A target that trusts only the old certificate refuses everything the new key signs, and nothing can sign for the old certificate any more. Generate the new pair in another directory and vouch for it with the old key first, as Manage signing keys describes.

Options#

Option

Argument

Default

Description

--force, -f

none

off

Replace an existing key and certificate.

--keys-dir

<dir>, as the next argument or after =

$SHIRUDO_KEYS_DIR, else /var/lib/shirudo/keys

Directory to write the pair to.

Exit status#

Status

Meaning

0

The pair was written.

1

The pair exists and --force was not given, the directory is unsafe or not writable, generating or writing failed, or shirudo enforces on this host.

2

A usage error: an unknown option, an option given twice, --keys-dir without a value or with an empty one, or an argument.

Files and environment#

  • <dir>/signing_key.pem, <dir>/cert.der, and during --force <dir>/signing_key.pem.new, <dir>/cert.der.new and <dir>/signing_key.pem.old

  • SHIRUDO_KEYS_DIR: the default directory

Examples#

Create a key pair in a directory the operator owns:

operator$ shirudo genkey --keys-dir ~/shirudo-keys