Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CLI reference

All postmaster commands, flags, and exit codes. The CLI is hand-rolled with no external parsing library — every flag below is the complete set, directly from the argument parser in config.rs.

Synopsis

$ postmaster --config <file.json> [--bind] [--allow-nonroot]
$ postmaster exec --config <exec.json> [--check] [--verify-keys] -- <command> [args…]
$ postmaster setup --config <exec.json> [--recheck] [--unattended] [--force] [--keys-dir <path>]
$ postmaster cleanup --config <exec.json>
$ postmaster fetch <socket-path>
$ postmaster help [subcommand]
$ postmaster --version
$ postmaster --help

Global flags

FlagDescription
--help, -hPrint top-level help and exit
--version, -VPrint version and exit

Default mode (serve)

When no subcommand is given, postmaster enters daemon (serve) mode. This is the credential server used in credentials injection mode — socket-activated on Linux, self-binding on macOS.

$ postmaster --config <file.json> [--bind] [--allow-nonroot]
FlagDescription
--config <path>Configuration file (required)
--bindBind listener sockets even if not socket-activated (macOS)
--allow-nonrootAllow non-root connections (dangerous)

On Linux, postmaster is socket-activated: the postmaster-credd.socket unit owns the sockets and the daemon inherits them via sd_listen_fds. On macOS, --bind causes postmaster to create its own listener sockets.

exec

Decrypt and inject secrets, then execvp the target binary.

$ postmaster exec --config <exec.json> [--check] [--verify-keys] -- <command> [args…]
FlagRequiredDescription
--config <path>YesPath to exec.json (before --)
--checkNoValidate config shape only, no decryption (for CI)
--verify-keysNoPreflight decryption to catch stale keys
--Yes (unless --check)Separator; everything after is the child argv
  • On success the process image is replaced (execvp); postmaster never returns.
  • On failure the error is logged and the process exits non-zero.
  • --check does not accept a command after --.
  • --verify-keys performs a preflight check: after loading and decrypting, if the resolved values are empty but the env files contain encrypted: values, the keys are stale and the exec aborts. This catches the strict: false case where stale keys would silently skip undecryptable values.

Exit codes:

CodeMeaning
0--check passed (or exec succeeded — but exec replaces the process)
1Config error, parse failure, decryption failure
2Missing arguments, bad usage

setup

Create keys directory, verify permissions, optionally seed keychain (macOS), validate environment. Idempotent — skips steps that are already correct.

$ postmaster setup --config <exec.json> [--recheck] [--unattended] [--force] [--keys-dir <path>]
FlagDescription
--config <path>Path to exec.json (required)
--recheckVerification-only — no creation or seeding
--unattendedFail closed without prompting (for CI/automation). Alias: --non-interactive
--forceRe-create/re-seed even if already correct
--keys-dir <path>Override default keys directory

Default keys directory:

  • Linux: /var/lib/postmaster
  • macOS: ~/Library/Application Support/postmaster

cleanup

Remove plaintext secret files from the secrets directory after the child exits.

$ postmaster cleanup --config <exec.json>
FlagDescription
--config <path>Path to exec.json (reads secrets_dir from config)

Wired to ExecStopPost in systemd by the Nix module. On macOS, the ramdisk destruction handles cleanup automatically when the launchd job stops.

fetch

macOS credential fetch client — connects to a postmaster socket and reads the decrypted value to EOF.

$ postmaster fetch /run/postmaster-credd/myapp/DATABASE_URL.sock

Used internally by the wrapper in credentials mode on macOS. Not typically called directly.

help

Print help text for a subcommand or the top-level help.

$ postmaster help           # top-level help
$ postmaster help exec       # exec subcommand help
$ postmaster help setup      # setup subcommand help
$ postmaster help cleanup    # cleanup subcommand help
$ postmaster help fetch      # fetch subcommand help

version

$ postmaster --version
$ postmaster -V