Deployment

Backup and restore

Save and restore the databases, the stored files and the secrets of a server with the scansuite command.

View as Markdown

Back up and restore the ScanSuite and DefectDojo databases, the stored scan files, and the secrets (.env and key/: licence and encryption keys) with ./scansuite in /opt/scansuite.

Before you start

Run the commands as the account that installed ScanSuite. Check that it runs and the target has room:

bash
cd /opt/scansuite && ./scansuite status    # every service Up; migrate Exited (0)
df -h <BACKUP_DIR>                        # e.g. /mnt/backup, best on another disk

The commands

CommandDoes
./scansuite --backup-db [zip or directory]Saves both databases into one zip.
./scansuite --restore-db <ZIP_FILE>Replaces the databases with a backup.
./scansuite --backup-secrets [zip or directory]Saves .env and key/ into a password-protected zip.
./scansuite --restore-secrets <ZIP_FILE>Puts .env and key/ back.

Also written ./scansuite backup db, restore db, backup secrets, restore secrets. <ZIP_FILE> is the path the backup printed.

OptionForEffect
--with-filesbackup dbAdds scan reports, artifacts and DefectDojo uploads. Stops file storage while copying; needs free space equal to the files. Off by default.
--encryptbackup dbPassword-protects the zip; the password is printed once, to a terminal only. Off by default.
--password-file <file>all fourReads the password from the file; a missing file is created with a new password (owner-only). Implies --encrypt on backup db.
--no-dojobackup dbLeaves out DefectDojo (included when it runs).
--yes, -yrestore db, restore secretsNo confirmation prompt.
--no-safety-backuprestore dbSkips saving the present databases first.
--no-restartrestore secretsNo restart afterwards.

Without a terminal (cron), a password-protected backup needs --password-file, or it is refused. Default location: /opt/scansuite/backups/scansuite-teams-db-YYYYMMDD-HHMMSS.zip (or -secrets-). A directory argument keeps that name; existing files are never replaced. Zips are owner-readable only.

Copy the backups off the server: a backup on the disk it protects is lost with it.

Back up the databases

Shell
cd /opt/scansuite && ./scansuite --backup-db <BACKUP_DIR>

ScanSuite keeps running. Expected: [+] Databases saved to <ZIP_FILE> (size). unzip -l <ZIP_FILE> lists MANIFEST, scansuite.dump, defectdojo.dump (if DefectDojo runs) and files/ (with --with-files).

Without --with-files, a restore brings back scans and findings but not the stored report files.

A nightly backup

In sudo crontab -e: a protected backup at 02:00 and deletion of database backups older than 14 days. The first run creates the password file; later runs reuse it.

crontab
0 2 * * * cd /opt/scansuite && ./scansuite --backup-db /mnt/backup --password-file /root/scansuite-backup.pass > /var/log/scansuite-backup.log 2>&1
30 3 * * * find /mnt/backup -name 'scansuite-teams-db-*.zip' -mtime +14 -delete

Keep the password file off the backup disk and copy the password into a password manager after the first run: the zips do not open without it.

Check next morning: tail -3 /var/log/scansuite-backup.log shows Databases saved to /mnt/backup/….

Restore the databases

Scans, findings, accounts and settings created after the backup are lost.

Shell
cd /opt/scansuite && ./scansuite --restore-db <ZIP_FILE>

The command checks the zip first, then:

  • refuses a backup from a newer release or schema (run ./scansuite update first) or a newer PostgreSQL;
  • warns if the backup used other encryption keys: restore its secrets backup too;
  • asks Restore the databases? (unless --yes);
  • saves the present databases to backups/before-restore-<date>.zip (unless --no-safety-backup);
  • stops ScanSuite for a few minutes, restores, upgrades an older backup and starts again.

Expected: [+] Databases restored from <ZIP_FILE>. On failure the message names the command that puts the before-restore zip back. Then ./scansuite doctor should report No problems found.

The before-restore copy holds no stored files and has no password. Before restoring a --with-files backup, make your own --with-files backup if you may need the current files.

Back up the secrets

Shell
cd /opt/scansuite && ./scansuite --backup-secrets <BACKUP_DIR>

The zip holds .env, the licence and key/scansuite-secrets.env (the keys that encrypt stored credentials):

Output
[+] Secrets saved to /mnt/backup/scansuite-teams-secrets-20261011-132509.zip
[!] The file opens only with this password. It is shown once and stored nowhere:

    <32 characters>

[*] Keep it apart from the file.

Write the password down (password manager) when it is shown. Make a new secrets backup whenever .env, the licence or the keys change.

A database backup is useless without the secrets backup of the same installation: other keys cannot decrypt the stored credentials.

Restore the secrets

Shell
cd /opt/scansuite && ./scansuite --restore-secrets <ZIP_FILE>

It asks for the password (or reads --password-file or SCANSUITE_BACKUP_PASSWORD), asks Restore the secrets?, moves the present files to .replaced-<date>/, restores them and restarts the services if ScanSuite was running. Expected: [+] Restored .env and key/. Otherwise run ./scansuite restart; if it says the release has no images here, run ./scansuite update.

Move to a new server

  1. 01
    Back up the old server

    Note the secrets password.

    Shell
    cd /opt/scansuite && ./scansuite --backup-db --with-files && ./scansuite --backup-secrets
  2. 02
    Copy both zips to the new server

    For example with scp to /root/restore.

  3. 03
    Install ScanSuite on the new server

    With your licence (Install ScanSuite Teams). Do not create an account on /setup: the restore brings the accounts back. Without the release images yet, first run sudo apt install -y zip unzip.

  4. 04
    Restore the secrets first
    Shell
    cd /opt/scansuite && ./scansuite --restore-secrets <ZIP_FILE>
  5. 05
    Restore the databases
    Shell
    ./scansuite --restore-db <ZIP_FILE>
  6. 06
    Check

    Same release as the old server, No problems found, and an old account can sign in.

    Shell
    ./scansuite version && ./scansuite doctor

How the zips are protected

Standard zip password protection: any zip program opens them with the password. It is weaker than modern encryption, so store the zips like any other secret.

Installs on Google Cloud or Azure use managed services with their own backups: Install on Google Cloud, Install on Microsoft Azure.

Last reviewed 2026-11-19