Appearance
Secrets at rest and backups
PBXsight's database holds credentials for your PBX: the ESL password (full control of FreeSWITCH), agent tokens, and the SIP passwords of every test extension. They are encrypted with a key that is kept outside the database, so a copied database file, a backup or a disk snapshot alone doesn't reveal them. This page explains what is encrypted, where the key lives, and how to back up, restore and move an install without losing access.
First step: back up the database and the key file together, now — pbxsight backup (Back up).
What is encrypted
| Encrypted (AES-256-GCM) | Not encrypted, and why |
|---|---|
| each PBX profile's settings as a whole — including the ESL password, the rtpengine token and tokens inside agent URLs | user passwords: stored as one-way PBKDF2 hashes, never decryptable |
| the SIP password of every uploaded test extension | session tokens: only a SHA-256 of each is stored |
| the licence key: signed, not secret in the same way | |
| run results, samples, logs, schedules, extension user names and domains, the activity log |
Each encrypted value is tied to what it is (a profile or an extension password), so a value copied into another place in the database doesn't decrypt. Secrets are also never returned by the API, never written to run files or logs, and never recorded in the activity log.
A database from a version before encryption is encrypted at the first start of the new version (log: encrypted secrets stored as plain text by an older version), and the file is then compacted so the old plain text doesn't linger in free pages.
The key
On the first start PBXsight creates a random 32-byte key and writes it, base64-encoded, to a key file readable only by its owner (mode 0600):
| Install | Key file |
|---|---|
| .deb / .rpm, Docker | /var/lib/pbxsight/pbxsight.key |
| binary | next to the database: pbxsight.db → pbxsight.key |
| any | storage.secret_key_file if set |
The log says created the secret key file that encrypts stored passwords and tokens; back it up together with the database (without it they cannot be read).
Instead of a file you can give the key itself in PBXSIGHT_STORAGE_SECRET_KEY (32 bytes as base64 or hex, e.g. openssl rand -base64 32). It wins over the file — useful with Docker secrets or a secrets manager, and it keeps the key off the data volume. To switch an existing install to the variable, use the content of the existing key file, not a new key.
For systemd, put the variable in a file only root can read rather than in the unit:
sh
sudo install -m 0600 /dev/null /etc/pbxsight/secret.env
echo "PBXSIGHT_STORAGE_SECRET_KEY=$(sudo cat /var/lib/pbxsight/pbxsight.key)" | sudo tee /etc/pbxsight/secret.env >/dev/null
sudo systemctl edit pbxsight # add: [Service] EnvironmentFile=/etc/pbxsight/secret.envThere is no key rotation tool yet: the key stays the same for the life of the database.
Without the key
At every start PBXsight checks the key against the database:
- Key file missing, database has encrypted values → it refuses to start: the database holds encrypted secrets but the secret key file … is missing: restore it from the backup made with the database (or set PBXSIGHT_STORAGE_SECRET_KEY). It never creates a new key for such a database — that would make the secrets permanently unreadable.
- Wrong key (another install's, a typo in the variable) → it refuses to start: cannot decrypt a stored secret: wrong secret key (the key file or PBXSIGHT_STORAGE_SECRET_KEY does not match this database).
- Key lost for good → the app won't start with that database at all, so its runs and results can't be opened in the app either. The way forward is a new database with new profiles and extension sets — which is why the key belongs in every backup.
Who can read both the database and the key can read the secrets. Keep backups where only administrators reach them.
Back up
pbxsight backup writes one zip with a consistent copy of the database and its secret key. It works while the app runs and a test is writing data (the copy is made by SQLite itself, never a raw file copy):
sh
sudo -u pbxsight pbxsight -config /etc/pbxsight/config.yaml backup /backup/pbxsight-$(date +%F).zip
# backup written to /backup/pbxsight-2026-11-29.zip: database + secret key, schema 7, 412 runs, 9.1 MBDocker: docker compose exec pbxsight pbxsight -config /etc/pbxsight/config.yaml backup /var/lib/pbxsight/backup.zip, then copy the file off the volume.
| In the zip | Why |
|---|---|
pbxsight.db | everything: users, profiles, sets, runs, schedules, licence, activity log |
pbxsight.key | without it the profiles and extension passwords are lost |
manifest.json | app version, schema version, time, number of runs |
- When the key comes from
PBXSIGHT_STORAGE_SECRET_KEYit is not written to the zip; the command warns. Keep the variable's value safe separately. - An existing file is not overwritten unless you add
-force. The zip is readable only by its owner (mode0600): it holds the key, so keep backups where only administrators reach them. - Not included: the run log files in
runs/(tester.work_dir). Results stay readable without them, and data retention removes old ones anyway. Copy the directory too if you want them.
Restore a backup
sh
sudo systemctl stop pbxsight
sudo -u pbxsight pbxsight -config /etc/pbxsight/config.yaml restore /backup/pbxsight-2026-11-29.zip -force
sudo systemctl start pbxsight- Restore refuses while PBXsight is running (stop PBXsight first): the configured listen address is in use or the database is locked.
- It checks the zip first: manifest present, database integrity check OK, and not from a newer version. A backup from an older version can be restored into a newer one (its database is upgraded at the next start), not the other way round.
- The current database (with its
-wal/-shm) and key are kept, renamed to<name>.before-restore-<time>, so a mistaken restore can be undone by hand. Without-forcean existing database is not replaced. - With
PBXSIGHT_STORAGE_SECRET_KEYset, the backup's key is not written; the variable must hold the key of the restored database.
Move to another machine
Same as a restore, on the new machine: install PBXsight, stop it, run pbxsight restore … -force with the backup zip (and copy runs/ if you want the old run logs), start. Then check:
- Profiles: the tester's SIP from / Media from addresses, if set, belong to the old machine — clear them (auto) or set the new addresses.
- Access lists on the PBX side that allow the tester's address: FreeSWITCH's ESL ACL, Kamailio flood protection and JSON-RPC guard, the agents'
allow, firewalls. - HTTPS: a self-signed certificate is recreated for the new names; a company certificate must match the new name.
- Licence: an online key is bound to one installation. Click Move licence on the old machine before you move (or, when you restore the old machine's backup on the new one, stop the old one: two running copies are both refused). An offline key moves with the database. See Moving a licence.
tester.work_dirandstorage.db_pathin the new config, if the paths differ.
Logged-in users stay logged in only if the database moved with its sessions and the browser reaches the same address; otherwise they log in again.