Secret Rotation Runbook
Overview
Cordum uses five credential groups that must be rotated periodically or after any suspected compromise. All secrets live in .env (never committed — see .gitignore). Reference .env.example for the full variable catalog.
Secrets
| Secret | Env Var | Min Length | Generate | Used By |
|---|---|---|---|---|
| Redis password | REDIS_PASSWORD | 12 chars | openssl rand -hex 16 | All services via REDIS_URL |
| API key | CORDUM_API_KEY | 32 chars | openssl rand -hex 32 | Gateway, dashboard |
| Admin password | CORDUM_ADMIN_PASSWORD | 16 chars | openssl rand -base64 24 | Gateway (user auth) |
| NATS token | NATS_TOKEN | 16 chars | openssl rand -hex 16 | All services via NATS auth |
| License token | CORDUM_LICENSE_TOKEN | n/a | Issued by licensing portal | Gateway, scheduler, safety kernel, workflow engine |
Rotation Procedures
Redis Password
- Generate new password:
openssl rand -hex 16 - Update Redis ACL:
redis-cli ACL SETUSER default on >'<new-password>' - Update
.envwith newREDIS_PASSWORD - Restart all Cordum services (gateway, scheduler, workflow engine, context engine)
- Verify connectivity:
redis-cli -a '<new-password>' PING
Zero-downtime: Update Redis ACL first, then roll services one at a time.
API Key
- Generate new key:
openssl rand -hex 32 - Update
.envwith newCORDUM_API_KEY - Restart the gateway
- Update all API clients (dashboard, CLI, external integrations) with the new key
- Verify:
curl -H 'X-API-Key: <new-key>' http://localhost:8081/api/v1/health
Zero-downtime: Use CORDUM_API_KEYS (JSON array) to support both old and new keys during transition. Remove old key after all clients are updated.
Admin Password
- Generate new password:
openssl rand -base64 24 - Update
.envwith newCORDUM_ADMIN_PASSWORD - Restart the gateway (new password takes effect on next login)
- Log in with new credentials to verify
NATS Token
The NATS token is set in two places: .env (for services) and config/nats.dev-tls.conf (for the NATS server). Both must match.
- Generate new token:
openssl rand -hex 16 - Update
NATS_TOKENin.env - Update
authorization.tokeninconfig/nats.dev-tls.conf - Restart NATS and all dependent services:
docker compose down && docker compose up -d - Verify: check service logs for NATS connection errors
Note: Unlike Redis, NATS does not support live token rotation. All services must be restarted together.
After a Suspected Compromise
- Rotate ALL three secrets immediately
- Check audit logs for unauthorized access
- Revoke all active sessions
- Review recent API key usage patterns
- Notify team via secure channel
Validation
The gateway validates secret strength at startup when CORDUM_ENV=production. Weak secrets are rejected with actionable error messages. Set CORDUM_SKIP_SECRET_VALIDATION=true only for development.