shirudo genkey#
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#
genkeyselects the keys directory:--keys-dir, else$SHIRUDO_KEYS_DIR, else/var/lib/shirudo/keys.It creates the directory with mode 0700 when it is missing.
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.
Without
--force, it refuses whensigning_key.pemorcert.derexists in the directory.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 issuerCN=shirudo, valid from its creation and without an expiration date (notAfter99991231235959Z, the value RFC 5280 gives a certificate without one)
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 |
|---|---|---|---|
|
none |
off |
Replace an existing key and certificate. |
|
|
|
Directory to write the pair to. |
Exit status#
Status |
Meaning |
|---|---|
0 |
The pair was written. |
1 |
The pair exists and |
2 |
A usage error: an unknown option, an option given twice,
|
Files and environment#
<dir>/signing_key.pem,<dir>/cert.der, and during--force<dir>/signing_key.pem.new,<dir>/cert.der.newand<dir>/signing_key.pem.oldSHIRUDO_KEYS_DIR: the default directory
Examples#
Create a key pair in a directory the operator owns:
operator$ shirudo genkey --keys-dir ~/shirudo-keys