Managing Secrets
All secrets commands require root (sudo).
Initialise the vault
sudo fleet secrets initCreates /etc/fleet/age.key and vault/ directory. Outputs the public key.
List apps with secrets
sudo fleet secrets listShows each app with its secret type, key count, and last sealed timestamp. Key counts show the number of entries without revealing names.
Set a secret
sudo fleet secrets set myapp DATABASE_URL "postgres://user:pass@host/db"Decrypts the app’s vault file, adds or updates the key, re-encrypts, and updates the manifest. The secret key is validated against ^[a-zA-Z_][a-zA-Z0-9_]*$ to prevent injection.
Get a secret
sudo fleet secrets get myapp DATABASE_URLDecrypts and outputs the value for a single key.
Import from file
sudo fleet secrets import myapp /path/to/.envReads the plaintext file, encrypts it into the vault, and removes the original.
Export
sudo fleet secrets export myapp /path/to/output.envDecrypts and writes the plaintext to the specified path.
Seal and unseal
# Decrypt secrets to runtimesudo fleet secrets unseal
# Remove runtime copiessudo fleet secrets sealUnseal validates all entries before writing to /run/fleet-secrets/. If validation fails, no files are written.
Seal removes the runtime directory contents.
Validate
sudo fleet secrets validateCross-references vault contents against Docker Compose secrets: blocks. Reports missing or extra secrets per app.
Status
sudo fleet secrets statusShows vault initialisation state, seal status, and per-app summary.
Drift detection
sudo fleet secrets driftCompares vault contents against runtime files. Reports one of three statuses per app:
- in-sync — vault and runtime match
- drifted — runtime has been modified since unsealing
- missing-runtime — vault has secrets but runtime is empty (sealed)
Uses timing-safe comparison to prevent side-channel leaks.
Restore from backup
sudo fleet secrets restore myappThe safe seal operations create automatic backups before modifying vault files. If a seal fails, use restore to roll back to the previous version.
Rotate the key
sudo fleet secrets rotateGenerates a new age key, re-encrypts all vault files, and updates the key file. The old key is removed.