본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)35k · #8052

implementing-hashicorp-vault-dynamic-secrets

하는 일

이 도구는 데이터베이스와 AWS 서비스를 위한 임시 비밀번호와 접근 키를 생성하도록 HashiCorp Vault를 설정합니다. 자동으로 만료되는 자격 증명을 만들어, 오래 유지되는 고정 비밀번호를 사용하지 않도록 돕습니다.

사용하는 경우

  • ✓설정 파일에 고정 비밀번호를 두지 않으려 할 때.
  • ✓빠르게 만료되는 데이터베이스나 AWS 자격 증명이 필요할 때.
  • ✓자주 비밀번호를 바꾸도록 요구하는 보안 규칙을 준수하는 경우.

스킬 링크

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-hashicorp-vault-dynamic-secrets/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-hashicorp-vault-dynamic-secrets/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“PostgreSQL 데이터베이스용 동적 비밀 정보를 생성하도록 HashiCorp Vault를 설정해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

Vault는 데이터베이스나 AWS에 연결해, 필요할 때 임시 자격 증명을 만듭니다. 이 자격 증명은 만료되거나 더 이상 필요하지 않을 때 자동으로 취소됩니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Implementing HashiCorp Vault Dynamic Secrets

When to Use

  • Applications use static database credentials stored in configuration files or environment variables
  • AWS IAM access keys are long-lived and shared across services
  • Need to eliminate credential sprawl by generating short-lived, per-request secrets
  • Compliance requirements mandate credential rotation (PCI-DSS Requirement 8, NIST 800-53 IA-5)
  • Implementing zero-trust secret management where credentials are never stored at rest
  • Migrating from manual credential management to automated secrets lifecycle

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.

Prerequisites

  • HashiCorp Vault 1.15+ (Community or Enterprise edition)
  • Vault server initialized and unsealed with auto-unseal configured (AWS KMS, Azure Key Vault, or Transit)
  • Target database systems with admin credentials for Vault to create/revoke dynamic accounts
  • AWS IAM account with permissions to create/delete IAM users and access keys
  • Network connectivity from Vault to all target systems
  • Vault policies and authentication methods configured for consuming applications

Workflow

Step 1: Deploy and Configure Vault Server

Initialize Vault with production-grade configuration:

# vault-config.hcl - Production Vault server configuration
storage "raft" {
  path    = "/opt/vault/data"
  node_id = "vault-1"

  retry_join {
    leader_api_addr = "https://vault-2.corp.local:8200"
  }
  retry_join {
    leader_api_addr = "https://vault-3.corp.local:8200"
  }
}

listener "tcp" {
  address       = "0.0.0.0:8200"
  tls_cert_file = "/opt/vault/tls/vault-cert.pem"
  tls_key_file  = "/opt/vault/tls/vault-key.pem"
}

seal "awskms" {
  region     = "us-east-1"
  kms_key_id = "alias/vault-unseal-key"
}

api_addr      = "https://vault-1.corp.local:8200"
cluster_addr  = "https://vault-1.corp.local:8201"

telemetry {
  prometheus_retention_time = "24h"
  disable_hostname          = true
}

ui = true
# Initialize Vault cluster
vault operator init -key-shares=5 -key-threshold=3

# Enable audit logging
vault audit enable file file_path=/var/log/vault/audit.log

# Enable AppRole authentication for applications
vault auth enable approle

# Create policy for database secret consumers
vault policy write db-consumer - <<EOF
# Allow reading dynamic database credentials
path "database/creds/app-readonly" {
  capabilities = ["read"]
}
path "database/creds/app-readwrite" {
  capabilities = ["read"]
}

# Allow renewing and revoking own leases
path "sys/leases/renew" {
  capabilities = ["update"]
}
path "sys/leases/revoke" {
  capabilities = ["update"]
}

# Allow reading own token info
path "auth/token/lookup-self" {
  capabilities = ["read"]
}
EOF

# Create AppRole for application
vault write auth/approle/role/webapp \
    token_policies="db-consumer" \
    token_ttl=1h \
    token_max_ttl=4h \
    secret_id_ttl=720h \
    secret_id_num_uses=0

Step 2: Configure Database Secrets Engine

Set up dynamic credential generation for PostgreSQL and MySQL:

# Enable the database secrets engine
vault secrets enable database

# Configure PostgreSQL connection
vault write database/config/production-postgres \
    plugin_name=postgresql-database-plugin \
    allowed_roles="app-readonly,app-readwrite,app-admin" \
    connection_url="postgresql://{{username}}:{{password}}@db-primary.corp.local:5432/appdb?sslmode=verify-full" \
    username="vault_admin" \
    password="$VAULT_DB_PASSWORD" \
    password_authentication="scram-sha-256"

# Rotate the root credentials so Vault manages them exclusively
vault write -force database/rotate-root/production-postgres

# Create read-only role (TTL: 1 hour, max 24 hours)
vault write database/roles/app-readonly \
    db_name=production-postgres \
    creation_statements="CREATE ROLE \"{{name}}\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}'; \
        GRANT SELECT ON ALL TABLES IN SCHEMA public TO \"{{name}}\"; \
        ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO \"{{name}}\";" \
    revocation_statements="REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA public FROM \"{{name}}\"; \
        DROP ROLE IF EXISTS \"{{name}}\";" \
    default_ttl="1h" \
    max_ttl="24h"

# Create read-write role (TTL: 30 minutes, max 8 hours)

…
자주 묻는 질문

‘동적 비밀 정보’란 무엇인가요?

Vault가 자동으로 생성하고 관리하는 자격 증명(비밀번호나 접근 키 등)입니다. 사용 기간이 짧고, 사용 후나 만료 시 취소됩니다.

고정 비밀 정보 대신 동적 비밀 정보를 사용하는 이유는 무엇인가요?

고정 비밀번호는 유출되면 보안 위험이 큽니다. 동적 비밀 정보는 수명이 짧고 각 사용에 맞춰져 있어 무단 접근이 더 어렵습니다.

애플리케이션이 계속 접근해야 하면 어떻게 하나요?

애플리케이션은 기존 자격 증명이 만료되기 전에 새 동적 자격 증명을 요청할 수 있어, 고정 비밀번호 없이도 접근을 유지할 수 있습니다.

상세 정보

작성자의 원본 설명

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 rotati

repo: mukul975/Anthropic-Cybersecurity-Skills

인기도

GitHub 스타
35k
순위
#8052
라이선스
Apache-2.0
업데이트
2026. 8. 31.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬