Backup and Recovery
What to Back Up
| Component | Criticality | Recovery Impact |
|---|---|---|
| Database | Critical | Loss of user registrations, sessions, authenticator records |
| SSH CA private key | Critical | Must re-distribute new CA public key to all hosts |
| OIDC signing key (ES256) | High | Token verification fails until new key distributed |
| OIDC RSA signing key (RS256) | High | RS256 ID token verification fails until new key distributed |
| JWT secret | High | All sessions invalidated on change |
| TLS certificate & key | Medium | Service unavailable until replaced |
| Server configuration | Medium | Can be reconstructed from documentation |
Backup Strategy
Database
SQLite:
# Simple file copy (stop writes first or use backup API)
cp /data/vouch.db /backup/vouch.db.$(date +%Y%m%d_%H%M%S)
# Or use SQLite backup command (safe during writes)
sqlite3 /data/vouch.db ".backup '/backup/vouch.db.backup'"
PostgreSQL:
pg_dump -Fc vouch > /backup/vouch.$(date +%Y%m%d_%H%M%S).dump
Frequency: Daily minimum. More frequent for high-activity deployments.
Cryptographic Keys
Back up all keys to a secure, offline location:
# SSH CA key
cp ssh_ca_key /secure-backup/ssh_ca_key
# OIDC signing key (ES256)
cp oidc_signing_key.pem /secure-backup/oidc_signing_key.pem
# OIDC RSA signing key (RS256) — if configured
cp oidc_rsa_key.pem /secure-backup/oidc_rsa_key.pem
Store key backups:
- Encrypted at rest
- In a separate location from the server
- With restricted access (minimum two-person rule for production)
Recovery Procedures
Full Server Recovery
- Deploy new server with the same configuration
- Restore database from backup
- Restore cryptographic keys (SSH CA, OIDC signing, JWT secret)
- Start the server — migrations run automatically if needed
- Verify:
curl https://auth.example.com/health
Lost SSH CA Key
If the SSH CA key is lost and no backup exists:
- Generate a new SSH CA key
- Distribute the new public key to all SSH hosts
- Configure Vouch with the new key
- All users must run
vouch loginto get new certificates
Lost JWT Secret
If the JWT secret changes (lost or compromised):
- Set the new
VOUCH_JWT_SECRET - Restart the server
- All existing sessions are invalidated
- Users must run
vouch loginagain
Database Corruption
- Stop the server
- Restore from backup
- Users who enrolled after the backup will need to re-enroll
- Start the server
Disaster Recovery Testing
Periodically test your recovery procedures:
- Restore a database backup to a test environment
- Start a test server with production keys
- Verify enrollment, login, and credential flows
- Document any issues and update procedures