Vault Architecture Fundamentals · Topic 2 of 3

Sealing and Unsealing Vault

Vault Associate (003): sealed vs unsealed, Shamir shares and threshold, the seal and unseal commands, sudo on sys/seal, and auto unseal with recovery keys.

  • 4 min
In a nutshell
  • Vault starts sealed; a sealed Vault reaches storage but cannot decrypt its data.
  • Default Shamir settings are 5 key shares with a threshold of 3.
  • vault operator unseal takes one share per call; -reset clears progress.

What it is

When a Vault server starts, it starts sealed. A sealed Vault can reach its storage but cannot decrypt the data, because it does not have the plaintext root key. Before it is unsealed, only unseal and status operations are possible.

Unsealing is the process of obtaining the plaintext root key. Sealing throws that key away again, so everything is locked until the next unseal.

StartSealedunseal key sharesUnsealedvault operator sealSealed

How it works

Initialization and Shamir shares

A new Vault is initialized once with vault operator init. By default the unseal key is split into shares using Shamir's Secret Sharing, and a threshold of those shares is needed to rebuild it.

FlagDefaultMeaning
-key-shares5Number of unseal key shares generated
-key-threshold3Shares needed to unseal; must be less than or equal to -key-shares

With the defaults, five people each hold one share and any three of them can unseal Vault. Init cannot run against a cluster that is already initialized.

Unsealing

Each operator supplies one share with vault operator unseal. With no argument the command prompts for the key and hides it. Passing the key on the command line is discouraged because it lands in shell history.

vault operator unseal
vault operator unseal -reset
vault status

The process is stateful, so shares can come from different clients. The output reports progress, such as Unseal Progress, until the threshold is met. -reset discards the keys entered so far, and -migrate marks a key as part of a seal migration.

An unsealed node stays unsealed until you reseal it, restart the server or it hits an unrecoverable storage error.

Sealing

vault operator seal

Sealing deletes the root key from memory, so the server stops answering requests until it is unsealed again. If an unseal is in progress, sealing resets it. Sealing needs only a single operator with root privileges.

Over the API the call is POST /sys/seal. The token needs the root policy or the sudo capability on that path. Only the active node can be sealed; to seal a standby node, restart it.

Auto unseal

With auto unseal, Vault hands protection of the unseal key to a trusted device or service, such as a cloud KMS or HSM. At startup, Vault asks that service to decrypt the root key, so no operator has to type shares.

Vault startsasksTrusted KMS or HSMdecrypts root keyUnsealed

Auto unseal changes what the shares mean. Instead of unseal keys you get recovery keys, created by splitting an internal recovery key with Shamir's Secret Sharing.

Recovery keys cannot decrypt the root key and cannot unseal Vault if auto unseal fails. They authorize operations such as generating a root token.

Compare the two modes

PointShamir (default)Auto unseal
Who unsealsOperators enter key sharesA trusted KMS or HSM decrypts the root key
Keys you holdUnseal keysRecovery keys
Root token generationNeeds unseal keysNeeds recovery keys
Init flags-key-shares, -key-threshold-recovery-shares, -recovery-threshold

How the exam asks about this

  • "A freshly restarted node reaches its storage backend, yet no secret can be read." It is sealed and lacks the key to decrypt the data.
  • "An API call to sys/seal is denied for a token that is not root." The token is missing sudo on that path.
  • "A cluster uses auto unseal. What is needed to generate a root token?" Recovery keys, not unseal keys.

What to remember for the exam

  • Vault starts sealed; a sealed Vault reaches storage but cannot decrypt its data.
  • Default Shamir settings are 5 key shares with a threshold of 3.
  • vault operator unseal takes one share per call; -reset clears progress.
  • vault operator seal discards the root key from memory; it needs a root or sudo token.
  • Auto unseal uses a trusted KMS or HSM and replaces unseal keys with recovery keys.
  • Recovery keys cannot unseal Vault, but they authorize operations such as root token generation.
Watch out

Sealing is a single-operator action, but unsealing is not. After a seal you need the threshold of key shares again, so make sure the holders are reachable.

Common mistakes

Mixing up unseal and recovery keys. Unseal keys decrypt the root key under Shamir. Recovery keys exist with auto unseal and cannot decrypt the root key.

Thinking one share unseals Vault. The default needs three of five. Every call to unseal adds one share until the threshold is met.

Believing a restart keeps Vault unsealed. A restart returns the server to the sealed state. Auto unseal handles that automatically, while Shamir needs the key holders.

Check yourself

  • What are the default key shares and threshold from vault operator init?

    Five key shares with a threshold of three, so any three share holders can unseal Vault.

  • What does a token need to call sys/seal?

    The root policy or the sudo capability on the sys/seal path.

  • With auto unseal, what replaces unseal keys?

    Recovery keys, which cannot unseal Vault but authorize operations such as generating a root token.

Topic 2 of 3 in Vault Architecture Fundamentals

Test yourself on Vault Architecture Fundamentals

The full HashiCorp Vault Associate 003 question bank has 600 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by HashiCorp. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.