[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7A8JYK4D0F8SY0ER8SCYS6H":3,"skill-same:01M7A8JYK4D0F8SY0ER8SCYS6H":84},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":47,"commitSha":48,"skillDirectory":49,"forksCount":14,"repositoryHtmlUrl":50,"repositoryHomepageUrl":6,"ownerHtmlUrl":51,"ownerBlogUrl":6,"ownerDescription":52,"updatedAt":53,"install":54,"resources":67},"01M7A8JYK4D0F8SY0ER8SCYS6H","implementing-secrets-management-with-vault",null,"Deploy HashiCorp Vault for centralized secrets management, covering dynamic secret generation for databases and cloud providers, transit encryption, PKI certificate management, and Kubernetes integration. Use when eliminating hardcoded credentials from application code or CI\u002FCD pipelines, migrating to short-lived auto-rotated secrets, or giving Kubernetes workloads secure access to database or cloud provider credentials.","NeelakshSaxena\u002FVayu","NeelakshSaxena","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F87892838?v=4","01M7A3B9YFS6F6N9DD1787DT86","Neelaksh Saxena","01M7A3B9ZKBT09MNMPX2XN69BY",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fimplementing-secrets-management-with-vault\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fimplementing-secrets-management-with-vault\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: implementing-secrets-management-with-vault\ndescription: 'Deploy HashiCorp Vault for centralized secrets management, covering dynamic\n  secret generation for databases and cloud providers, transit encryption, PKI certificate\n  management, and Kubernetes integration. Use when eliminating hardcoded credentials\n  from application code or CI\u002FCD pipelines, migrating to short-lived auto-rotated\n  secrets, or giving Kubernetes workloads secure access to database or cloud provider\n  credentials.\n\n  '\ndomain: cybersecurity\nsubdomain: cloud-security\ntags:\n- hashicorp-vault\n- secrets-management\n- dynamic-secrets\n- credential-rotation\n- zero-trust\nversion: 1.0.0\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- PR.IR-01\n- ID.AM-08\n- GV.SC-06\n- DE.CM-01\nmitre_attack:\n- T1078.004\n- T1530\n- T1537\n- T1580\n- T1003\n---\n\n# Implementing Secrets Management with Vault\n\n## When to Use\n\n- When applications store database passwords, API keys, or certificates in environment variables or config files\n- When migrating from static long-lived credentials to dynamic short-lived secrets\n- When Kubernetes workloads need secure access to database credentials or cloud provider APIs\n- When compliance requirements mandate centralized credential management with audit logging\n- When CI\u002FCD pipelines contain hardcoded secrets that represent supply chain risk\n\n**Do not use** for AWS-only environments where AWS Secrets Manager suffices without multi-cloud requirements, for application-level encryption logic (though Vault Transit can help), or for identity federation (see managing-cloud-identity-with-okta).\n\n## Prerequisites\n\n- HashiCorp Vault server deployed in HA mode (Consul or Raft storage backend)\n- TLS certificates for Vault listener endpoints\n- Vault Enterprise license for namespaces, Sentinel policies, and replication (optional)\n- Kubernetes cluster with Vault Agent Injector or CSI provider for workload integration\n\n## Workflow\n\n### Step 1: Deploy Vault in High Availability Mode\n\nDeploy Vault using Integrated Storage (Raft) for HA without external dependencies. Configure TLS, audit logging, and auto-unseal using a cloud KMS.\n\n```hcl\n# vault-config.hcl\nstorage \"raft\" {\n  path    = \"\u002Fopt\u002Fvault\u002Fdata\"\n  node_id = \"vault-node-1\"\n\n  retry_join {\n    leader_api_addr = \"https:\u002F\u002Fvault-node-2.internal:8200\"\n  }\n  retry_join {\n    leader_api_addr = \"https:\u002F\u002Fvault-node-3.internal:8200\"\n  }\n}\n\nlistener \"tcp\" {\n  address     = \"0.0.0.0:8200\"\n  tls_cert_file = \"\u002Fopt\u002Fvault\u002Ftls\u002Fvault.crt\"\n  tls_key_file  = \"\u002Fopt\u002Fvault\u002Ftls\u002Fvault.key\"\n}\n\nseal \"awskms\" {\n  region     = \"us-east-1\"\n  kms_key_id = \"alias\u002Fvault-unseal-key\"\n}\n\napi_addr      = \"https:\u002F\u002Fvault-node-1.internal:8200\"\ncluster_addr  = \"https:\u002F\u002Fvault-node-1.internal:8201\"\n\ntelemetry {\n  prometheus_retention_time = \"30s\"\n  disable_hostname         = true\n}\n```\n\n```bash\n# Initialize Vault\nvault operator init -key-shares=5 -key-threshold=3\n\n# Enable audit logging\nvault audit enable file file_path=\u002Fvar\u002Flog\u002Fvault\u002Faudit.log\n\n# Enable syslog audit for SIEM integration\nvault audit enable syslog tag=\"vault\" facility=\"AUTH\"\n```\n\n### Step 2: Configure Authentication Methods\n\nEnable authentication backends for human operators, applications, and CI\u002FCD pipelines. Use AppRole for machine authentication and OIDC for human access.\n\n```bash\n# Enable OIDC auth for human users via Okta\nvault auth enable oidc\nvault write auth\u002Foidc\u002Fconfig \\\n  oidc_discovery_url=\"https:\u002F\u002Fcompany.okta.com\u002Foauth2\u002Fdefault\" \\\n  oidc_client_id=\"vault-client-id\" \\\n  oidc_client_secret=\"vault-client-secret\" \\\n  default_role=\"default\"\n\n# Enable AppRole for application authentication\nvault auth enable approle\nvault write auth\u002Fapprole\u002Frole\u002Fweb-app \\\n  secret_id_ttl=10m \\\n  token_num_uses=10 \\\n  token_ttl=20m \\\n  token_max_ttl=30m \\\n  secret_id_num_uses=1 \\\n  token_policies=\"web-app-policy\"\n\n# Enable Kubernetes auth for pod-based access\nvault auth enable kubernetes\nvault write auth\u002Fkubernetes\u002Fconfig \\\n  kubernetes_host=\"https:\u002F\u002Fkubernetes.default.svc:443\" \\\n  token_reviewer_jwt=@\u002Fvar\u002Frun\u002Fsecrets\u002Fkubernetes.io\u002Fserviceaccount\u002Ftoken \\\n  kubernetes_ca_cert=@\u002Fvar\u002Frun\u002Fsecrets\u002Fkubernetes.io\u002Fserviceaccount\u002Fca.crt\n```\n\n### Step 3: Enable Dynamic Secret Engines\n\nConfigure database secret engines to generate short-lived credentials on demand. Each credential set has a TTL and is automatically revoked when it expires.\n\n```bash\n# Enable database secrets engine for PostgreSQL\nvault secrets enable database\nvault write database\u002Fconfig\u002Fproduction-db \\\n  plugin_name=postgresql-database-plugin \\\n  allowed_roles=\"readonly,readwrite\" \\\n  connection_url=\"postgresql:\u002F\u002F{{username}}:{{password}}@db.internal:5432\u002Fproduction?sslmode=require\" \\\n  username=\"vault_admin\" \\\n  password=\"initial-password\"\n\n# Rotate the root credentials so Vault manages them exclusively\nvault write -force database\u002Frotate-root\u002Fproduction-db\n\n# Create a readonly role with 1-hour TTL\nvault write database\u002Froles\u002Freadonly \\\n  db_name=production-db \\\n  creation_statements=\"CREATE ROLE \\\"{{name}}\\\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}'; GRANT SELECT ON ALL TABLES IN SCHEMA public TO \\\"{{name}}\\\";\" \\\n  revocation_statements=\"REVOKE ALL ON ALL TABLES IN SCHEMA public FROM \\\"{{name}}\\\"; DROP ROLE IF EXISTS \\\"{{name}}\\\";\" \\\n  default_ttl=\"1h\" \\\n  max_ttl=\"24h\"\n\n# Enable AWS secrets engine for dynamic IAM credentials\nvault secrets enable aws\nvault write aws\u002Fconfig\u002Froot \\\n  access_key=AKIAEXAMPLE \\\n  secret_key=secretkey \\\n  region=us-east-1\n\nvault write aws\u002Froles\u002Fdeploy-role \\\n  credential_type=iam_user \\\n  policy_document=@deploy-policy.json \\\n  default_sts_ttl=3600\n```\n\n### Step 4: Integrate with Kubernetes Workloads\n\nUse the Vault Agent Injector or CSI Provider to deliver secrets to pods without application code changes. Secrets are rendered as files in a shared volume.\n\n```yaml\n# Kubernetes deployment with Vault Agent Injector annotations\napiVersion: apps\u002Fv1\nkind: Deployment\nmetadata:\n  name: web-app\nspec:\n  template:\n    metadata:\n      annotations:\n        vault.hashicorp.com\u002Fagent-inject: \"true\"\n        vault.hashicorp.com\u002Frole: \"web-app\"\n        vault.hashicorp.com\u002Fagent-inject-secret-db-creds: \"database\u002Fcreds\u002Freadonly\"\n        vault.hashicorp.com\u002Fagent-inject-template-db-creds: |\n          {{- with secret \"database\u002Fcreds\u002Freadonly\" -}}\n          export DB_USERNAME=\"{{ .Data.username }}\"\n          export DB_PASSWORD=\"{{ .Data.password }}\"\n          {{- end }}\n    spec:\n      serviceAccountName: web-app\n      containers:\n        - name: web-app\n          image: company\u002Fweb-app:v2.1\n          command: [\"\u002Fbin\u002Fsh\", \"-c\", \"source \u002Fvault\u002Fsecrets\u002Fdb-creds && .\u002Fstart.sh\"]\n```\n\n### Step 5: Implement Transit Encryption and PKI\n\nUse the Transit secrets engine for application-level encryption without managing keys in application code. Deploy the PKI engine for automatic TLS certificate management.\n\n```bash\n# Enable Transit engine for encryption as a service\nvault secrets enable transit\nvault write -f transit\u002Fkeys\u002Fpayment-data type=aes256-gcm96\n\n# Encrypt sensitive data\nvault write transit\u002Fencrypt\u002Fpayment-data \\\n  plaintext=$(echo \"card-number-4111-1111-1111-1111\" | base64)\n\n# Enable PKI for internal certificate management\nvault secrets enable pki\nvault secrets tune -max-lease-ttl=87600h pki\n\n# Generate root CA\nvault write pki\u002Froot\u002Fgenerate\u002Finternal \\\n  common_name=\"Internal Root CA\" \\\n  ttl=87600h\n\n# Configure intermediate CA for issuing certificates\nvault secrets enable -path=pki_int pki\nvault write pki_int\u002Fintermediate\u002Fgenerate\u002Finternal \\\n  common_name=\"Internal Intermediate CA\" \\\n  ttl=43800h\n\n# Create a role for issuing certificates\nvault write pki_int\u002Froles\u002Finternal-services \\\n  allowed_domains=\"internal.company.com\" \\\n  allow_subdomains=true \\\n  max_ttl=720h\n```\n\n### Step 6: Establish Policies and Audit Trail\n\nDefine fine-grained ACL policies following least privilege. Enable comprehensive audit logging for all secret access and administrative operations.\n\n```hcl\n# web-app-policy.hcl\npath \"database\u002Fcreds\u002Freadonly\" {\n  capabilities = [\"read\"]\n}\n\npath \"transit\u002Fencrypt\u002Fpayment-data\" {\n  capabilities = [\"update\"]\n}\n\npath \"transit\u002Fdecrypt\u002Fpayment-data\" {\n  capabilities = [\"update\"]\n}\n\npath \"secret\u002Fdata\u002Fweb-app\u002F*\" {\n  capabilities = [\"read\", \"list\"]\n}\n\n# Deny access to admin paths\npath \"sys\u002F*\" {\n  capabilities = [\"deny\"]\n}\n```\n\n```bash\n# Apply the policy\nvault policy write web-app-policy web-app-policy.hcl\n\n# Verify audit log captures all operations\nvault audit list -detailed\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| Dynamic Secrets | Credentials generated on-demand with automatic expiration and revocation, eliminating long-lived static credentials |\n| Secret Engine | Vault component that stores, generates, or encrypts data; includes KV, database, AWS, PKI, and Transit engines |\n| Auto-Unseal | Cloud KMS-based mechanism that automatically unseals Vault nodes on restart without manual key entry |\n| AppRole | Machine-oriented authentication method using Role ID and Secret ID for application and CI\u002FCD pipeline access |\n| Transit Engine | Encryption-as-a-service engine that handles cryptographic operations without exposing encryption keys to applications |\n| Lease | Time-bound credential with a TTL that Vault automatically revokes on expiration unless renewed |\n| Namespace | Vault Enterprise feature providing tenant isolation with separate auth, secrets, and policy management |\n| Response Wrapping | Technique that wraps secret responses in a single-use token to prevent man-in-the-middle exposure during delivery |\n\n## Tools & Systems\n\n- **HashiCorp Vault**: Core secrets management platform providing dynamic secrets, encryption, and identity-based access\n- **Vault Agent Injector**: Kubernetes mutating webhook that automatically injects Vault secrets into pod volumes via sidecar containers\n- **Vault CSI Provider**: Kubernetes CSI driver that mounts Vault secrets directly into pod volumes without sidecar containers\n- **consul-template**: Template rendering daemon that watches Vault secrets and re-renders configuration files when secrets change\n- **Vault Radar**: Secret scanning tool that detects hardcoded credentials in source code, CI\u002FCD pipelines, and cloud configurations\n\n## Common Scenarios\n\n### Scenario: Eliminating Hardcoded Database Credentials from CI\u002FCD Pipeline\n\n**Context**: A DevOps team stores PostgreSQL credentials in GitHub Actions secrets and Jenkins credential stores. The same credentials are shared across staging and production environments with no rotation for 18 months.\n\n**Approach**:\n1. Deploy Vault with AppRole auth enabled for CI\u002FCD systems\n2. Configure the database secrets engine with separate roles for staging (readwrite, 2h TTL) and production (readonly, 1h TTL)\n3. Create separate Vault policies for each pipeline stage restricting access to the appropriate database role\n4. Update GitHub Actions workflows to authenticate via AppRole and request dynamic credentials at the start of each job\n5. Rotate the static PostgreSQL credentials and hand root access to Vault exclusively\n6. Enable audit logging to track every credential request with pipeline job metadata\n\n**Pitfalls**: Failing to rotate the original static credentials after Vault migration leaves the old credentials valid. Setting TTLs too short causes credential expiry mid-deployment for long-running jobs.\n\n## Output Format\n\n```\nVault Secrets Management Audit Report\n=======================================\nVault Cluster: vault.internal.company.com\nVersion: 1.18.1 Enterprise\nHA Mode: Raft (3 nodes)\nSeal Type: AWS KMS Auto-Unseal\nReport Date: 2025-02-23\n\nSECRET ENGINES:\n  database\u002F         PostgreSQL dynamic creds   Leases Active: 47\n  aws\u002F              Dynamic IAM credentials    Leases Active: 12\n  transit\u002F          Encryption as a service    Keys: 8\n  pki\u002F              Root CA                    Certs Issued: 0\n  pki_int\u002F          Intermediate CA            Certs Issued: 234\n  secret\u002F           KV v2 static secrets       Versions: 1,892\n\nAUTH METHODS:\n  oidc\u002F             Okta SSO for humans        Active Tokens: 23\n  approle\u002F          CI\u002FCD pipelines            Active Tokens: 156\n  kubernetes\u002F       Pod-based auth             Active Tokens: 89\n\nAUDIT FINDINGS:\n  [WARN] 3 AppRole secret_id_num_uses set to 0 (unlimited)\n  [WARN] 12 KV secrets not accessed in 90+ days (potential orphans)\n  [PASS] All dynamic secret TTLs under 24 hours\n  [PASS] Audit logging enabled on all nodes\n  [PASS] Root token revoked after initial setup\n\nCREDENTIAL HYGIENE:\n  Static Secrets (KV): 234\n  Dynamic Secrets Active: 59\n  Average Lease TTL: 2.3 hours\n  Secrets Rotated This Month: 12,456\n```\n","# Implementing Secrets Management with Vault\n\n## When to Use\n\n- When applications store database passwords, API keys, or certificates in environment variables or config files\n- When migrating from static long-lived credentials to dynamic short-lived secrets\n- When Kubernetes workloads need secure access to database credentials or cloud provider APIs\n- When compliance requirements mandate centralized credential management with audit logging\n- When CI\u002FCD pipelines contain hardcoded secrets that represent supply chain risk\n\n**Do not use** for AWS-only environments where AWS Secrets Manager suffices without multi-cloud requirements, for application-level encryption logic (though Vault Transit can help), or for identity federation (see managing-cloud-identity-with-okta).\n\n## Prerequisites\n\n- HashiCorp Vault server deployed in HA mode (Consul or Raft storage backend)\n- TLS certificates for Vault listener endpoints\n- Vault Enterprise license for namespaces, Sentinel policies, and replication (optional)\n- Kubernetes cluster with Vault Agent Injector or CSI provider for workload integration\n\n## Workflow\n\n### Step 1: Deploy Vault in High Availability Mode\n\nDeploy Vault using Integrated Storage (Raft) for HA without external dependencies. Configure TLS, audit logging, and auto-unseal using a cloud KMS.\n\n```hcl\n# vault-config.hcl\nstorage \"raft\" {\n  path    = \"\u002Fopt\u002Fvault\u002Fdata\"\n  node_id = \"vault-node-1\"\n\n  retry_join {\n    leader_api_addr = \"https:\u002F\u002Fvault-node-2.internal:8200\"\n  }\n  retry_join {\n    leader_api_addr = \"https:\u002F\u002Fvault-node-3.internal:8200\"\n  }\n}\n\nlistener \"tcp\" {\n  address     = \"0.0.0.0:8200\"\n  tls_cert_file = \"\u002Fopt\u002Fvault\u002Ftls\u002Fvault.crt\"\n  tls_key_file  = \"\u002Fopt\u002Fvault\u002Ftls\u002Fvault.key\"\n}\n\nseal \"awskms\" {\n  region     = \"us-east-1\"\n  kms_key_id = \"alias\u002Fvault-unseal-key\"\n}\n\napi_addr      = \"https:\u002F\u002Fvault-node-1.internal:8200\"\ncluster_addr  = \"https:\u002F\u002Fvault-node-1.internal:8201\"\n\ntelemetry {\n  prometheus_retention_time = \"30s\"\n  disable_hostname         = true\n}\n```\n\n```bash\n# Initialize Vault\nvault operator init -key-shares=5 -key-threshold=3\n\n# Enable audit logging\nvault audit enable file file_path=\u002Fvar\u002Flog\u002Fvault\u002Faudit.log\n\n# Enable syslog audit for SIEM integration\nvault audit enable syslog tag=\"vault\" facility=\"AUTH\"\n```\n\n### Step 2: Configure Authentication Methods\n\nEnable authentication backends for human operators, applications, and CI\u002FCD pipelines. Use AppRole for machine authentication and OIDC for human access.\n\n```bash\n# Enable OIDC auth for human users via Okta\nvault auth enable oidc\nvault write auth\u002Foidc\u002Fconfig \\\n  oidc_discovery_url=\"https:\u002F\u002Fcompany.okta.com\u002Foauth2\u002Fdefault\" \\\n  oidc_client_id=\"vault-client-id\" \\\n  oidc_client_secret=\"vault-client-secret\" \\\n  default_role=\"default\"\n\n# Enable AppRole for application authentication\nvault auth enable approle\nvault write auth\u002Fapprole\u002Frole\u002Fweb-app \\\n  secret_id_ttl=10m \\\n  token_num_uses=10 \\\n  token_ttl=20m \\\n  token_max_ttl=30m \\\n  secret_id_num_uses=1 \\\n  token_policies=\"web-app-policy\"\n\n# Enable Kubernetes auth for pod-based access\nvault auth enable kubernetes\nvault write auth\u002Fkubernetes\u002Fconfig \\\n  kubernetes_host=\"https:\u002F\u002Fkubernetes.default.svc:443\" \\\n  token_reviewer_jwt=@\u002Fvar\u002Frun\u002Fsecrets\u002Fkubernetes.io\u002Fserviceaccount\u002Ftoken \\\n  kubernetes_ca_cert=@\u002Fvar\u002Frun\u002Fsecrets\u002Fkubernetes.io\u002Fserviceaccount\u002Fca.crt\n```\n\n### Step 3: Enable Dynamic Secret Engines\n\nConfigure database secret engines to generate short-lived credentials on demand. Each credential set has a TTL and is automatically revoked when it expires.\n\n```bash\n# Enable database secrets engine for PostgreSQL\nvault secrets enable database\nvault write database\u002Fconfig\u002Fproduction-db \\\n  plugin_name=postgresql-database-plugin \\\n  allowed_roles=\"readonly,readwrite\" \\\n  connection_url=\"postgresql:\u002F\u002F{{username}}:{{password}}@db.internal:5432\u002Fproduction?sslmode=require\" \\\n  username=\"vault_admin\" \\\n  password=\"initial-password\"\n\n# Rotate the root credentials so Vault manages them exclusively\nvault write -force database\u002Frotate-root\u002Fproduction-db\n\n# Create a readonly role with 1-hour TTL\nvault write database\u002Froles\u002Freadonly \\\n  db_name=production-db \\\n  creation_statements=\"CREATE ROLE \\\"{{name}}\\\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}'; GRANT SELECT ON ALL TABLES IN SCHEMA public TO \\\"{{name}}\\\";\" \\\n  revocation_statements=\"REVOKE ALL ON ALL TABLES IN SCHEMA public FROM \\\"{{name}}\\\"; DROP ROLE IF EXISTS \\\"{{name}}\\\";\" \\\n  default_ttl=\"1h\" \\\n  max_ttl=\"24h\"\n\n# Enable AWS secrets engine for dynamic IAM credentials\nvault secrets enable aws\nvault write aws\u002Fconfig\u002Froot \\\n  access_key=AKIAEXAMPLE \\\n  secret_key=secretkey \\\n  region=us-east-1\n\nvault write aws\u002Froles\u002Fdeploy-role \\\n  credential_type=iam_user \\\n  policy_document=@deploy-policy.json \\\n  default_sts_ttl=3600\n```\n\n### Step 4: Integrate with Kubernetes Workloads\n\nUse the Vault Agent Injector or CSI Provider to deliver secrets to pods without application code changes. Secrets are rendered as files in a shared volume.\n\n```yaml\n# Kubernetes deployment with Vault Agent Injector annotations\napiVersion: apps\u002Fv1\nkind: Deployment\nmetadata:\n  name: web-app\nspec:\n  template:\n    metadata:\n      annotations:\n        vault.hashicorp.com\u002Fagent-inject: \"true\"\n        vault.hashicorp.com\u002Frole: \"web-app\"\n        vault.hashicorp.com\u002Fagent-inject-secret-db-creds: \"database\u002Fcreds\u002Freadonly\"\n        vault.hashicorp.com\u002Fagent-inject-template-db-creds: |\n          {{- with secret \"database\u002Fcreds\u002Freadonly\" -}}\n          export DB_USERNAME=\"{{ .Data.username }}\"\n          export DB_PASSWORD=\"{{ .Data.password }}\"\n          {{- end }}\n    spec:\n      serviceAccountName: web-app\n      containers:\n        - name: web-app\n          image: company\u002Fweb-app:v2.1\n          command: [\"\u002Fbin\u002Fsh\", \"-c\", \"source \u002Fvault\u002Fsecrets\u002Fdb-creds && .\u002Fstart.sh\"]\n```\n\n### Step 5: Implement Transit Encryption and PKI\n\nUse the Transit secrets engine for application-level encryption without managing keys in application code. Deploy the PKI engine for automatic TLS certificate management.\n\n```bash\n# Enable Transit engine for encryption as a service\nvault secrets enable transit\nvault write -f transit\u002Fkeys\u002Fpayment-data type=aes256-gcm96\n\n# Encrypt sensitive data\nvault write transit\u002Fencrypt\u002Fpayment-data \\\n  plaintext=$(echo \"card-number-4111-1111-1111-1111\" | base64)\n\n# Enable PKI for internal certificate management\nvault secrets enable pki\nvault secrets tune -max-lease-ttl=87600h pki\n\n# Generate root CA\nvault write pki\u002Froot\u002Fgenerate\u002Finternal \\\n  common_name=\"Internal Root CA\" \\\n  ttl=87600h\n\n# Configure intermediate CA for issuing certificates\nvault secrets enable -path=pki_int pki\nvault write pki_int\u002Fintermediate\u002Fgenerate\u002Finternal \\\n  common_name=\"Internal Intermediate CA\" \\\n  ttl=43800h\n\n# Create a role for issuing certificates\nvault write pki_int\u002Froles\u002Finternal-services \\\n  allowed_domains=\"internal.company.com\" \\\n  allow_subdomains=true \\\n  max_ttl=720h\n```\n\n### Step 6: Establish Policies and Audit Trail\n\nDefine fine-grained ACL policies following least privilege. Enable comprehensive audit logging for all secret access and administrative operations.\n\n```hcl\n# web-app-policy.hcl\npath \"database\u002Fcreds\u002Freadonly\" {\n  capabilities = [\"read\"]\n}\n\npath \"transit\u002Fencrypt\u002Fpayment-data\" {\n  capabilities = [\"update\"]\n}\n\npath \"transit\u002Fdecrypt\u002Fpayment-data\" {\n  capabilities = [\"update\"]\n}\n\npath \"secret\u002Fdata\u002Fweb-app\u002F*\" {\n  capabilities = [\"read\", \"list\"]\n}\n\n# Deny access to admin paths\npath \"sys\u002F*\" {\n  capabilities = [\"deny\"]\n}\n```\n\n```bash\n# Apply the policy\nvault policy write web-app-policy web-app-policy.hcl\n\n# Verify audit log captures all operations\nvault audit list -detailed\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| Dynamic Secrets | Credentials generated on-demand with automatic expiration and revocation, eliminating long-lived static credentials |\n| Secret Engine | Vault component that stores, generates, or encrypts data; includes KV, database, AWS, PKI, and Transit engines |\n| Auto-Unseal | Cloud KMS-based mechanism that automatically unseals Vault nodes on restart without manual key entry |\n| AppRole | Machine-oriented authentication method using Role ID and Secret ID for application and CI\u002FCD pipeline access |\n| Transit Engine | Encryption-as-a-service engine that handles cryptographic operations without exposing encryption keys to applications |\n| Lease | Time-bound credential with a TTL that Vault automatically revokes on expiration unless renewed |\n| Namespace | Vault Enterprise feature providing tenant isolation with separate auth, secrets, and policy management |\n| Response Wrapping | Technique that wraps secret responses in a single-use token to prevent man-in-the-middle exposure during delivery |\n\n## Tools & Systems\n\n- **HashiCorp Vault**: Core secrets management platform providing dynamic secrets, encryption, and identity-based access\n- **Vault Agent Injector**: Kubernetes mutating webhook that automatically injects Vault secrets into pod volumes via sidecar containers\n- **Vault CSI Provider**: Kubernetes CSI driver that mounts Vault secrets directly into pod volumes without sidecar containers\n- **consul-template**: Template rendering daemon that watches Vault secrets and re-renders configuration files when secrets change\n- **Vault Radar**: Secret scanning tool that detects hardcoded credentials in source code, CI\u002FCD pipelines, and cloud configurations\n\n## Common Scenarios\n\n### Scenario: Eliminating Hardcoded Database Credentials from CI\u002FCD Pipeline\n\n**Context**: A DevOps team stores PostgreSQL credentials in GitHub Actions secrets and Jenkins credential stores. The same credentials are shared across staging and production environments with no rotation for 18 months.\n\n**Approach**:\n1. Deploy Vault with AppRole auth enabled for CI\u002FCD systems\n2. Configure the database secrets engine with separate roles for staging (readwrite, 2h TTL) and production (readonly, 1h TTL)\n3. Create separate Vault policies for each pipeline stage restricting access to the appropriate database role\n4. Update GitHub Actions workflows to authenticate via AppRole and request dynamic credentials at the start of each job\n5. Rotate the static PostgreSQL credentials and hand root access to Vault exclusively\n6. Enable audit logging to track every credential request with pipeline job metadata\n\n**Pitfalls**: Failing to rotate the original static credentials after Vault migration leaves the old credentials valid. Setting TTLs too short causes credential expiry mid-deployment for long-running jobs.\n\n## Output Format\n\n```\nVault Secrets Management Audit Report\n=======================================\nVault Cluster: vault.internal.company.com\nVersion: 1.18.1 Enterprise\nHA Mode: Raft (3 nodes)\nSeal Type: AWS KMS Auto-Unseal\nReport Date: 2025-02-23\n\nSECRET ENGINES:\n  database\u002F         PostgreSQL dynamic creds   Leases Active: 47\n  aws\u002F              Dynamic IAM credentials    Leases Active: 12\n  transit\u002F          Encryption as a service    Keys: 8\n  pki\u002F              Root CA                    Certs Issued: 0\n  pki_int\u002F          Intermediate CA            Certs Issued: 234\n  secret\u002F           KV v2 static secrets       Versions: 1,892\n\nAUTH METHODS:\n  oidc\u002F             Okta SSO for humans        Active Tokens: 23\n  approle\u002F          CI\u002FCD pipelines            Active Tokens: 156\n  kubernetes\u002F       Pod-based auth             Active Tokens: 89\n\nAUDIT FINDINGS:\n  [WARN] 3 AppRole secret_id_num_uses set to 0 (unlimited)\n  [WARN] 12 KV secrets not accessed in 90+ days (potential orphans)\n  [PASS] All dynamic secret TTLs under 24 hours\n  [PASS] Audit logging enabled on all nodes\n  [PASS] Root token revoked after initial setup\n\nCREDENTIAL HYGIENE:\n  Static Secrets (KV): 234\n  Dynamic Secrets Active: 59\n  Average Lease TTL: 2.3 hours\n  Secrets Rotated This Month: 12,456\n```\n",{"name":5,"tags":25,"author":31,"domain":32,"license":15,"version":33,"nist_csf":34,"subdomain":39,"description":40,"mitre_attack":41},[26,27,28,29,30],"hashicorp-vault","secrets-management","dynamic-secrets","credential-rotation","zero-trust","mahipal","cybersecurity","1.0.0",[35,36,37,38],"PR.IR-01","ID.AM-08","GV.SC-06","DE.CM-01","cloud-security","Deploy HashiCorp Vault for centralized secrets management, covering dynamic secret generation for databases and cloud providers, transit encryption, PKI certificate management, and Kubernetes integration. Use when eliminating hardcoded credentials from application code or CI\u002FCD pipelines, migrating to short-lived auto-rotated secrets, or giving Kubernetes workloads secure access to database or cloud provider credentials.\n",[42,43,44,45,46],"T1078.004","T1530","T1537","T1580","T1003","main","7540bbccf0c1ded6156a467b02c95b61ad62413f",".agents\u002Fskills\u002Fimplementing-secrets-management-with-vault","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena","Currently exploring the intersection of tech","2026-09-11 03:02:31",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add NeelakshSaxena\u002FVayu --skill implementing-secrets-management-with-vault",{"tool":60,"command":61},"bunx","bunx skills add NeelakshSaxena\u002FVayu --skill implementing-secrets-management-with-vault",{"tool":63,"command":64},"pnpm","pnpm dlx skills add NeelakshSaxena\u002FVayu --skill implementing-secrets-management-with-vault","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fimplementing-secrets-management-with-vault\u002FSKILL.md",true,[68,72,78],{"path":69,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":16},"LICENSE","许可证",11255,{"path":73,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":76,"sourceHtmlUrl":77},"references\u002Fapi-reference.md","REFERENCE","参考文档",4193,"https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fimplementing-secrets-management-with-vault\u002Freferences\u002Fapi-reference.md",{"path":79,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":82,"sourceHtmlUrl":83},"scripts\u002Fagent.py","SCRIPT","脚本",10933,"https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fimplementing-secrets-management-with-vault\u002Fscripts\u002Fagent.py",[85,92,99,106,113,120],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":20},"01M7ACCCVNCFKMA9X6D15X6G98","runpodctl","Runpod CLI for managing GPU\u002FCPU workloads from the terminal — pods, serverless endpoints, templates, network volumes, Hub deploys, models, SSH, and file transfer (send\u002Freceive). Use for terminal\u002FCI\u002Fscripting, Hub browse\u002Fdeploy, SSH setup, `doctor`, or when the Runpod MCP tools are not connected. For structured tool calls in an MCP-enabled session, prefer runpod-mcp.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpodctl\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":20},"01M7ACC63SRHEA5KMCHSMZK2TC","runpod","Start here for any Runpod task — running GPU\u002FCPU pods, deploying serverless endpoints, templates, network volumes, building images, or understanding how Runpod works. Routes to the right skill (runpod-mcp, runpodctl, flash, companion-clis, runpod-usage, runpod-templates, runpod-migrate) and indexes two dozen live-verified end-to-end examples (golden paths) — use it when the lane is unclear, and for any multi-step or provisioning task even when it is not.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":20},"01M7ACC0Q1C89N9BZBV91CTQTF","runpod-usage","How Runpod works and how to work it — pods vs serverless, GPU\u002FVRAM selection, storage, building a container, networking, plus the agentic pod development loop (provision → ssh-exec → set up → poll readiness) and on-pod install hygiene (uv\u002Fapt). Use to answer \"how does X work\", \"which GPU\", \"how do I build a container\", or \"how do I stand up a workload on a pod\". Guidance, not a tool — execute with runpodctl, runpod-mcp, or flash.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-usage\u002FSKILL.md",[],[],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":20},"01M7ACBRPE345GF5GM5B8P8RRC","runpod-templates","Runpod's official prebuilt pod templates (ComfyUI, PyTorch, and others): what each image ships, which ports and paths it uses, how to pick one, how to pin a version, and what is missing on first boot. Use when a task says \"run \u003CX> on a pod\" and an official template already covers it, instead of building an image — and when a user needs help with or wants to fix something about a Runpod template they are already running (won't boot, can't reach the UI, missing models, wrong CUDA line, broken ComfyUI workflow metadata on imported workflows): start here and route onward. Deploy with runpodctl or runpod-mcp; end-to-end walkthroughs live in the runpod router's golden paths.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-templates\u002FSKILL.md",[],[],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":20},"01M7ACBJATHKVX1TWES2F44GY8","runpod-migrate","Migrate a codebase from the Runpod GraphQL API or REST v1 to REST v2 — inventory which parts use which API version, rewrite the call sites, flag breaking changes, and verify. Use when someone asks to move to v2, asks what v2 would change, or asks which Runpod API their code is on. For managing infrastructure rather than migrating code, use runpod-mcp or runpodctl.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-migrate\u002FSKILL.md",[],[],{"skillNo":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":20},"01M7ACBC7GHVH6T9YEAPCG2AP8","runpod-mcp","Manage Runpod infrastructure — pods, serverless endpoints, jobs, templates, network volumes, container-registry auth, GPU\u002FCPU catalog, and billing — via the Runpod MCP server's structured tool calls. Use when the Runpod MCP tools (create-pod, list-endpoints, …) are connected in this session, or to connect them (hosted OAuth or local npx). Prefer this over runpodctl for plain infra CRUD when MCP is available; use runpodctl for the terminal, file transfer, or SSH setup.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-mcp\u002FSKILL.md",[],[]]