- Storage backend (Consul, S3, DynamoDB, Integrated Storage)
- Listener settings (API and cluster addresses, ports, TLS)
- Seal mechanism (AWS KMS, Azure KMS, Transit)
- Cluster parameters (cluster name, UI, API address, log level)
- Optional stanzas (telemetry, audit devices, etc.)
Running Vault with a Config File
To start Vault using your configuration file:In production environments, manage Vault with a service manager like systemd or Windows Service Manager to ensure automatic startup and proper log handling.
Key Configuration Components
| Component | Description | Example |
|---|---|---|
| Storage | Persistent data backend | storage "consul" { ... } |
| Listener | Network interface, ports, and TLS settings | listener "tcp" { address = "0.0.0.0:8200" } |
| Seal | Auto-unseal mechanism configuration | seal "awskms" { region = "us-east-1" } |
| Telemetry | Metrics collection and export | telemetry { prometheus_retention_time = "24h" } |
| Audit devices | Write-ahead logs of Vault requests and responses | audit "file" { path = "/var/log/vault_audit.log" } |
Configuration Structure
A Vault configuration file comprises multiple named stanzas and top-level parameters. Here’s the skeleton in HCL:- listener: Defines the API port, cluster port, and TLS options.
- storage: Configures where Vault persists its data.
- seal: Sets up the auto-unseal provider (e.g., KMS).
- telemetry: Controls metrics export.
api_addrcluster_addruicluster_namelog_level
Basic Stanza Examples
- listener: Binds Vault to all interfaces on ports 8200 (API) and 8201 (cluster).
- seal: Configures AWS KMS for automatic unseal.
Disabling TLS (
tls_disable = true) is insecure. Always enable TLS (tls_disable = false) in production and provide valid certificates.Production-Ready Configuration Example
Use this HCL template as a starting point for a highly available, production-grade Vault cluster:- storage.consul: Persists Vault data to a local Consul agent.
- tls_disable = false: Enforces TLS; certificates must be valid.
- seal.awskms.endpoint: Uses a VPC endpoint for secure AWS KMS access.
Vault Contents vs. Config File
The Vault configuration file does not manage:- Secrets Engines
- Auth Methods
- Audit Devices (beyond file/device declaration)
- Vault Policies, Entities, and Groups
Summary of Stanzas
| Stanza | Required | Description |
|---|---|---|
| listener | Yes | API and cluster bindings, TLS settings |
| storage | Yes | Backend for storing Vault data |
| seal | No* | Auto-unseal provider |
| telemetry | No | Metrics publishing settings |
| audit | No | Audit device declarations |
| database | No | Database credentials rotation |