Secret Rotation
Rotation Schedule
| Secret | Rotation Frequency | Impact of Rotation |
|---|---|---|
JWT_SECRET | Quarterly | All active sessions invalidated |
AGENT_ENROLLMENT_SECRET | After each enrollment batch | Only affects new enrollments |
APP_ENCRYPTION_KEY | Annually | Requires data re-encryption migration |
MFA_ENCRYPTION_KEY | Annually | Users must re-enroll MFA devices |
POSTGRES_PASSWORD | Quarterly | Requires coordinated DB + app restart |
METRICS_SCRAPE_TOKEN | Quarterly | Update Prometheus config + API |
SESSION_SECRET | Quarterly | All active sessions invalidated |
Rotating JWT Secret
-
Generate a new secret:
Terminal window openssl rand -base64 64 -
Update
.env.prodwith the newJWT_SECRET -
Restart the API:
Terminal window docker compose -f docker/docker-compose.prod.yml restart api -
All existing JWTs become invalid — users will need to log in again
Rotating Agent Enrollment Secret
-
Generate a new secret:
Terminal window openssl rand -hex 32 -
Update
.env.prodwith the newAGENT_ENROLLMENT_SECRET -
Restart the API
-
Update any deployment scripts or MDM policies with the new secret
Rotating Database Password
-
Generate a new password:
Terminal window openssl rand -base64 24 | tr -d '/+=' -
Update the password in PostgreSQL:
Terminal window docker compose -f docker/docker-compose.prod.yml exec postgres \psql -U breeze -c "ALTER USER breeze PASSWORD 'new-password';" -
Update
POSTGRES_PASSWORDandDATABASE_URLin.env.prod -
Restart the API:
Terminal window docker compose -f docker/docker-compose.prod.yml restart api
Rotating Metrics Token
-
Generate a new token:
Terminal window openssl rand -hex 32 -
Update
METRICS_SCRAPE_TOKENin.env.prod -
Update the token file:
Terminal window echo "new-token" > monitoring/secrets/metrics_scrape_tokenchmod 600 monitoring/secrets/metrics_scrape_token -
Restart API and Prometheus:
Terminal window docker compose -f docker/docker-compose.prod.yml restart api prometheus