oz0 server secrets-key wrap

Move the secrets key under a key command, which keeps the key that wraps it in an HSM, a KMS or anything else.

For: Operators and developers looking up a command.

Move the secrets key under a key command, which keeps the key that wraps it in an HSM, a KMS or anything else. It wraps the key with COMMAND wrap, checks that COMMAND unwrap gives the same key back, keeps the plain file as <file>.plain and writes the wrapped document in its place. Start every server with --secrets-key-command COMMAND from then on.

Once they run, shred the plain copy with --forget-plain --confirm-backup (after you have an offline copy of the key, as server init asks for).

--rewrap rotates the wrapping key of a file that is wrapped already: it unwraps with --from-command (default --command) and wraps the same key with --command, keeping the old document as <file>.prev. Use it for a new KMS key, alias, endpoint or credentials. The key itself does not change.

Run it on a server's machine, with the key file the servers use. With --db-file, OZ0_DB or --dev it also checks the key against the cluster and writes an audit entry; an edge apart from management runs it without. It needs no licence: unwrap-to-file is the way back to a plain file.

Usage

oz0 server secrets-key wrap --command COMMAND [flags]

Flags

FlagTypeDefaultDescription
--commandcommandthe key command that wraps the key from now on
--confirm-backupboolwith --forget-plain: an offline copy of the key exists, apart from the database's backups (recorded as confirm-backup does, with the database)
--data-dirstring~/.local/share/orchestrator-zeroserver data directory
--db-filefilea file (- for stdin) holding the PostgreSQL URL of the management database, such as postgres://oz0:PASSWORD@db:5432/oz0 (or set OZ0_DB); the URL can carry a password, so it never goes on the command line
--devboola dev server's data directory (--data-dir) instead of a cluster's database
--forget-plainboolshred <file>.plain, the plain copy wrap kept, once the wrapped file unwraps to the same key
--from-commandcommand--commandwith --rewrap: the key command that unwraps the file now
--notestringwith --forget-plain: where the offline copy is kept, one line for the audit log; never the key
--rewrapboolrotate the wrapping key of a file that is wrapped already
--secrets-key-filestringthe secrets key file the edges start with (--secrets-key-file of server start)

Inherited flags

FlagTypeDefaultDescription
--contextstring$OZ0_CONTEXT or <config dir>/orchestrator-zero/context.jsonCLI context file written by server init
--log-levelstringinfolog level: debug, info, warn or error

See all oz0 commands and the global flags.

On this page
Copyright © 2026