Restore¶
Restore an archive¶
A restore runs on the command line, into an empty database and an empty CA directory
(-force overrides both checks). It refuses archives from a newer server version and, unless
forced, a LIMDM_SESSION_KEY other than the one the archive was made with.
- Install the same or a newer server version. Keep the agent port closed (firewall) until step 6.
- Set
LIMDM_SESSION_KEYfrom the separate safe,LIMDM_DATABASE_URLto a new database. limdm-server backup verify -identity limdm-backup.agekey -command-key HEX FILE- Export the audit entries written after the backup, if any copy survived: the syslog
collector (
LIMDM_SYSLOG) or a JSON Lines export. limdm-server backup restore -identity limdm-backup.agekey -command-key HEX -replay audit-after.log FILEloads the database in one transaction, writes the CA directory, opens the restored keys, recordsbackup.restoreand applies the revocations from the replay file (below). Uploaded packages land inartifacts.restorenext to the CA directory; move them intoLIMDM_ARTIFACT_DIR.- Start one instance, check
/readyzand Audit, Verify chain, then open the agent port. Watch the 403 rate of the agent API (limdm_http_requests_total{listener="agent"}). - Note RTO and RPO for the restore record.
With PITR, restore PostgreSQL first with its own tools, then restore only the CA directory
from the archive matching that point (tar from age -d), or run restore into a scratch
database and copy ca/ from there.
What happens automatically, what by hand¶
| After the backup | After the restore |
|---|---|
| a device renewed its certificate | automatic: during the restore window (default 7 days, -window) a certificate the device CA issued after the backup that is valid longer than the pinned one is accepted and pinned as the device's certificate (an older certificate of the device cannot take the pin back) (device.cert_repin audit entry). Retired and unknown devices stay out. After the window such devices must enroll again |
| a device enrolled | by hand: it is unknown to the restored database; enroll it again |
| a device was retired or deleted | automatic with -replay: retired again |
| an enrollment token or API token was revoked | automatic with -replay: revoked again |
| console users disabled or changed, roles, settings, key rotations, library and blueprint changes, approvals | by hand: restore prints every later audit entry it did not apply; review them in order |
| a key rotation step | restore the archive made after the rotation (a rotation triggers a backup); an older CA directory does not match newer device certificates |
-replay reads JSON Lines exports (Audit, export) and the RFC 5424 messages the server
sends to syslog. Only entries with an id above the archive's audit head are used. Syslog
messages carry no signature: replay only a copy you trust (a collector that accepts the
server alone), since a forged line can retire devices. Without a
surviving copy nothing is replayed: retire devices that were lost in between by hand.
The restore window only widens which certificate of an existing, active device is accepted; the chain to the device CA is checked as always, and a certificate issued before the backup is never accepted this way.
Restore test¶
sudo -u limdm limdm-server backup -env /etc/limdm-server/server.env restore-test -identity limdm-backup.agekey -from offsite ARCHIVE
restores the archive into a scratch database (<database>_restore_test, created and dropped
again; needs CREATEDB, or pass -db with an empty scratch database) and a temporary CA
directory, opens the restored keys, verifies the whole audit chain and opens a sealed value.
The result is an audit entry and appears as Restore tested in the history: the evidence for
ISO 27001 A.8.13 and BSI CON.3. Run it monthly (cron or a systemd timer on a host that holds
the age key only for that run), and a full restore on a separate host twice a year
(Restore test).