billingHelp

Keeping backups off the server

Why archives must leave the server, how to download or copy them, where to keep the master key, and how to open an archive elsewhere.

Nightly archives are written to data/backups/ on the server itself. A copy only on the same server does not survive the loss of that server, so keep copies elsewhere. Automatic SFTP and S3 upload are planned for a later release; until then, copy archives yourself.

Nightly backup and weekly restore drill Every night the database is dumped as the backup user and packed into a tar archive together with config.php, uploads, GeoIP files and licensed downloads, plus a manifest with the size and SHA-256 of every member and the row count of every table. The archive is encrypted with AES-256-GCM in chunks, with a key derived from the master key, and written to data/backups. Retention keeps 7 daily, 4 weekly and 12 monthly archives. Every week the drill decrypts the newest archive, loads it into a scratch database, compares every table's row count and every file's checksum, and drops the scratch database. Download archives regularly to keep a copy off the server; keep the master key off the server too. Dumpbackup DB user Tar + manifestfiles, counts, sha256 AES-256-GCMkey from master key data/backups/GFS 7 · 4 · 12 Off-box copydownload / copy weekly Weekly restore drilldecrypt → scratch DB → compare counts and files
Nightly backup and weekly restore drill
Text description

Every night the database is dumped as the backup user and packed into a tar archive together with config.php, uploads, GeoIP files and licensed downloads, plus a manifest with the size and SHA-256 of every member and the row count of every table. The archive is encrypted with AES-256-GCM in chunks, with a key derived from the master key, and written to data/backups. Retention keeps 7 daily, 4 weekly and 12 monthly archives. Every week the drill decrypts the newest archive, loads it into a scratch database, compares every table's row count and every file's checksum, and drops the scratch database. Download archives regularly to keep a copy off the server; keep the master key off the server too.

The two keys to recovery#

  1. An archive — encrypted; useless without the master key.
  2. The master key — data/keys/master.key, shown once at installation. It also decrypts the gateway keys inside the database. Keep it in a password manager or a safe, never in the same place as the archives.

Copying archives#

  • Download the newest archive on Super → Backups. The download is audited, and the response carries the archive's SHA-256 so you can check the copy.
  • Or copy with scp or rsync from another machine, then press I made an off-box copy on the same screen:
rsync -av --ignore-existing [email protected]:/var/www/encrypted.com/data/backups/ ~/billing-backups/

Each copy counts for 8 days; after that the screen and the self-check remind you again. A weekly copy is a sensible minimum; daily if you take many payments.

Opening an archive elsewhere#

On any machine with PHP and the release files:

php app/cli.php backup:decrypt billing-20261110-023700.bkp out.tar --key-file=master.key
tar -tf out.tar

backup:extract decrypts and unpacks in one step and checks every file against the manifest. The full restore procedure is in Backups and restore.