9.7 Disaster recovery of the server
If the server machine dies, its state can be rebuilt on a new machine from any repository that is marked as the target for configuration backups. The agents reconnect on their own, because the internal CA and the server key come back unchanged. This page covers the preparation and the procedure.
Preparation: the configuration backup repository
A configuration backup contains the catalog and the server's keys. It therefore lives in a repository that no agent can use or reach:
The API refuses
config_backup: truewhile agent jobs use the repository. Backup jobs and restore tests of agents on a configuration backup repository are refused (also on targets of copy jobs withinclude_system).The agent endpoint refuses every request of an agent for such a repository.
A configuration backup into a repository that agent jobs use is skipped with an error.
Set up one small repository for it (a folder on another disk, a NAS share or a bucket) and tick Store server configuration backups here (server only: agents cannot use this repository) when you create or edit it. The column Config backup in the repository list shows which repository receives them. Copy jobs with include_system can additionally copy the configuration backups offsite into another repository that agents do not use. Chapter 08 Repositories and Storage describes how to create repositories.
Setting the DR passphrase
Configuration backups need a DR passphrase. Under Settings in the Disaster recovery section click Set DR passphrase. It is shown once (the server does not store it) and offered as a text file (Download recovery kit). Without a passphrase the section reads "not set: configuration backups fail". Replace DR passphrase affects only configuration backups made afterwards; older ones keep the old passphrase. In the API: PUT /api/v1/system/dr-passphrase (Administrator).
The Protect this server section on the Recovery medium page walks through the preparation: 1. agent on this server, 2. image of the system disk (a job, weekly Sun 02:00 or daily 02:00, into a repository on another disk or the NAS), 3. configuration backup (target repository, DR passphrase status, "daily and right after every server image"), 4. recovery kit (repository, passphrase and the steps to restore without a running server; print it or keep it offline), plus the recovery ISO.
What is backed up
Every day at config_backup_time (default 03:30 local time, in server.toml) and on demand (POST /api/v1/system/config-backup, Administrator), the server writes a snapshot tagged pdc:system=server into every initialized repository that has config_backup set. It contains, under /pdc-server-config:
File | Content |
|---|---|
| Consistent copy of the catalog: users, agents, repositories, jobs, runs, snapshot cache and registry, audit log, encrypted secrets |
| Internal CA ( |
| Server settings |
| The secret master key, wrapped with the DR passphrase (Argon2id 64 MiB, 3 passes, XChaCha20-Poly1305) |
| Format 2, server version, host name, CA fingerprint, time |
The snapshot itself is encrypted with the repository passphrase like every other snapshot. That passphrase alone opens the catalog (user names, password hashes, job definitions), not the secrets or private keys; those need the master key, and the master key needs the DR passphrase. The server's master key file (secret.key) is not copied as is; on Windows it is bound to the machine by DPAPI.
Retention for configuration backups, per repository: the last 7, plus one per day for 14 days and one per month for 12 months (registered snapshots only).
What you need (recovery kit)
Keep these outside the server, for example printed or in a password manager:
Repository location: path, UNC path, or
s3:<endpoint>/<bucket>/<prefix>, and for S3 the access key and secret key.Repository passphrase of the configuration backup repository. Administrators can show it in the interface (
GET /api/v1/repositories/{id}/password, audited).The DR passphrase (its own kit file), kept apart from the repository passphrase.
The snapshot ID of the configuration backup to restore: under Settings in the Disaster recovery section, or
GET /api/v1/system/dr(last_backups[].snapshot). Write down the latest one from time to time; without itdr restorelists the candidates and you pick one.The address the agents use to reach the server (host name or IP from the enrollment commands).
Without the repository passphrase nobody can read the repository, including PDC-Backup. Without the DR passphrase the catalog can be read, but not the stored secrets and keys: the restored server would be unusable.
Procedure
Install pdc-server on the new machine, but do not start the service yet. Windows: copy
pdc-server.exe. Linux: install the binary and the systemd unit.Make the repository reachable: attach the USB disk, mount the NAS share (Linux), or make sure the S3 endpoint is reachable.
Write the passphrases into files that only you can read (only the first line counts). Without
--dr-passphrase-filethe command asks for the DR passphrase on the terminal.Restore into an empty data directory, naming the configuration backup.
Delete the passphrase files.
Set up and start the service.
Make the server reachable under its old name.
Check in the web interface.
Step 3: passphrase files
printf '%s\n' 'the repository passphrase' > /root/repo-pass.txt && chmod 600 /root/repo-pass.txt
printf '%s\n' 'the DR passphrase' > /root/dr-pass.txt && chmod 600 /root/dr-pass.txt
Step 4: restore
pdc-server dr restore writes the catalog, PKI and settings into the data directory, unwraps the master key with the DR passphrase and stores it protected for this machine (DPAPI on Windows, mode 0600 on Linux). At the end it prints the CA fingerprint of the restored server; compare it with your records.
Windows
In an elevated PowerShell:
.\pdc-server.exe dr restore --repo "E:\Backups\pdc-server" --password-file C:\temp\repo-pass.txt --dr-passphrase-file C:\temp\dr-pass.txt --snapshot 3f9c2a7b1e04 --data-dir C:\ProgramData\PDC-Backup\serverLinux (local or mounted)
sudo pdc-server dr restore --repo /mnt/nas/pdc-server --password-file /root/repo-pass.txt \
--dr-passphrase-file /root/dr-pass.txt --snapshot 3f9c2a7b1e04 --data-dir /var/lib/pdc-backupLinux (S3)
The keys can also come from the environment variables PDC_S3_ACCESS_KEY_ID and PDC_S3_SECRET_ACCESS_KEY.
sudo pdc-server dr restore --repo s3:https://s3.example.com/backups/pdc-server \
--s3-access-key-id AKIA... --s3-secret-access-key '...' --s3-region us-east-1 \
--password-file /root/repo-pass.txt --dr-passphrase-file /root/dr-pass.txt \
--snapshot 3f9c2a7b1e04 --data-dir /var/lib/pdc-backupOptions of pdc-server dr restore:
Option | Effect | Default |
|---|---|---|
| Repository location: a path (local disk, mounted share, UNC path) or | β |
| File containing the repository passphrase (first line). | β |
| File containing the DR passphrase (first line). | asked on the terminal |
| Snapshot ID of the configuration backup (full, or at least 8 characters). Without this option nothing is restored: the command lists the configuration backups in the repository (ID, time, host, newest first) and exits. It never picks the newest one by itself, because a repository can contain snapshots the server did not write. | β |
| Empty data directory of the new server (global option of | β |
| Replaces an existing catalog in the data directory. | off |
| Accepts a configuration backup made before the security hardening (format 1, master key wrapped with the repository passphrase). Only use it if you trust everybody who knew that passphrase. | off |
| Only for a server that runs as root (see below). | off |
| S3 access; the keys can also come from | β |
Linux, run as root: the data directory must already exist and belong to the service account (the packages create /var/lib/pdc-backup that way; by hand: sudo install -d -m 0700 -o pdc-backup -g pdc-backup /var/lib/pdc-backup). The command gives everything it wrote (catalog.db with -wal/-shm, pki/, server.toml, secret.key) to the owner of the data directory and prints Restored files belong to <uid>:<gid> ..., also after a failed run, so no manual chown is needed. It only changes entries inside the data directory, never follows symbolic links, skips files with more than one hard link and anything on a file system mounted below the data directory (each with a warning). Before anything is written it refuses to start when the data directory does not exist or is owned by root (--allow-root-owner only for a server that runs as root), and when one of the names it writes is a symbolic link. On a network file system (cifs, smb, nfs, 9p, fuse) nothing is chowned; a warning says that the share has to give pdc-backup access. Running the command as the service account (sudo -u pdc-backup pdc-server dr restore ..., with password files and repository readable by it) also works.
Steps 6 to 8
Service: Windows
.\pdc-server.exe service install(restricts the data directory to SYSTEM and Administrators) andStart-Service PDCBackupServer. Linuxsudo systemctl enable --now pdc-server.Reachability under the old name: agents connect to the address in their
agent.toml(server_url). Either give the new machine the old IP or DNS name, or add the new name topublic_namesinserver.tomland changeserver_urlon each agent. If the host name changed, the server reissues its certificate from the same CA at start; agents trust it because the CA is the same.Check: agents come online within a minute (their reconnect backoff is at most 60 seconds), jobs and schedules are there, and repositories answer Test with
password_ok: true.
After the restore
Runs that were in progress when the configuration backup was taken show as failed ("interrupted"); only the configuration backup run itself counts as successful, because the restore proves it.
Changes made after the last configuration backup are lost: new jobs, enrollments, runs and log lines from that period. Agents enrolled after it have to be enrolled again. Snapshots are not lost: they live in the repositories. Refresh the snapshot list per repository (
POST /api/v1/repositories/{id}/snapshots/refresh) to see backups made after the configuration backup.Login sessions of the old server stay valid until they expire; if the old machine was stolen, change the admin password to sign out everywhere.
Alternatively, the whole server can be restored with its image using the recovery medium (see section 9.6 Recovery media and bare-metal restore), provided the server itself was backed up as an image (Protect this server).
Without PDC-Backup
Repositories use the restic format. If PDC-Backup itself is unavailable, the stock restic command line can read them with the passphrase, for example restic -r /mnt/nas/pdc snapshots and restic -r /mnt/nas/pdc restore <id> --target /restore.
Upgrading from a version before the security hardening
Set a DR passphrase; until then configuration backups fail.
If a repository was both configuration backup target and used by agent jobs, agents lose access to it and configuration backups into it fail: move the agent jobs to another repository, or clear the flag and use a new server-only repository. Older configuration backups in such a repository contain the CA key in plain text and the master key wrapped with the repository passphrase that every agent of the repository received. If any of these agents may have been compromised, treat the CA as compromised (new server, re-enroll the agents). Forget those snapshots and prune before agents get access again.
ca.keyandserver.keyare encrypted on the first start (the files then begin withpdcs1:).
Regular tasks
When | What |
|---|---|
daily (automatic) | Check the dashboard or the daily report: red/yellow machines, failed runs |
weekly | Maintenance job per repository; free storage; pending agent updates (Deployment) |
monthly | Check job with data portion; restore test; cross-check one recovery kit |
after updates | Install the server setup over the existing installation, then update all outdated agents under Deployment |