Security
HashiCorp Vault Enterprise Guide: Secrets Management, PKI, Authentication and Production Architecture
A production-focused guide covering Vault architecture, KV v2, AppRole, Kubernetes authentication, PKI, Transit, Raft storage, dynamic secrets and enterprise security practices.
🧱 → ⚙️ → 🚀
Architecture → Automation → Production
Vault Overview
HashiCorp Vault centralizes secrets management, encryption and identity. Rather than storing passwords, API keys or certificates in configuration files, applications request short-lived credentials from Vault. This reduces secret sprawl and improves auditing and rotation.
| Feature | Purpose | Production Recommendation |
|---|---|---|
| KV v2 | Static secrets | Enable versioning |
| Dynamic Secrets | Temporary credentials | Prefer over static passwords |
| PKI | Certificate management | Use for internal TLS |
| Transit | Encryption as a service | Avoid exposing keys |
Application → Vault Auth → Policy Check → Secret Engine → Temporary Secret
Architecture
Client → Auth Method → Token → Policy → Secret Engine → Audit Log
│
Integrated Storage (Raft)Getting Started
vault server -config=vault.hcl
vault status
vault operator init
vault operator unsealAuthentication
vault auth enable approle
vault auth enable kubernetes
vault auth enable ldapKV v2
vault secrets enable -path=secret kv-v2
vault kv put secret/app username=admin password=s3cr3t
vault kv get secret/appPKI
vault secrets enable pki
vault write pki/root/generate/internal common_name=company.local ttl=87600hKubernetes Integration
vault write auth/kubernetes/config ...
vault write auth/kubernetes/role/web \
bound_service_account_names=web \
policies=webTerraform Integration
provider "vault" {}
data "vault_kv_secret_v2" "db" {
mount="secret"
name="database"
}Ansible Integration
- name: Read secret
community.hashi_vault.vault_kv2_get:
url: https://vault.example.comSecurity Best Practices
- Use AppRole or Kubernetes auth instead of long-lived tokens.
- Enable audit devices.
- Rotate root tokens.
- Use Integrated Storage (Raft) with snapshots.
- Enable auto-unseal where appropriate.
Useful Commands
vault status
vault operator raft snapshot save backup.snap
vault token lookup
vault policy list
vault kv get secret/app
vault lease revokeKey Takeaways
Vault provides centralized, audited and policy-driven secrets management. In production, combine short-lived credentials, strong authentication, audit logging, Raft storage and automated rotation for a secure platform.