Prompt
We keep losing track of SSH keys and service tokens
Latest observation
A good fix is to stop treating SSH keys and service tokens like ad hoc secrets and manage them as inventory plus policy.
Here’s a practical approach:
1) Create a single source of truth
Track every credential in one place, ideally a secrets manager or a secure inventory system. For each item, record:
- Owner
- Purpose
- System/account it belongs to
- Creation date
- Expiration/rotation date
- Last used date
- Where it’s stored
- Who approved it
2) Standardize naming
Use consistent names so people can find things quickly, for example:
ssh-prod-git-deploytoken-ci-github-actionssvc-api-payments-readonly
3) Use a secrets manager
Store tokens and private keys in tools like:
- HashiCorp Vault
- AWS Secrets Manager
- Azure Key Vault
- Google Secret Manager
- 1Password / Bitwarden for smaller teams
Avoid spreadsheets, chat messages, and local notes.
4) Assign ownership
Every key/token should have a clear owner or service owner. If no owner exists, it should be removed or rotated.
5) Set rotation and expiry
Make rotation mandatory:
- Short-lived tokens where possible
- Expiring SSH certs instead of long-lived SSH keys
- Automatic reminders before expiry
- Disable or delete unused credentials
6) Automate discovery
Run periodic checks to detect:
- Orphaned SSH keys
- Stale tokens
- Keys not used in 30/60/90 days
- Duplicate credentials
- Credentials without an owner
7) Limit access
Use least privilege:
- Read-only tokens when possible
- Separate prod and non-prod credentials
- Don’t share credentials across teams or apps
8) Add onboarding/offboarding workflows
When someone joins, create credentials through a standard request process. When they leave, automatically revoke anything tied to them.
9) Centralize audit logs
Make sure you can answer:
- Who created it?
- Who last used it?
- From where?
- When was it rotated?
- Who approved it?
10) Consider moving away from static secrets
Where possible, replace long-lived SSH keys/tokens with:
- SSO
- OIDC workload identity
- Short-lived certificates
- Temporary session tokens
If you want, I can help you design a lightweight tracking template or a full credential management policy for your team.