[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ECN3PJV657B72ADYXQR06N":3,"skill-same:01M7ECN3PJV657B72ADYXQR06N":104},{"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":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":76,"commitSha":77,"skillDirectory":78,"forksCount":79,"repositoryHtmlUrl":80,"repositoryHomepageUrl":6,"ownerHtmlUrl":81,"ownerBlogUrl":6,"ownerDescription":82,"updatedAt":83,"install":84,"resources":97},"01M7ECN3PJV657B72ADYXQR06N","implementing-hashicorp-vault-dynamic-secrets",null,"Configures HashiCorp Vault dynamic secrets engines for database credentials, AWS IAM keys, and PKI certificates, with automatic generation, lease management, and rotation to eliminate static secrets in application configuration. Use when eliminating long-lived static credentials, configuring a Vault secrets engine, generating ephemeral database or cloud credentials, or automating credential rotation for compliance (PCI-DSS, NIST 800-53 IA-5).","lza6\u002FArmor-piercing-system-prompts","lza6","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F128880206?v=4","01M7EB3K7WPX5T28EJ2NVHE6EG","Chinese-tingfeng","01M7EB3K97E1KQ16QWKJMFNGX8",11,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F03-逆向工程\u002Fimplementing-hashicorp-vault-dynamic-secrets\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: implementing-hashicorp-vault-dynamic-secrets\ndescription: 'Configures HashiCorp Vault dynamic secrets engines for database credentials,\n  AWS IAM keys, and PKI certificates, with automatic generation, lease management,\n  and rotation to eliminate static secrets in application configuration. Use when\n  eliminating long-lived static credentials, configuring a Vault secrets engine,\n  generating ephemeral database or cloud credentials, or automating credential rotation\n  for compliance (PCI-DSS, NIST 800-53 IA-5).\n\n  '\ndomain: cybersecurity\nsubdomain: identity-access-management\ntags:\n- HashiCorp-Vault\n- dynamic-secrets\n- secrets-management\n- database-credentials\n- AWS-secrets\n- PKI\nversion: '1.0'\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- PR.AA-01\n- PR.AA-02\n- PR.AA-05\n- PR.AA-06\nmitre_attack:\n- T1078\n- T1110\n- T1556\n- T1098\n- T1003\nmitre_f3:\n  version: '1.1'\n  tactics:\n  - initial-access\n  - positioning\n  - stealth\n  - resource-development\n  techniques:\n  - id: F1006.001\n    name: 'Account Takeover: Exposed API Key'\n    tactic: initial-access\n    source: f3\n  - id: F1006.002\n    name: 'Account Takeover: Exposed Login Credential'\n    tactic: initial-access\n    source: f3\n  - id: T1586\n    name: Compromise Accounts\n    tactic: resource-development\n    source: attack\n  - id: T1555\n    name: Credentials from Password Stores\n    tactic: reconnaissance\n    source: attack\n  - id: F1005.004\n    name: 'Account Manipulation: Change Account Details'\n    tactic: positioning\n    source: f3\n  - id: F1033\n    name: Insider Access Abuse\n    tactic: initial-access\n    source: f3\n---\n\n# Implementing HashiCorp Vault Dynamic Secrets\n\n## When to Use\n\n- Applications use static database credentials stored in configuration files or environment variables\n- AWS IAM access keys are long-lived and shared across services\n- Need to eliminate credential sprawl by generating short-lived, per-request secrets\n- Compliance requirements mandate credential rotation (PCI-DSS Requirement 8, NIST 800-53 IA-5)\n- Implementing zero-trust secret management where credentials are never stored at rest\n- Migrating from manual credential management to automated secrets lifecycle\n\n**Do not use** for storing static secrets that cannot be dynamically generated (use Vault's KV secrets engine instead); dynamic secrets are for credentials that can be programmatically created and revoked on target systems.\n\n## Prerequisites\n\n- HashiCorp Vault 1.15+ (Community or Enterprise edition)\n- Vault server initialized and unsealed with auto-unseal configured (AWS KMS, Azure Key Vault, or Transit)\n- Target database systems with admin credentials for Vault to create\u002Frevoke dynamic accounts\n- AWS IAM account with permissions to create\u002Fdelete IAM users and access keys\n- Network connectivity from Vault to all target systems\n- Vault policies and authentication methods configured for consuming applications\n\n## Workflow\n\n### Step 1: Deploy and Configure Vault Server\n\nInitialize Vault with production-grade configuration:\n\n```hcl\n# vault-config.hcl - Production Vault server configuration\nstorage \"raft\" {\n  path    = \"\u002Fopt\u002Fvault\u002Fdata\"\n  node_id = \"vault-1\"\n\n  retry_join {\n    leader_api_addr = \"https:\u002F\u002Fvault-2.corp.local:8200\"\n  }\n  retry_join {\n    leader_api_addr = \"https:\u002F\u002Fvault-3.corp.local:8200\"\n  }\n}\n\nlistener \"tcp\" {\n  address       = \"0.0.0.0:8200\"\n  tls_cert_file = \"\u002Fopt\u002Fvault\u002Ftls\u002Fvault-cert.pem\"\n  tls_key_file  = \"\u002Fopt\u002Fvault\u002Ftls\u002Fvault-key.pem\"\n}\n\nseal \"awskms\" {\n  region     = \"us-east-1\"\n  kms_key_id = \"alias\u002Fvault-unseal-key\"\n}\n\napi_addr      = \"https:\u002F\u002Fvault-1.corp.local:8200\"\ncluster_addr  = \"https:\u002F\u002Fvault-1.corp.local:8201\"\n\ntelemetry {\n  prometheus_retention_time = \"24h\"\n  disable_hostname          = true\n}\n\nui = true\n```\n\n```bash\n# Initialize Vault cluster\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 AppRole authentication for applications\nvault auth enable approle\n\n# Create policy for database secret consumers\nvault policy write db-consumer - \u003C\u003CEOF\n# Allow reading dynamic database credentials\npath \"database\u002Fcreds\u002Fapp-readonly\" {\n  capabilities = [\"read\"]\n}\npath \"database\u002Fcreds\u002Fapp-readwrite\" {\n  capabilities = [\"read\"]\n}\n\n# Allow renewing and revoking own leases\npath \"sys\u002Fleases\u002Frenew\" {\n  capabilities = [\"update\"]\n}\npath \"sys\u002Fleases\u002Frevoke\" {\n  capabilities = [\"update\"]\n}\n\n# Allow reading own token info\npath \"auth\u002Ftoken\u002Flookup-self\" {\n  capabilities = [\"read\"]\n}\nEOF\n\n# Create AppRole for application\nvault write auth\u002Fapprole\u002Frole\u002Fwebapp \\\n    token_policies=\"db-consumer\" \\\n    token_ttl=1h \\\n    token_max_ttl=4h \\\n    secret_id_ttl=720h \\\n    secret_id_num_uses=0\n```\n\n### Step 2: Configure Database Secrets Engine\n\nSet up dynamic credential generation for PostgreSQL and MySQL:\n\n```bash\n# Enable the database secrets engine\nvault secrets enable database\n\n# Configure PostgreSQL connection\nvault write database\u002Fconfig\u002Fproduction-postgres \\\n    plugin_name=postgresql-database-plugin \\\n    allowed_roles=\"app-readonly,app-readwrite,app-admin\" \\\n    connection_url=\"postgresql:\u002F\u002F{{username}}:{{password}}@db-primary.corp.local:5432\u002Fappdb?sslmode=verify-full\" \\\n    username=\"vault_admin\" \\\n    password=\"$VAULT_DB_PASSWORD\" \\\n    password_authentication=\"scram-sha-256\"\n\n# Rotate the root credentials so Vault manages them exclusively\nvault write -force database\u002Frotate-root\u002Fproduction-postgres\n\n# Create read-only role (TTL: 1 hour, max 24 hours)\nvault write database\u002Froles\u002Fapp-readonly \\\n    db_name=production-postgres \\\n    creation_statements=\"CREATE ROLE \\\"{{name}}\\\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}'; \\\n        GRANT SELECT ON ALL TABLES IN SCHEMA public TO \\\"{{name}}\\\"; \\\n        ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO \\\"{{name}}\\\";\" \\\n    revocation_statements=\"REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA public FROM \\\"{{name}}\\\"; \\\n        DROP ROLE IF EXISTS \\\"{{name}}\\\";\" \\\n    default_ttl=\"1h\" \\\n    max_ttl=\"24h\"\n\n# Create read-write role (TTL: 30 minutes, max 8 hours)\nvault write database\u002Froles\u002Fapp-readwrite \\\n    db_name=production-postgres \\\n    creation_statements=\"CREATE ROLE \\\"{{name}}\\\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}'; \\\n        GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO \\\"{{name}}\\\"; \\\n        ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO \\\"{{name}}\\\";\" \\\n    revocation_statements=\"REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA public FROM \\\"{{name}}\\\"; \\\n        DROP ROLE IF EXISTS \\\"{{name}}\\\";\" \\\n    default_ttl=\"30m\" \\\n    max_ttl=\"8h\"\n\n# Configure MySQL connection\nvault write database\u002Fconfig\u002Fproduction-mysql \\\n    plugin_name=mysql-database-plugin \\\n    allowed_roles=\"mysql-readonly,mysql-readwrite\" \\\n    connection_url=\"{{username}}:{{password}}@tcp(mysql-primary.corp.local:3306)\u002F\" \\\n    username=\"vault_admin\" \\\n    password=\"$VAULT_MYSQL_PASSWORD\"\n\nvault write database\u002Froles\u002Fmysql-readonly \\\n    db_name=production-mysql \\\n    creation_statements=\"CREATE USER '{{name}}'@'%' IDENTIFIED BY '{{password}}'; \\\n        GRANT SELECT ON appdb.* TO '{{name}}'@'%';\" \\\n    revocation_statements=\"DROP USER IF EXISTS '{{name}}'@'%';\" \\\n    default_ttl=\"1h\" \\\n    max_ttl=\"24h\"\n\n# Test dynamic credential generation\necho \"Testing PostgreSQL dynamic credentials:\"\nvault read database\u002Fcreds\u002Fapp-readonly\n# Returns: username=v-approle-app-read-xxxxx, password=\u003Crandom>, lease_id=database\u002Fcreds\u002Fapp-readonly\u002Fxxxxx\n```\n\n### Step 3: Configure AWS Secrets Engine\n\nGenerate ephemeral AWS IAM credentials:\n\n```bash\n# Enable the AWS secrets engine\nvault secrets enable aws\n\n# Configure the AWS secrets engine with root credentials\nvault write aws\u002Fconfig\u002Froot \\\n    access_key=\"$AWS_ACCESS_KEY_ID\" \\\n    secret_key=\"$AWS_SECRET_ACCESS_KEY\" \\\n    region=\"us-east-1\"\n\n# Configure lease settings\nvault write aws\u002Fconfig\u002Flease \\\n    lease=\"30m\" \\\n    lease_max=\"1h\"\n\n# Create IAM User role for S3 read-only access\nvault write aws\u002Froles\u002Fs3-readonly \\\n    credential_type=iam_user \\\n    policy_document=-\u003C\u003CEOF\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"s3:GetObject\",\n        \"s3:ListBucket\",\n        \"s3:GetBucketLocation\"\n      ],\n      \"Resource\": [\n        \"arn:aws:s3:::app-data-bucket\",\n        \"arn:aws:s3:::app-data-bucket\u002F*\"\n      ]\n    }\n  ]\n}\nEOF\n\n# Create Assumed Role for EC2 management (preferred over IAM users)\nvault write aws\u002Froles\u002Fec2-admin \\\n    credential_type=assumed_role \\\n    role_arns=\"arn:aws:iam::123456789012:role\u002FVaultEC2AdminRole\" \\\n    default_sts_ttl=\"30m\" \\\n    max_sts_ttl=\"1h\"\n\n# Create Federation Token role for cross-account access\nvault write aws\u002Froles\u002Fcross-account-readonly \\\n    credential_type=federation_token \\\n    policy_document=-\u003C\u003CEOF\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"sts:AssumeRole\"\n      ],\n      \"Resource\": \"arn:aws:iam::987654321098:role\u002FCrossAccountReadOnly\"\n    }\n  ]\n}\nEOF\n\n# Test AWS dynamic credentials\necho \"Testing AWS STS credentials:\"\nvault read aws\u002Fcreds\u002Fec2-admin\n# Returns: access_key, secret_key, security_token with 30-minute TTL\n```\n\n### Step 4: Configure PKI Secrets Engine for Dynamic Certificates\n\nGenerate short-lived TLS certificates on demand:\n\n```bash\n# Enable PKI secrets engine for root CA\nvault secrets enable -path=pki pki\nvault secrets tune -max-lease-ttl=87600h pki\n\n# Generate root CA certificate\nvault write pki\u002Froot\u002Fgenerate\u002Finternal \\\n    common_name=\"Corp Internal Root CA\" \\\n    ttl=87600h \\\n    key_type=ec \\\n    key_bits=384\n\n# Enable PKI for intermediate CA\nvault secrets enable -path=pki_int pki\nvault secrets tune -max-lease-ttl=43800h pki_int\n\n# Generate intermediate CA CSR\nvault write pki_int\u002Fintermediate\u002Fgenerate\u002Finternal \\\n    common_name=\"Corp Intermediate CA\" \\\n    key_type=ec \\\n    key_bits=256\n\n# Sign intermediate CA with root CA\nvault write pki\u002Froot\u002Fsign-intermediate \\\n    csr=@intermediate.csr \\\n    format=pem_bundle \\\n    ttl=43800h\n\n# Configure issuing URLs\nvault write pki_int\u002Fconfig\u002Furls \\\n    issuing_certificates=\"https:\u002F\u002Fvault.corp.local:8200\u002Fv1\u002Fpki_int\u002Fca\" \\\n    crl_distribution_points=\"https:\u002F\u002Fvault.corp.local:8200\u002Fv1\u002Fpki_int\u002Fcrl\"\n\n# Create role for web server certificates (TTL: 30 days)\nvault write pki_int\u002Froles\u002Fweb-server \\\n    allowed_domains=\"corp.local,internal.corp.com\" \\\n    allow_subdomains=true \\\n    max_ttl=720h \\\n    key_type=ec \\\n    key_bits=256 \\\n    require_cn=true \\\n    enforce_hostnames=true\n\n# Create role for service mesh certificates (TTL: 24 hours)\nvault write pki_int\u002Froles\u002Fservice-mesh \\\n    allowed_domains=\"service.consul\" \\\n    allow_subdomains=true \\\n    max_ttl=24h \\\n    key_type=ec \\\n    key_bits=256 \\\n    allow_ip_sans=true \\\n    server_flag=true \\\n    client_flag=true\n\n# Issue a certificate\nvault write pki_int\u002Fissue\u002Fweb-server \\\n    common_name=\"api.corp.local\" \\\n    alt_names=\"api.internal.corp.com\" \\\n    ttl=720h\n```\n\n### Step 5: Integrate Applications with Vault\n\nConfigure applications to consume dynamic secrets:\n\n```python\n\"\"\"\nApplication integration with HashiCorp Vault for dynamic database credentials.\nUses the hvac Python client with automatic lease renewal.\n\"\"\"\nimport hvac\nimport threading\nimport time\nimport logging\n\nclass VaultDynamicCredentialManager:\n    def __init__(self, vault_addr, role_id, secret_id):\n        self.client = hvac.Client(url=vault_addr)\n        self.role_id = role_id\n        self.secret_id = secret_id\n        self.logger = logging.getLogger(\"vault_credentials\")\n        self._current_creds = None\n        self._lease_id = None\n        self._renewal_thread = None\n        self._stop_event = threading.Event()\n\n    def authenticate(self):\n        \"\"\"Authenticate to Vault using AppRole.\"\"\"\n        response = self.client.auth.approle.login(\n            role_id=self.role_id,\n            secret_id=self.secret_id\n        )\n        self.client.token = response[\"auth\"][\"client_token\"]\n        self.logger.info(\"Authenticated to Vault via AppRole\")\n\n    def get_database_credentials(self, role=\"app-readonly\"):\n        \"\"\"Request dynamic database credentials from Vault.\"\"\"\n        self.authenticate()\n\n        response = self.client.secrets.database.generate_credentials(\n            name=role\n        )\n\n        self._current_creds = {\n            \"username\": response[\"data\"][\"username\"],\n            \"password\": response[\"data\"][\"password\"],\n        }\n        self._lease_id = response[\"lease_id\"]\n        lease_duration = response[\"lease_duration\"]\n\n        self.logger.info(\n            f\"Obtained dynamic credentials: user={self._current_creds['username']}, \"\n            f\"lease={self._lease_id}, ttl={lease_duration}s\"\n        )\n\n        # Start background lease renewal\n        self._start_renewal(lease_duration)\n\n        return self._current_creds\n\n    def _start_renewal(self, lease_duration):\n        \"\"\"Start background thread to renew lease before expiration.\"\"\"\n        if self._renewal_thread and self._renewal_thread.is_alive():\n            self._stop_event.set()\n            self._renewal_thread.join()\n\n        self._stop_event.clear()\n        renewal_interval = lease_duration * 0.7  # Renew at 70% of TTL\n\n        def renew_loop():\n            while not self._stop_event.wait(renewal_interval):\n                try:\n                    self.client.sys.renew_lease(\n                        lease_id=self._lease_id,\n                        increment=lease_duration\n                    )\n                    self.logger.info(f\"Renewed lease: {self._lease_id}\")\n                except hvac.exceptions.InvalidRequest:\n                    self.logger.warning(\"Lease expired, obtaining new credentials\")\n                    self.get_database_credentials()\n                    break\n                except Exception as e:\n                    self.logger.error(f\"Lease renewal failed: {e}\")\n\n        self._renewal_thread = threading.Thread(target=renew_loop, daemon=True)\n        self._renewal_thread.start()\n\n    def revoke_credentials(self):\n        \"\"\"Explicitly revoke current dynamic credentials.\"\"\"\n        if self._lease_id:\n            self._stop_event.set()\n            self.client.sys.revoke_lease(self._lease_id)\n            self.logger.info(f\"Revoked lease: {self._lease_id}\")\n            self._current_creds = None\n            self._lease_id = None\n\n    def get_aws_credentials(self, role=\"s3-readonly\"):\n        \"\"\"Request dynamic AWS credentials from Vault.\"\"\"\n        self.authenticate()\n\n        response = self.client.secrets.aws.generate_credentials(\n            name=role\n        )\n\n        return {\n            \"access_key\": response[\"data\"][\"access_key\"],\n            \"secret_key\": response[\"data\"][\"secret_key\"],\n            \"security_token\": response[\"data\"].get(\"security_token\"),\n            \"lease_id\": response[\"lease_id\"],\n            \"ttl\": response[\"lease_duration\"]\n        }\n\n# Usage example\nvault_mgr = VaultDynamicCredentialManager(\n    vault_addr=\"https:\u002F\u002Fvault.corp.local:8200\",\n    role_id=\"\u003Capprole-role-id>\",\n    secret_id=\"\u003Capprole-secret-id>\"\n)\n\ndb_creds = vault_mgr.get_database_credentials(\"app-readonly\")\n# Use db_creds[\"username\"] and db_creds[\"password\"] for database connection\n```\n\n### Step 6: Monitor Vault Operations and Lease Management\n\nTrack dynamic secret usage and lease lifecycle:\n\n```bash\n# Monitor active leases\nvault list sys\u002Fleases\u002Flookup\u002Fdatabase\u002Fcreds\u002Fapp-readonly\nvault list sys\u002Fleases\u002Flookup\u002Faws\u002Fcreds\u002Fs3-readonly\n\n# Check lease details\nvault write sys\u002Fleases\u002Flookup lease_id=\"database\u002Fcreds\u002Fapp-readonly\u002Fabcd1234\"\n\n# Revoke all leases for a specific path (emergency credential rotation)\nvault lease revoke -prefix database\u002Fcreds\u002Fapp-readonly\n\n# Vault metrics for monitoring (Prometheus format)\n# Key metrics to monitor:\n# vault.expire.num_leases - Total active leases\n# vault.expire.revoke - Lease revocations per second\n# vault.secret.kv.count - Total stored secrets\n# vault.runtime.alloc_bytes - Memory allocation\n\n# Configure Vault audit log analysis\ncat > vault_audit_monitor.sh \u003C\u003C 'SCRIPT'\n#!\u002Fbin\u002Fbash\n# Monitor Vault audit logs for suspicious activity\n\nAUDIT_LOG=\"\u002Fvar\u002Flog\u002Fvault\u002Faudit.log\"\n\n# Count credential requests per hour\necho \"=== Dynamic Credential Requests (Last Hour) ===\"\njq -r 'select(.type == \"response\" and .request.path | startswith(\"database\u002Fcreds\u002F\")) |\n    \"\\(.time) \\(.request.path) \\(.auth.display_name)\"' \\\n    \"$AUDIT_LOG\" | tail -100\n\n# Detect unusual credential request patterns\necho \"\"\necho \"=== High-Volume Credential Consumers ===\"\njq -r 'select(.type == \"request\" and .request.path | startswith(\"database\u002Fcreds\u002F\")) |\n    .auth.display_name' \\\n    \"$AUDIT_LOG\" | sort | uniq -c | sort -rn | head -10\n\n# Check for failed authentication attempts\necho \"\"\necho \"=== Failed Auth Attempts ===\"\njq -r 'select(.type == \"response\" and .error != null and\n    .request.path | startswith(\"auth\u002F\")) |\n    \"\\(.time) \\(.request.path) \\(.error)\"' \\\n    \"$AUDIT_LOG\" | tail -20\nSCRIPT\nchmod +x vault_audit_monitor.sh\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| **Dynamic Secrets** | Credentials generated on-demand by Vault with automatic expiration, ensuring each consumer receives unique short-lived credentials |\n| **Lease** | Time-bound agreement where Vault guarantees the credential is valid; consumers must renew before expiration or request new credentials |\n| **Secrets Engine** | Vault plugin that generates, stores, or encrypts data; database, AWS, PKI, and KV are common engines |\n| **AppRole** | Vault authentication method designed for machine-to-machine authentication using role ID and secret ID pairs |\n| **Root Credential Rotation** | Process of having Vault take exclusive ownership of the admin credential used to create dynamic secrets, eliminating human knowledge of the root password |\n| **Lease Revocation** | Immediate invalidation of dynamic credentials, used during incident response to revoke all credentials for compromised paths |\n\n## Tools & Systems\n\n- **HashiCorp Vault**: Secrets management platform providing dynamic secrets, encryption as a service, and identity-based access control\n- **Vault Agent**: Sidecar process that handles Vault authentication, token renewal, and secret caching for applications\n- **Vault Secrets Operator**: Kubernetes operator that syncs Vault secrets into Kubernetes Secrets for pod consumption\n- **hvac**: Python client library for HashiCorp Vault API operations\n\n## Common Scenarios\n\n### Scenario: Eliminating Static Database Credentials in Microservices\n\n**Context**: 50 microservices share 3 static PostgreSQL credentials stored in environment variables across Kubernetes deployments. A credential leak requires rotating all 50 services simultaneously.\n\n**Approach**:\n1. Deploy Vault with Raft storage in a 3-node HA cluster within Kubernetes\n2. Configure database secrets engine with PostgreSQL connection using admin credentials\n3. Create per-service Vault roles with least-privilege SQL grants\n4. Deploy Vault Secrets Operator to inject dynamic credentials into pod environment variables\n5. Update application connection logic to handle credential rotation via lease renewal\n6. Rotate the Vault root credential to remove human knowledge of the admin password\n7. Monitor lease lifecycle and set alerts for renewal failures\n\n**Pitfalls**:\n- Not handling credential rotation in application connection pools (connections using expired credentials fail)\n- Setting TTLs too short causes excessive credential generation load on the database\n- Not configuring proper revocation statements leaves orphaned database users after lease expiration\n- Running Vault without HA causes single point of failure for all application authentication\n\n## Output Format\n\n```\nHASHICORP VAULT DYNAMIC SECRETS REPORT\n=========================================\nVault Version:     1.16.2 Enterprise\nCluster Status:    HA Active (3 nodes)\nSeal Type:         AWS KMS (auto-unseal)\n\nSECRETS ENGINES\ndatabase\u002F:         PostgreSQL, MySQL (2 connections)\naws\u002F:              IAM User, Assumed Role, Federation Token\npki_int\u002F:          Internal CA (EC P-256)\n\nDYNAMIC CREDENTIAL METRICS (Last 24 Hours)\nTotal Credentials Generated:    4,287\n  Database (PostgreSQL):        2,891\n  Database (MySQL):             543\n  AWS STS:                      612\n  PKI Certificates:             241\n\nACTIVE LEASES\nTotal Active:                   387\n  database\u002Fcreds\u002Fapp-readonly:  198\n  database\u002Fcreds\u002Fapp-readwrite: 89\n  aws\u002Fcreds\u002Fs3-readonly:        67\n  pki_int\u002Fissue\u002Fweb-server:     33\n\nLEASE LIFECYCLE\nAverage TTL:                    45 minutes\nRenewals (24h):                 12,847\nRevocations (24h):              3,901\nExpired (not renewed):          12\n\nSECURITY\nFailed Auth Attempts (24h):     3\nRoot Credential Rotated:        YES (all databases)\nAudit Logging:                  ENABLED (file + syslog)\nPolicy Violations (24h):        7 (permission denied)\n```\n","# Implementing HashiCorp Vault Dynamic Secrets\n\n## When to Use\n\n- Applications use static database credentials stored in configuration files or environment variables\n- AWS IAM access keys are long-lived and shared across services\n- Need to eliminate credential sprawl by generating short-lived, per-request secrets\n- Compliance requirements mandate credential rotation (PCI-DSS Requirement 8, NIST 800-53 IA-5)\n- Implementing zero-trust secret management where credentials are never stored at rest\n- Migrating from manual credential management to automated secrets lifecycle\n\n**Do not use** for storing static secrets that cannot be dynamically generated (use Vault's KV secrets engine instead); dynamic secrets are for credentials that can be programmatically created and revoked on target systems.\n\n## Prerequisites\n\n- HashiCorp Vault 1.15+ (Community or Enterprise edition)\n- Vault server initialized and unsealed with auto-unseal configured (AWS KMS, Azure Key Vault, or Transit)\n- Target database systems with admin credentials for Vault to create\u002Frevoke dynamic accounts\n- AWS IAM account with permissions to create\u002Fdelete IAM users and access keys\n- Network connectivity from Vault to all target systems\n- Vault policies and authentication methods configured for consuming applications\n\n## Workflow\n\n### Step 1: Deploy and Configure Vault Server\n\nInitialize Vault with production-grade configuration:\n\n```hcl\n# vault-config.hcl - Production Vault server configuration\nstorage \"raft\" {\n  path    = \"\u002Fopt\u002Fvault\u002Fdata\"\n  node_id = \"vault-1\"\n\n  retry_join {\n    leader_api_addr = \"https:\u002F\u002Fvault-2.corp.local:8200\"\n  }\n  retry_join {\n    leader_api_addr = \"https:\u002F\u002Fvault-3.corp.local:8200\"\n  }\n}\n\nlistener \"tcp\" {\n  address       = \"0.0.0.0:8200\"\n  tls_cert_file = \"\u002Fopt\u002Fvault\u002Ftls\u002Fvault-cert.pem\"\n  tls_key_file  = \"\u002Fopt\u002Fvault\u002Ftls\u002Fvault-key.pem\"\n}\n\nseal \"awskms\" {\n  region     = \"us-east-1\"\n  kms_key_id = \"alias\u002Fvault-unseal-key\"\n}\n\napi_addr      = \"https:\u002F\u002Fvault-1.corp.local:8200\"\ncluster_addr  = \"https:\u002F\u002Fvault-1.corp.local:8201\"\n\ntelemetry {\n  prometheus_retention_time = \"24h\"\n  disable_hostname          = true\n}\n\nui = true\n```\n\n```bash\n# Initialize Vault cluster\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 AppRole authentication for applications\nvault auth enable approle\n\n# Create policy for database secret consumers\nvault policy write db-consumer - \u003C\u003CEOF\n# Allow reading dynamic database credentials\npath \"database\u002Fcreds\u002Fapp-readonly\" {\n  capabilities = [\"read\"]\n}\npath \"database\u002Fcreds\u002Fapp-readwrite\" {\n  capabilities = [\"read\"]\n}\n\n# Allow renewing and revoking own leases\npath \"sys\u002Fleases\u002Frenew\" {\n  capabilities = [\"update\"]\n}\npath \"sys\u002Fleases\u002Frevoke\" {\n  capabilities = [\"update\"]\n}\n\n# Allow reading own token info\npath \"auth\u002Ftoken\u002Flookup-self\" {\n  capabilities = [\"read\"]\n}\nEOF\n\n# Create AppRole for application\nvault write auth\u002Fapprole\u002Frole\u002Fwebapp \\\n    token_policies=\"db-consumer\" \\\n    token_ttl=1h \\\n    token_max_ttl=4h \\\n    secret_id_ttl=720h \\\n    secret_id_num_uses=0\n```\n\n### Step 2: Configure Database Secrets Engine\n\nSet up dynamic credential generation for PostgreSQL and MySQL:\n\n```bash\n# Enable the database secrets engine\nvault secrets enable database\n\n# Configure PostgreSQL connection\nvault write database\u002Fconfig\u002Fproduction-postgres \\\n    plugin_name=postgresql-database-plugin \\\n    allowed_roles=\"app-readonly,app-readwrite,app-admin\" \\\n    connection_url=\"postgresql:\u002F\u002F{{username}}:{{password}}@db-primary.corp.local:5432\u002Fappdb?sslmode=verify-full\" \\\n    username=\"vault_admin\" \\\n    password=\"$VAULT_DB_PASSWORD\" \\\n    password_authentication=\"scram-sha-256\"\n\n# Rotate the root credentials so Vault manages them exclusively\nvault write -force database\u002Frotate-root\u002Fproduction-postgres\n\n# Create read-only role (TTL: 1 hour, max 24 hours)\nvault write database\u002Froles\u002Fapp-readonly \\\n    db_name=production-postgres \\\n    creation_statements=\"CREATE ROLE \\\"{{name}}\\\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}'; \\\n        GRANT SELECT ON ALL TABLES IN SCHEMA public TO \\\"{{name}}\\\"; \\\n        ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO \\\"{{name}}\\\";\" \\\n    revocation_statements=\"REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA public FROM \\\"{{name}}\\\"; \\\n        DROP ROLE IF EXISTS \\\"{{name}}\\\";\" \\\n    default_ttl=\"1h\" \\\n    max_ttl=\"24h\"\n\n# Create read-write role (TTL: 30 minutes, max 8 hours)\nvault write database\u002Froles\u002Fapp-readwrite \\\n    db_name=production-postgres \\\n    creation_statements=\"CREATE ROLE \\\"{{name}}\\\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}'; \\\n        GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO \\\"{{name}}\\\"; \\\n        ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO \\\"{{name}}\\\";\" \\\n    revocation_statements=\"REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA public FROM \\\"{{name}}\\\"; \\\n        DROP ROLE IF EXISTS \\\"{{name}}\\\";\" \\\n    default_ttl=\"30m\" \\\n    max_ttl=\"8h\"\n\n# Configure MySQL connection\nvault write database\u002Fconfig\u002Fproduction-mysql \\\n    plugin_name=mysql-database-plugin \\\n    allowed_roles=\"mysql-readonly,mysql-readwrite\" \\\n    connection_url=\"{{username}}:{{password}}@tcp(mysql-primary.corp.local:3306)\u002F\" \\\n    username=\"vault_admin\" \\\n    password=\"$VAULT_MYSQL_PASSWORD\"\n\nvault write database\u002Froles\u002Fmysql-readonly \\\n    db_name=production-mysql \\\n    creation_statements=\"CREATE USER '{{name}}'@'%' IDENTIFIED BY '{{password}}'; \\\n        GRANT SELECT ON appdb.* TO '{{name}}'@'%';\" \\\n    revocation_statements=\"DROP USER IF EXISTS '{{name}}'@'%';\" \\\n    default_ttl=\"1h\" \\\n    max_ttl=\"24h\"\n\n# Test dynamic credential generation\necho \"Testing PostgreSQL dynamic credentials:\"\nvault read database\u002Fcreds\u002Fapp-readonly\n# Returns: username=v-approle-app-read-xxxxx, password=\u003Crandom>, lease_id=database\u002Fcreds\u002Fapp-readonly\u002Fxxxxx\n```\n\n### Step 3: Configure AWS Secrets Engine\n\nGenerate ephemeral AWS IAM credentials:\n\n```bash\n# Enable the AWS secrets engine\nvault secrets enable aws\n\n# Configure the AWS secrets engine with root credentials\nvault write aws\u002Fconfig\u002Froot \\\n    access_key=\"$AWS_ACCESS_KEY_ID\" \\\n    secret_key=\"$AWS_SECRET_ACCESS_KEY\" \\\n    region=\"us-east-1\"\n\n# Configure lease settings\nvault write aws\u002Fconfig\u002Flease \\\n    lease=\"30m\" \\\n    lease_max=\"1h\"\n\n# Create IAM User role for S3 read-only access\nvault write aws\u002Froles\u002Fs3-readonly \\\n    credential_type=iam_user \\\n    policy_document=-\u003C\u003CEOF\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"s3:GetObject\",\n        \"s3:ListBucket\",\n        \"s3:GetBucketLocation\"\n      ],\n      \"Resource\": [\n        \"arn:aws:s3:::app-data-bucket\",\n        \"arn:aws:s3:::app-data-bucket\u002F*\"\n      ]\n    }\n  ]\n}\nEOF\n\n# Create Assumed Role for EC2 management (preferred over IAM users)\nvault write aws\u002Froles\u002Fec2-admin \\\n    credential_type=assumed_role \\\n    role_arns=\"arn:aws:iam::123456789012:role\u002FVaultEC2AdminRole\" \\\n    default_sts_ttl=\"30m\" \\\n    max_sts_ttl=\"1h\"\n\n# Create Federation Token role for cross-account access\nvault write aws\u002Froles\u002Fcross-account-readonly \\\n    credential_type=federation_token \\\n    policy_document=-\u003C\u003CEOF\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"sts:AssumeRole\"\n      ],\n      \"Resource\": \"arn:aws:iam::987654321098:role\u002FCrossAccountReadOnly\"\n    }\n  ]\n}\nEOF\n\n# Test AWS dynamic credentials\necho \"Testing AWS STS credentials:\"\nvault read aws\u002Fcreds\u002Fec2-admin\n# Returns: access_key, secret_key, security_token with 30-minute TTL\n```\n\n### Step 4: Configure PKI Secrets Engine for Dynamic Certificates\n\nGenerate short-lived TLS certificates on demand:\n\n```bash\n# Enable PKI secrets engine for root CA\nvault secrets enable -path=pki pki\nvault secrets tune -max-lease-ttl=87600h pki\n\n# Generate root CA certificate\nvault write pki\u002Froot\u002Fgenerate\u002Finternal \\\n    common_name=\"Corp Internal Root CA\" \\\n    ttl=87600h \\\n    key_type=ec \\\n    key_bits=384\n\n# Enable PKI for intermediate CA\nvault secrets enable -path=pki_int pki\nvault secrets tune -max-lease-ttl=43800h pki_int\n\n# Generate intermediate CA CSR\nvault write pki_int\u002Fintermediate\u002Fgenerate\u002Finternal \\\n    common_name=\"Corp Intermediate CA\" \\\n    key_type=ec \\\n    key_bits=256\n\n# Sign intermediate CA with root CA\nvault write pki\u002Froot\u002Fsign-intermediate \\\n    csr=@intermediate.csr \\\n    format=pem_bundle \\\n    ttl=43800h\n\n# Configure issuing URLs\nvault write pki_int\u002Fconfig\u002Furls \\\n    issuing_certificates=\"https:\u002F\u002Fvault.corp.local:8200\u002Fv1\u002Fpki_int\u002Fca\" \\\n    crl_distribution_points=\"https:\u002F\u002Fvault.corp.local:8200\u002Fv1\u002Fpki_int\u002Fcrl\"\n\n# Create role for web server certificates (TTL: 30 days)\nvault write pki_int\u002Froles\u002Fweb-server \\\n    allowed_domains=\"corp.local,internal.corp.com\" \\\n    allow_subdomains=true \\\n    max_ttl=720h \\\n    key_type=ec \\\n    key_bits=256 \\\n    require_cn=true \\\n    enforce_hostnames=true\n\n# Create role for service mesh certificates (TTL: 24 hours)\nvault write pki_int\u002Froles\u002Fservice-mesh \\\n    allowed_domains=\"service.consul\" \\\n    allow_subdomains=true \\\n    max_ttl=24h \\\n    key_type=ec \\\n    key_bits=256 \\\n    allow_ip_sans=true \\\n    server_flag=true \\\n    client_flag=true\n\n# Issue a certificate\nvault write pki_int\u002Fissue\u002Fweb-server \\\n    common_name=\"api.corp.local\" \\\n    alt_names=\"api.internal.corp.com\" \\\n    ttl=720h\n```\n\n### Step 5: Integrate Applications with Vault\n\nConfigure applications to consume dynamic secrets:\n\n```python\n\"\"\"\nApplication integration with HashiCorp Vault for dynamic database credentials.\nUses the hvac Python client with automatic lease renewal.\n\"\"\"\nimport hvac\nimport threading\nimport time\nimport logging\n\nclass VaultDynamicCredentialManager:\n    def __init__(self, vault_addr, role_id, secret_id):\n        self.client = hvac.Client(url=vault_addr)\n        self.role_id = role_id\n        self.secret_id = secret_id\n        self.logger = logging.getLogger(\"vault_credentials\")\n        self._current_creds = None\n        self._lease_id = None\n        self._renewal_thread = None\n        self._stop_event = threading.Event()\n\n    def authenticate(self):\n        \"\"\"Authenticate to Vault using AppRole.\"\"\"\n        response = self.client.auth.approle.login(\n            role_id=self.role_id,\n            secret_id=self.secret_id\n        )\n        self.client.token = response[\"auth\"][\"client_token\"]\n        self.logger.info(\"Authenticated to Vault via AppRole\")\n\n    def get_database_credentials(self, role=\"app-readonly\"):\n        \"\"\"Request dynamic database credentials from Vault.\"\"\"\n        self.authenticate()\n\n        response = self.client.secrets.database.generate_credentials(\n            name=role\n        )\n\n        self._current_creds = {\n            \"username\": response[\"data\"][\"username\"],\n            \"password\": response[\"data\"][\"password\"],\n        }\n        self._lease_id = response[\"lease_id\"]\n        lease_duration = response[\"lease_duration\"]\n\n        self.logger.info(\n            f\"Obtained dynamic credentials: user={self._current_creds['username']}, \"\n            f\"lease={self._lease_id}, ttl={lease_duration}s\"\n        )\n\n        # Start background lease renewal\n        self._start_renewal(lease_duration)\n\n        return self._current_creds\n\n    def _start_renewal(self, lease_duration):\n        \"\"\"Start background thread to renew lease before expiration.\"\"\"\n        if self._renewal_thread and self._renewal_thread.is_alive():\n            self._stop_event.set()\n            self._renewal_thread.join()\n\n        self._stop_event.clear()\n        renewal_interval = lease_duration * 0.7  # Renew at 70% of TTL\n\n        def renew_loop():\n            while not self._stop_event.wait(renewal_interval):\n                try:\n                    self.client.sys.renew_lease(\n                        lease_id=self._lease_id,\n                        increment=lease_duration\n                    )\n                    self.logger.info(f\"Renewed lease: {self._lease_id}\")\n                except hvac.exceptions.InvalidRequest:\n                    self.logger.warning(\"Lease expired, obtaining new credentials\")\n                    self.get_database_credentials()\n                    break\n                except Exception as e:\n                    self.logger.error(f\"Lease renewal failed: {e}\")\n\n        self._renewal_thread = threading.Thread(target=renew_loop, daemon=True)\n        self._renewal_thread.start()\n\n    def revoke_credentials(self):\n        \"\"\"Explicitly revoke current dynamic credentials.\"\"\"\n        if self._lease_id:\n            self._stop_event.set()\n            self.client.sys.revoke_lease(self._lease_id)\n            self.logger.info(f\"Revoked lease: {self._lease_id}\")\n            self._current_creds = None\n            self._lease_id = None\n\n    def get_aws_credentials(self, role=\"s3-readonly\"):\n        \"\"\"Request dynamic AWS credentials from Vault.\"\"\"\n        self.authenticate()\n\n        response = self.client.secrets.aws.generate_credentials(\n            name=role\n        )\n\n        return {\n            \"access_key\": response[\"data\"][\"access_key\"],\n            \"secret_key\": response[\"data\"][\"secret_key\"],\n            \"security_token\": response[\"data\"].get(\"security_token\"),\n            \"lease_id\": response[\"lease_id\"],\n            \"ttl\": response[\"lease_duration\"]\n        }\n\n# Usage example\nvault_mgr = VaultDynamicCredentialManager(\n    vault_addr=\"https:\u002F\u002Fvault.corp.local:8200\",\n    role_id=\"\u003Capprole-role-id>\",\n    secret_id=\"\u003Capprole-secret-id>\"\n)\n\ndb_creds = vault_mgr.get_database_credentials(\"app-readonly\")\n# Use db_creds[\"username\"] and db_creds[\"password\"] for database connection\n```\n\n### Step 6: Monitor Vault Operations and Lease Management\n\nTrack dynamic secret usage and lease lifecycle:\n\n```bash\n# Monitor active leases\nvault list sys\u002Fleases\u002Flookup\u002Fdatabase\u002Fcreds\u002Fapp-readonly\nvault list sys\u002Fleases\u002Flookup\u002Faws\u002Fcreds\u002Fs3-readonly\n\n# Check lease details\nvault write sys\u002Fleases\u002Flookup lease_id=\"database\u002Fcreds\u002Fapp-readonly\u002Fabcd1234\"\n\n# Revoke all leases for a specific path (emergency credential rotation)\nvault lease revoke -prefix database\u002Fcreds\u002Fapp-readonly\n\n# Vault metrics for monitoring (Prometheus format)\n# Key metrics to monitor:\n# vault.expire.num_leases - Total active leases\n# vault.expire.revoke - Lease revocations per second\n# vault.secret.kv.count - Total stored secrets\n# vault.runtime.alloc_bytes - Memory allocation\n\n# Configure Vault audit log analysis\ncat > vault_audit_monitor.sh \u003C\u003C 'SCRIPT'\n#!\u002Fbin\u002Fbash\n# Monitor Vault audit logs for suspicious activity\n\nAUDIT_LOG=\"\u002Fvar\u002Flog\u002Fvault\u002Faudit.log\"\n\n# Count credential requests per hour\necho \"=== Dynamic Credential Requests (Last Hour) ===\"\njq -r 'select(.type == \"response\" and .request.path | startswith(\"database\u002Fcreds\u002F\")) |\n    \"\\(.time) \\(.request.path) \\(.auth.display_name)\"' \\\n    \"$AUDIT_LOG\" | tail -100\n\n# Detect unusual credential request patterns\necho \"\"\necho \"=== High-Volume Credential Consumers ===\"\njq -r 'select(.type == \"request\" and .request.path | startswith(\"database\u002Fcreds\u002F\")) |\n    .auth.display_name' \\\n    \"$AUDIT_LOG\" | sort | uniq -c | sort -rn | head -10\n\n# Check for failed authentication attempts\necho \"\"\necho \"=== Failed Auth Attempts ===\"\njq -r 'select(.type == \"response\" and .error != null and\n    .request.path | startswith(\"auth\u002F\")) |\n    \"\\(.time) \\(.request.path) \\(.error)\"' \\\n    \"$AUDIT_LOG\" | tail -20\nSCRIPT\nchmod +x vault_audit_monitor.sh\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| **Dynamic Secrets** | Credentials generated on-demand by Vault with automatic expiration, ensuring each consumer receives unique short-lived credentials |\n| **Lease** | Time-bound agreement where Vault guarantees the credential is valid; consumers must renew before expiration or request new credentials |\n| **Secrets Engine** | Vault plugin that generates, stores, or encrypts data; database, AWS, PKI, and KV are common engines |\n| **AppRole** | Vault authentication method designed for machine-to-machine authentication using role ID and secret ID pairs |\n| **Root Credential Rotation** | Process of having Vault take exclusive ownership of the admin credential used to create dynamic secrets, eliminating human knowledge of the root password |\n| **Lease Revocation** | Immediate invalidation of dynamic credentials, used during incident response to revoke all credentials for compromised paths |\n\n## Tools & Systems\n\n- **HashiCorp Vault**: Secrets management platform providing dynamic secrets, encryption as a service, and identity-based access control\n- **Vault Agent**: Sidecar process that handles Vault authentication, token renewal, and secret caching for applications\n- **Vault Secrets Operator**: Kubernetes operator that syncs Vault secrets into Kubernetes Secrets for pod consumption\n- **hvac**: Python client library for HashiCorp Vault API operations\n\n## Common Scenarios\n\n### Scenario: Eliminating Static Database Credentials in Microservices\n\n**Context**: 50 microservices share 3 static PostgreSQL credentials stored in environment variables across Kubernetes deployments. A credential leak requires rotating all 50 services simultaneously.\n\n**Approach**:\n1. Deploy Vault with Raft storage in a 3-node HA cluster within Kubernetes\n2. Configure database secrets engine with PostgreSQL connection using admin credentials\n3. Create per-service Vault roles with least-privilege SQL grants\n4. Deploy Vault Secrets Operator to inject dynamic credentials into pod environment variables\n5. Update application connection logic to handle credential rotation via lease renewal\n6. Rotate the Vault root credential to remove human knowledge of the admin password\n7. Monitor lease lifecycle and set alerts for renewal failures\n\n**Pitfalls**:\n- Not handling credential rotation in application connection pools (connections using expired credentials fail)\n- Setting TTLs too short causes excessive credential generation load on the database\n- Not configuring proper revocation statements leaves orphaned database users after lease expiration\n- Running Vault without HA causes single point of failure for all application authentication\n\n## Output Format\n\n```\nHASHICORP VAULT DYNAMIC SECRETS REPORT\n=========================================\nVault Version:     1.16.2 Enterprise\nCluster Status:    HA Active (3 nodes)\nSeal Type:         AWS KMS (auto-unseal)\n\nSECRETS ENGINES\ndatabase\u002F:         PostgreSQL, MySQL (2 connections)\naws\u002F:              IAM User, Assumed Role, Federation Token\npki_int\u002F:          Internal CA (EC P-256)\n\nDYNAMIC CREDENTIAL METRICS (Last 24 Hours)\nTotal Credentials Generated:    4,287\n  Database (PostgreSQL):        2,891\n  Database (MySQL):             543\n  AWS STS:                      612\n  PKI Certificates:             241\n\nACTIVE LEASES\nTotal Active:                   387\n  database\u002Fcreds\u002Fapp-readonly:  198\n  database\u002Fcreds\u002Fapp-readwrite: 89\n  aws\u002Fcreds\u002Fs3-readonly:        67\n  pki_int\u002Fissue\u002Fweb-server:     33\n\nLEASE LIFECYCLE\nAverage TTL:                    45 minutes\nRenewals (24h):                 12,847\nRevocations (24h):              3,901\nExpired (not renewed):          12\n\nSECURITY\nFailed Auth Attempts (24h):     3\nRoot Credential Rotated:        YES (all databases)\nAudit Logging:                  ENABLED (file + syslog)\nPolicy Violations (24h):        7 (permission denied)\n```\n",{"name":5,"tags":24,"author":31,"domain":32,"license":15,"version":33,"mitre_f3":34,"nist_csf":63,"subdomain":68,"description":69,"mitre_attack":70},[25,26,27,28,29,30],"HashiCorp-Vault","dynamic-secrets","secrets-management","database-credentials","AWS-secrets","PKI","mahipal","cybersecurity","1.0",{"tactics":35,"version":40,"techniques":41},[36,37,38,39],"initial-access","positioning","stealth","resource-development","1.1",[42,46,49,53,57,60],{"id":43,"name":44,"source":45,"tactic":36},"F1006.001","Account Takeover: Exposed API Key","f3",{"id":47,"name":48,"source":45,"tactic":36},"F1006.002","Account Takeover: Exposed Login Credential",{"id":50,"name":51,"source":52,"tactic":39},"T1586","Compromise Accounts","attack",{"id":54,"name":55,"source":52,"tactic":56},"T1555","Credentials from Password Stores","reconnaissance",{"id":58,"name":59,"source":45,"tactic":37},"F1005.004","Account Manipulation: Change Account Details",{"id":61,"name":62,"source":45,"tactic":36},"F1033","Insider Access Abuse",[64,65,66,67],"PR.AA-01","PR.AA-02","PR.AA-05","PR.AA-06","identity-access-management","Configures HashiCorp Vault dynamic secrets engines for database credentials, AWS IAM keys, and PKI certificates, with automatic generation, lease management, and rotation to eliminate static secrets in application configuration. Use when eliminating long-lived static credentials, configuring a Vault secrets engine, generating ephemeral database or cloud credentials, or automating credential rotation for compliance (PCI-DSS, NIST 800-53 IA-5).\n",[71,72,73,74,75],"T1078","T1110","T1556","T1098","T1003","main","d69096e239f2a89aabc2cd078c47664a9d3b1e11","03-逆向工程\u002Fimplementing-hashicorp-vault-dynamic-secrets",3,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts","https:\u002F\u002Fgithub.com\u002Flza6","个人vx：Tf00798\r\n个人✈：@TFGY999","2026-10-08 14:29:22",{"source":8,"skillName":5,"commands":85,"prompt":95,"zipAvailable":96},[86,89,92],{"tool":87,"command":88},"npx","npx skills add lza6\u002FArmor-piercing-system-prompts --skill implementing-hashicorp-vault-dynamic-secrets",{"tool":90,"command":91},"bunx","bunx skills add lza6\u002FArmor-piercing-system-prompts --skill implementing-hashicorp-vault-dynamic-secrets",{"tool":93,"command":94},"pnpm","pnpm dlx skills add lza6\u002FArmor-piercing-system-prompts --skill implementing-hashicorp-vault-dynamic-secrets","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F03-逆向工程\u002Fimplementing-hashicorp-vault-dynamic-secrets\u002FSKILL.md",true,[98],{"path":99,"resourceType":100,"resourceTypeDesc":101,"sizeBytes":102,"sourceHtmlUrl":103},"references\u002Fapi-reference.md","REFERENCE","参考文档",2591,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F03-逆向工程\u002Fimplementing-hashicorp-vault-dynamic-secrets\u002Freferences\u002Fapi-reference.md",[105,114,119,126,133,140],{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":109,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":113},"01M7FFG485KY83TD6HSC4YPCMC","obsidian-clipper-template-creator","Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.","MIT","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator\u002FSKILL.md",[],[],"2026-11-16 10:05:34",{"skillNo":115,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":109,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":113},"01M7FFG0T6AZ0STEJPSB3CX84K","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator-antigravity-awesome-skills-main\u002FSKILL.md",[],[],{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":109,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":125,"publishedAt":113},"01M7FFFY0QEM14SKWPDYGMXM2P","python-api","Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP\u002FmAP semantics, and source-style import diagnostics.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Fpython-api\u002FSKILL.md",[],[],{"skillNo":127,"name":128,"nameZh":6,"description":129,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":109,"licenseFileUrl":6,"sourceHtmlUrl":130,"categories":131,"keywords":132,"publishedAt":113},"01M7FFFVZQZ2GJ0C0TGP7JHD20","file-evaluation","Folder-based PASCAL VOC AP\u002FmAP evaluation from ground-truth and detection text files.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Ffile-evaluation\u002FSKILL.md",[],[],{"skillNo":134,"name":135,"nameZh":6,"description":136,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":109,"licenseFileUrl":6,"sourceHtmlUrl":137,"categories":138,"keywords":139,"publishedAt":113},"01M7FFFSFNYSE77SJ6PE1CK2DA","object-detection-metrics","Guides legacy Object-Detection-Metrics PASCAL VOC AP\u002FmAP evaluation from detection text folders and direct Python API classes.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002FSKILL.md",[],[],{"skillNo":141,"name":142,"nameZh":6,"description":143,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":109,"licenseFileUrl":6,"sourceHtmlUrl":144,"categories":145,"keywords":146,"publishedAt":113},"01M7FFFP0GCK1RVXBCPQ8APBMT","nx-workspace-patterns","Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fnx-workspace-patterns\u002FSKILL.md",[],[]]