Skip to content
Tutorials Center
My learning

Topics

Lesson 10 of 36 ยท Secrets Engines

Secrets Engines Overview

Learn what Vault secrets engines are, the main types (KV, database, transit, PKI, SSH, AWS), how to enable, tune, move and disable mounts, and how leases fit in.

A secrets engine is a Vault component that stores, generates or encrypts data. You enable an engine at a path, and from then on everything under that path is handled by it. Some engines are simple storage (KV), some generate credentials on demand (database, AWS), and some perform cryptography for you (Transit, PKI).

This lesson gives the map of engines, the commands for managing mounts, and the idea of static versus dynamic secrets. Later lessons in this chapter go deep on KV, Cubbyhole, PKI and SSH.

Vault is not available here, so commands are read-only and I do not invent their output. The runnable examples model mount management and lease timing as stand-ins.

Static, dynamic and cryptographic engines

Kind Examples What it does
Static storage kv, cubbyhole Stores values you provide
Dynamic credentials database, aws, azure, gcp, ssh Creates credentials on demand, with leases
Cryptography as a service transit, transform (Enterprise), totp Encrypts, signs, hashes, generates one-time codes
Certificates pki Acts as a certificate authority
Identity-related identity Entities and groups (built in, not mounted by you)
flowchart TB
    Router["Vault router"] --> kv["secret/  (kv)"]
    Router --> db["database/"]
    Router --> tr["transit/"]
    Router --> pki["pki/"]
    Router --> ssh["ssh/"]
    kv -.-> S1["stores your data"]
    db -.-> S2["creates DB users"]
    tr -.-> S3["encrypts your data"]
    pki -.-> S4["issues certificates"]

Each engine is mounted at its own path and has its own API shape.

Managing mounts

Terminal
vault secrets list                                  # show all mounts
vault secrets enable -path=kv-team-a kv-v2          # enable KV v2 at kv-team-a/
vault secrets enable database                       # enable at default path database/
vault secrets tune -default-lease-ttl=1h -max-lease-ttl=24h database/
vault secrets move kv-team-a/ kv-platform/          # rename (async, revokes leases)
vault secrets disable kv-platform/                  # DELETES the engine and its data

Be careful with disable: it removes all secrets in that mount and revokes every lease issued by it. tune changes settings such as default and maximum TTL, descriptions and which request headers are passed. Mount paths are the unit of access control, so separate mounts for separate teams or sensitivity levels make policies simple.

You can also give a mount an options map, for example -version=2 for KV, and a description with -description.

Leases

Dynamic engines return a lease ID with each credential. The lease has a TTL and may be renewable. Vault tracks it so that:

  • when the TTL ends, Vault revokes the credential (for example, drops the database user);
  • you can renew within the maximum TTL;
  • you can revoke manually: vault lease revoke <lease_id>, or everything under a prefix with vault lease revoke -prefix database/creds/readonly.

Revoking by prefix is a powerful incident-response tool: if a role is compromised, kill every credential it issued.

Mounts you can model

This model keeps a table of mounts, applies enable, disable and tune, and enforces some rules that Vault applies.

Python A mount table with enable, tune and disable

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.

Two mounts may not overlap in path, which is why secret/team/ conflicts with secret/. The default TTL figures in the model are placeholders; real defaults come from the system and mount configuration.

Lease lifecycle

Python Lease expiry, renewal and the maximum TTL

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.

A lease cannot be extended beyond its maximum TTL: at some point the client must request fresh credentials. Applications that cache dynamic credentials need code for exactly that.

Choosing an engine

  • Need to keep an API key someone gave you? KV.
  • Need unique, short-lived database logins? Database.
  • Need to encrypt a column without managing keys? Transit.
  • Need internal TLS certificates? PKI.
  • Need SSH access to servers without distributing keys? SSH.
  • Need cloud credentials? AWS/Azure/GCP engines.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does vault secrets disable database/ do?

    Disabling deletes the engine's data and revokes outstanding leases.
  2. 2. Which engine encrypts data without storing it?

    Transit performs cryptographic operations on data you send and returns the result; you keep the data.
  3. 3. Why can two mounts not be enabled at secret/ and secret/team/?

    The router needs an unambiguous mount for each path.
  4. 4. A lease reaches its maximum TTL. What must the client do?

    A lease cannot be renewed past its max TTL.

Summary

  • Secrets engines are plugins mounted at paths: static (KV), dynamic (database, cloud, SSH), cryptographic (Transit, TOTP) and certificate (PKI).
  • Manage them with vault secrets list/enable/tune/move/disable; disabling destroys data.
  • Dynamic secrets come with leases that expire, can be renewed up to a maximum, and can be revoked individually or by prefix.
  • Separate mounts make clean policy boundaries.

Next: KV Version 2 and Secret Versioning