BASTIONOSDocs
bastion-os.com
EN

Operate

Backup and restore

The state of a bastion lives in three places, restored together, plus the keys that open them. One command saves all of it while the bastion keeps running.

What a backup holds#

File Holds
postgres.dump, postgres-roles.sql users, organizations, inventory, policies, the audit chain
openbao.snap account secrets, directory and SSO secrets, the keys of recordings
objects.tar the encrypted recordings
secrets.tar.gpg the installation's keys and passwords, encrypted with your passphrase
MANIFEST the checksums of every file

Console sessions and events in flight are not in it: users sign in again after a restore.

Back up#

$ sudo bastionos backup
$ sudo bastionos backup /mnt/nas/bastionos-2026-11-29

Without a folder, it writes into /var/dck/bastionos/backups/<UTC time>. The bastion keeps running; the object store pauses for the seconds of its copy, and recordings that end meanwhile are stored right after.

The command asks twice for a passphrase of at least 12 characters, which encrypts secrets.tar.gpg (GnuPG, AES-256). gpg must be installed on the host.

Every night#

For a scheduled backup, give the passphrase in a file readable by its owner only, never on the command line:

$ sudo install -m 600 /dev/null /etc/bastionos/backup-passphrase
$ sudo editor /etc/bastionos/backup-passphrase

Then a cron entry, for example /etc/cron.d/bastionos-backup:

15 2 * * * root BASTION_BACKUP_PASSPHRASE_FILE=/etc/bastionos/backup-passphrase /usr/local/bin/bastionos backup "/backup/bastionos/$(date +\%F)" >>/var/log/bastionos-backup.log 2>&1

Copy the backups off the host, and delete old ones on your own schedule.

Restore#

On an installation with no data (a fresh install of the same version, or after bastionos compose down -v on purpose):

$ sudo bastionos restore /mnt/nas/bastionos-2026-11-29
  • It asks for the passphrase, or reads BASTION_BACKUP_PASSPHRASE_FILE. A wrong passphrase or an altered file stops it before anything is written.
  • It checks everything first, and refuses when a file does not match the MANIFEST, or when PostgreSQL, the object store or the bundled OpenBao already hold data. It never deletes.
  • It restores the object store, PostgreSQL, then OpenBao, and starts the stack. The control plane is ready within about a minute.

Test your restores#

A backup you never restored is a hope. Restore on a test host from time to time, and check that you can sign in, replay a recording and open a connection. Operations & HA (Enterprise Ultimate) records and measures these drills.

© 2026 BastionOS · Source-available, self-hosted privileged access Contact