config.json is plain JSON and trivially copyable, but the secrets that actually make it work — mantis_live_… API keys, Cloudflare Service-Auth credentials, and edge-worker AES keys — live in the OS keychain and can’t be scp’d. mantis backup and mantis restore cover the full set: every profile’s config + secrets plus your installed-plugin manifest, packed into a single passphrase-encrypted JSON file.
The resulting file is safe to commit to a private git-crypt repo, attach to a 1Password / Bitwarden / Doppler vault entry, or stash in iCloud / Drive. Lose the passphrase and the contents are unrecoverable, by design.
Migrating to a new machine
What’s included
Plugins re-install from their original source, so the new machine needs network access to GitHub during
restore. Use --skip-plugins if you want to defer that.
Format
The bundle is plain JSON. Top-level fields are the encryption envelope; everything sensitive lives insideciphertextB64.
- scrypt (N=32768, r=8, p=1) — interactive-password parameters, ~64 MiB working set
- AES-256-GCM — authenticated encryption; tampering with the file fails closed
- Random salt + nonce per backup — two backups of identical data produce different ciphertexts
- Format tag — checked on restore, so the CLI can evolve the format without silently breaking old bundles
0600 (owner-only).
Flag reference
mantis backup
mantis restore
Inline
--passphrase <value> is intentionally not offered. It would leak into shell history, ps, and CI logs. Use one of the stdin / env-var forms for automation.
Automation examples
Pipe a passphrase from a password manager (1Password CLI shown):Security notes
- The bundle is only as strong as its passphrase. scrypt slows down brute-forcing but does not eliminate it. Use a long, high-entropy passphrase (diceware-style, ≥ 5 words) if the file is going to live anywhere shared.
- If the file leaks but the passphrase doesn’t, contents stay confidential. If the passphrase leaks, contents are recoverable in seconds — rotate API keys (
mantis loginagain) on every profile. - A wrong passphrase and a corrupted-/-tampered bundle are indistinguishable at the AES-GCM layer. The CLI reports “wrong passphrase or corrupted file” — both are real possibilities, in that order of likelihood.
- The plugin re-install during
restorerunsmantis plugin add <source>@<sha>. If a plugin source repo has been deleted, transferred, or had its history rewritten since the original install, the re-install will fail (and is reported as a failed plugin, not a failed restore). The bundle does not carry the plugin code as a fallback.
When NOT to use this
- Sharing access with a teammate. Send them a fine-grained API key from your Mantis server instead — backups carry every secret you own, not a scoped subset.
- Backing up the Mantis server data. That’s
deployment/backups.md— Postgres dumps of hits, audit log, wallet config, etc.mantis backuponly covers your local CLI state. - Synchronising two laptops in real time. Use two profiles on each machine pointed at the same backend, and re-run
mantis loginon the second laptop. The backup file is a point-in-time snapshot, not a continuously-synced settings sync.