Posts

HashiCorp Vault Enterprise Guide: Secrets Management, PKI, Authentication and Production Architecture

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.

FeaturePurposeProduction Recommendation
KV v2Static secretsEnable versioning
Dynamic SecretsTemporary credentialsPrefer over static passwords
PKICertificate managementUse for internal TLS
TransitEncryption as a serviceAvoid 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 unseal

Authentication

vault auth enable approle
vault auth enable kubernetes
vault auth enable ldap

KV v2

vault secrets enable -path=secret kv-v2
vault kv put secret/app username=admin password=s3cr3t
vault kv get secret/app

PKI

vault secrets enable pki
vault write pki/root/generate/internal common_name=company.local ttl=87600h

Kubernetes Integration

vault write auth/kubernetes/config ...
vault write auth/kubernetes/role/web \
 bound_service_account_names=web \
 policies=web

Terraform 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.com

Security 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 revoke

Key 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.