Skip to content
Tutorials Center
My learning

Topics

Lesson 5 of 36 ยท Concepts and Setup

Vault Architecture: Barrier, Storage and Paths

Learn how Vault is built: the cryptographic barrier, storage backends, the router with mounted engines and auth methods, tokens, audit devices and the key hierarchy.

To operate Vault well you need a mental model of what is inside it. Vault is a small set of cooperating parts: an HTTP API in front, a router that sends each request to a mounted plugin, a barrier that encrypts everything on the way to storage, and a storage backend that holds only ciphertext.

In this lesson you will meet each part, follow one request through them, and run a model of the barrier that shows why a stolen storage backend is useless without the keys.

Vault is not runnable here. The diagrams reflect Vault's documented design; the Python model uses a deliberately toy cipher (never use it for real data) to demonstrate the concept.

The pieces

flowchart TB
    C["Client (CLI, API, SDK)"] --> API["HTTP API"]
    API --> Core["Vault core: tokens, policies, leases, audit"]
    Core --> R["Router"]
    R --> E1["Secrets engines<br/>kv/ database/ transit/"]
    R --> E2["Auth methods<br/>auth/userpass/ auth/approle/"]
    R --> E3["System backend<br/>sys/"]
    E1 --> B["Barrier (encrypts)"]
    E2 --> B
    E3 --> B
    B --> S[("Storage backend<br/>Raft, Consul, ...")]
    Core --> A["Audit devices"]

Every request is authenticated, authorized and audited by the core, routed to a plugin, and any persistent data passes through the barrier.

  • Storage backend: where encrypted bytes live. The recommended choice is integrated storage (Raft); Consul and some cloud databases are also supported. Vault does not trust it: it assumes the storage can be read by an attacker.
  • Barrier: the cryptographic layer between Vault and storage. Everything written is encrypted with the encryption key (AES-256-GCM); everything read is decrypted.
  • Router: maps paths to plugins using mounts. A request for secret/data/app goes to whatever is mounted at secret/.
  • Secrets engines and auth methods: plugins mounted at paths. Secrets engines live at the top level (secret/, database/), auth methods under auth/.
  • System backend: mounted at sys/, it manages Vault itself: mounts, policies, seal status, leases, audit devices.
  • Audit devices: outputs (file, syslog, socket) that receive a log entry for each request and response.
  • Token store: a built-in component that issues and validates tokens.

The key hierarchy

Vault does not encrypt data with the key you hold. There are layers:

  1. The root key (also called the unseal key, in older terms the "master key") protects the encryption key. The root key is split into shares with Shamir's algorithm (next lesson) or protected by an auto-unseal service such as a cloud KMS.
  2. The encryption key (keyring) encrypts everything in storage. It is itself stored encrypted by the root key.
  3. When Vault unseals, it reconstructs the root key in memory, decrypts the encryption key, and then can read data.

Sealing wipes both keys from memory. A sealed Vault knows nothing and answers only to a few status endpoints.

Following one request

  1. The client calls GET /v1/secret/data/app/db with X-Vault-Token.
  2. The core looks up the token and finds its policies.
  3. The policy engine checks read on secret/data/app/db.
  4. An audit entry is written (and if no audit device can accept it, Vault refuses the request).
  5. The router passes the request to the KV engine.
  6. The engine reads its data through the barrier, which decrypts it.
  7. The response is returned, and a response audit entry is written.

Point 4 is a deliberate safety rule: if every audit device is broken, Vault stops serving requests rather than operate unaudited.

A barrier you can run

This model shows the principle: storage holds only ciphertext, and the key never reaches storage. It uses a toy XOR stream built from a hash, which is not secure; it only illustrates the design.

Python A toy barrier in front of storage

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Mounts and paths in practice

Each plugin instance is a mount at a path, and you can mount the same engine type several times under different names (kv-team-a/, kv-team-b/). A router model with longest-prefix matching:

Python Longest-prefix routing to mounts

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

You list mounts with vault secrets list and vault auth list, and enable one with vault secrets enable -path=kv-team-a kv-v2.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does the storage backend hold?

    Vault treats storage as untrusted. The barrier encrypts everything before it is written.
  2. 2. What does the router do?

    Mount points decide which secrets engine, auth method or system backend handles a path.
  3. 3. What happens if no audit device can record a request?

    Vault prefers to fail closed: it will not handle requests it cannot audit.
  4. 4. Which keys exist when Vault is sealed?

    Sealing wipes the keys from memory, so the barrier cannot decrypt anything.

Summary

  • A request goes through the API, core (token, policy, audit), router, a plugin, and the barrier to storage.
  • The barrier encrypts everything; the storage backend sees only ciphertext.
  • A root key protects the encryption key; sealing removes both from memory.
  • Secrets engines and auth methods are plugins mounted at paths; sys/ manages Vault itself.
  • Vault fails closed when it cannot audit.

Next: Seal, Unseal and Shamir's Secret Sharing