Vault Architecture: Seal, Storage, Mounts & Tokens
HashiCorp Vault is a server that holds secrets and hands them out to authenticated clients according to policies. Everything in Vault is an HTTP API on a path, and the CLI is a thin client for it: vault kv get -mount=secret linkly/db is GET /v1/secret/data/linkly/db.
client ──(1) authenticate──► auth method (token, AppRole, JWT/OIDC, Kubernetes, userpass, cloud IAM …)
◄─(2) token + policies─┘
──(3) request with token──► router ──► policy check ──► secrets engine mounted at a path
(kv, database, transit, pki, aws …)
every request and response ──► audit devices
all data at rest ──► barrier (AES-256-GCM) ──► storage backend (integrated Raft)The pieces
| Piece | What it does |
|---|---|
| Storage backend | where encrypted data lives. Production uses integrated storage (Raft) inside the Vault cluster; dev mode uses memory |
| Barrier | everything written to storage is encrypted with the encryption key, which is itself encrypted by the root key (called the master key in older docs) |
| Seal | a started Vault is sealed: it has the encrypted data but not the root key. Unsealing provides it: either Shamir key shares typed in by operators, or auto-unseal with a cloud KMS or HSM |
| Auth methods | turn some identity (a password, a Kubernetes service-account token, a CI OIDC token) into a Vault token |
| Tokens | every request carries one; it has policies, a TTL and a parent (Tokens) |
| Policies | HCL documents granting capabilities on paths; default deny (Policies) |
| Secrets engines | mounted at paths: KV stores static values; database, AWS and PKI generate credentials; transit encrypts without storing |
| Leases | dynamic secrets come with a lease: a TTL after which Vault revokes them (Leases) |
| Audit devices | log every request and response, with secret values HMAC-ed |
Shamir's secret sharing
With the default Shamir seal, vault operator init splits the root key into, say, 5 shares, any 3 of which rebuild it; fewer than 3 reveal nothing. The idea fits in a few lines: the secret is the constant term of a random polynomial of degree 2, each share is one point on it, and three points determine the polynomial. (Real Vault works on bytes in GF(2⁸); this model uses a prime field.)
import random
from itertools import combinations
P = 2**127 - 1 # a prime field
random.seed(42)
def split(secret, n=5, k=3):
coeffs = [secret] + [random.randrange(P) for _ in range(k - 1)]
f = lambda x: sum(c * pow(x, i, P) for i, c in enumerate(coeffs)) % P
return [(x, f(x)) for x in range(1, n + 1)]
def combine(shares):
"""Lagrange interpolation at x = 0."""
total = 0
for i, (xi, yi) in enumerate(shares):
num = den = 1
for j, (xj, _) in enumerate(shares):
if i != j:
num = num * -xj % P
den = den * (xi - xj) % P
total = (total + yi * num * pow(den, -1, P)) % P
return total
root_key = 0x5EC12E7_C0FFEE
shares = split(root_key)
ok = all(combine(list(c)) == root_key for c in combinations(shares, 3))
print("any 3 of 5 shares rebuild the key:", ok)
print("2 shares give the key:", combine(shares[:2]) == root_key)any 3 of 5 shares rebuild the key: True
2 shares give the key: False
In production most teams use auto-unseal (AWS KMS, Azure Key Vault, GCP KMS, Transit on another Vault, an HSM), so restarts don't need people; the Shamir-style recovery keys are then only for recovery operations.
Vault 2.x: what changed
Vault jumped from the 1.x line to 2.0 in April 2026; 2.2 (October 2026) is current, and this course uses 2.2.1. Most of what you learn from 1.x documentation still applies: the CLI, the API paths, KV v2, policies and auth methods are the same. Changes worth knowing:
- Stricter request paths and policies: requests with unclean paths (
/../,/./,//) are rejected, and identity-templated policy paths whose rendered value contains*or+are denied. Policy and config files with duplicate HCL attributes are now errors, not warnings. - Recovery endpoints need a token:
sys/rekeyandsys/generate-rootrequire a valid Vault token in addition to key shares. - New built-ins: dev servers show an
agent-registry/mount and adefault-ceilingpolicy next todefault, both part of 2.x's identity features for AI agents and workloads. - PKI and KV additions in 2.2: post-quantum ML-DSA certificates, CA key export/import, KV v2 snapshot recovery.
Always check the important changes page before upgrading a real cluster.
Licensing and OpenBao
Since August 2023 (Vault 1.15) Vault is under the Business Source License (BUSL 1.1): free to use, including in production, but not to offer as a competing hosted product. The Linux Foundation fork OpenBao continues from the last MPL-licensed code: its CLI is bao, its API paths match Vault's, and the concepts in this course carry over. Some newer Vault features are not in OpenBao and the other way round; see Vault in Production & OpenBao.
Test yourself
What does unsealing provide to a running Vault server?
- The TLS certificate
- The root key that decrypts the encryption key protecting all stored data
- A list of users
- The license
With Shamir shares 3-of-5, how much do 2 shares reveal about the root key?
- Two thirds of it
- Nothing useful
- The first half
- All of it
What is OpenBao?
- A Vault plugin
- The Linux Foundation's open-source (MPL) fork of Vault, with the same API shape and a
baoCLI - A SOPS replacement
- HashiCorp's cloud service