Use when the user asks to set up secret management infrastructure, integrate HashiCorp Vault, configure cloud secret stores (AWS Secrets Manager, Azure Key Vault, GCP Secret Manager), implement secret rotation, or audit secret access patterns.
Use when the user asks to set up secret management infrastructure, integrate HashiCorp Vault, configure cloud secret stores (AWS Secrets Manager, Azure Key Vault, GCP Secret Manager), implement secret rotation, or audit secret access patterns.
Production secret infrastructure management for teams running HashiCorp Vault, cloud-native secret stores, or hybrid architectures. This skill covers policy authoring, auth method configuration, automated rotation, dynamic secrets, audit logging, and incident response.
Distinct from env-secrets-manager which handles local .env file hygiene and leak detection. This skill operates at the infrastructure layer — Vault clusters, cloud KMS, certificate authorities, and CI/CD secret injection.
When to Use
Standing up a new Vault cluster or migrating to a managed secret store
Designing auth methods for services, CI runners, and human operators
Implementing automated credential rotation (database, API keys, certificates)
Auditing secret access patterns for compliance (SOC 2, ISO 27001, HIPAA)
Responding to a secret leak that requires mass revocation
Integrating secrets into Kubernetes workloads or CI/CD pipelines
Two database accounts exist: app_user_a and app_user_b
Application currently uses app_user_a
Rotation rotates app_user_b password, updates secret store
Application switches to app_user_b on next credential fetch
After grace period, app_user_a password is rotated
Cycle repeats
API Key Rotation (Overlap Window)
Generate new API key with provider
Store new key in secret store as current, move old to previous
Deploy applications — they read current
After all instances restarted (or TTL expired), revoke previous
Monitoring confirms zero usage of old key before revocation
Dynamic Secrets
Dynamic secrets are generated on-demand with automatic expiration. Prefer dynamic secrets over static credentials wherever possible.
Database Dynamic Credentials (Vault)
# Configure database engine
vault write database/config/postgres \
plugin_name=postgresql-database-plugin \
connection_url="postgresql://{{username}}:{{password}}@db.example.com:5432/app" \
allowed_roles="app-readonly,app-readwrite" \
username="vault_admin" \
password="<admin-password>"
# Create role with TTL
vault write database/roles/app-readonly \
db_name=postgres \
creation_statements="CREATE ROLE \"{{name}}\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}'; GRANT SELECT ON ALL TABLES IN SCHEMA public TO \"{{name}}\";" \
default_ttl=1h \
max_ttl=24h
Cloud IAM Dynamic Credentials
Vault can generate short-lived AWS IAM credentials, Azure service principal passwords, or GCP service account keys — eliminating long-lived cloud credentials entirely.
SSH Certificate Authority
Replace SSH key distribution with a Vault-signed certificate model:
Vault acts as SSH CA
Users/machines request signed certificates with short TTL (30 min)
SSH servers trust the CA public key — no authorized_keys management
Certificates expire automatically — no revocation needed for normal operations
Audit Logging
What to Log
Event
Priority
Retention
Secret read access
HIGH
1 year minimum
Secret creation/update
HIGH
1 year minimum
Auth method login
MEDIUM
90 days
Policy changes
CRITICAL
2 years (compliance)
Failed access attempts
CRITICAL
1 year
Token creation/revocation
MEDIUM
90 days
Seal/unseal operations
CRITICAL
Indefinite
Anomaly Detection Signals
Secret accessed from new IP/CIDR range
Access volume spike (>3x baseline for a path)
Off-hours access for human auth methods
Service accessing secrets outside its policy scope (denied requests)
Multiple failed auth attempts from single source
Token created with unusually long TTL
Compliance Reporting
Generate periodic reports covering:
Access inventory — Which identities accessed which secrets, when
Rotation compliance — Secrets overdue for rotation
Policy drift — Policies modified since last review
Orphaned secrets — Secrets with no recent access (>90 days)
Use audit_log_analyzer.py to parse Vault or cloud audit logs for these signals.
Emergency Procedures
Secret Leak Response (Immediate)
Time target: Contain within 15 minutes of detection.
Identify scope — Which secret(s) leaked, where (repo, log, error message, third party)
Revoke immediately — Rotate the compromised credential at the source (provider API, Vault, cloud SM)
Invalidate tokens — Revoke all Vault tokens that accessed the leaked secret
Audit blast radius — Query audit logs for usage of the compromised secret in the exposure window
# Pod annotation for Vault Agent Injectorannotations:vault.hashicorp.com/agent-inject:"true"vault.hashicorp.com/role:"api-server"vault.hashicorp.com/agent-inject-secret-db:"database/creds/app-readonly"vault.hashicorp.com/agent-inject-template-db:|
{{- with secret "database/creds/app-readonly" -}}
postgresql://{{ .Data.username }}:{{ .Data.password }}@db:5432/app
{{- end }}
External Secrets Operator (Kubernetes)
For teams preferring declarative GitOps over agent sidecars: