Skip to content

Architecture

  • Configures location for storage of vault data
  • Defined in main vault configuration file
  • Data is encrypted in transit (TLS) and at rest using AES256
  • Some storages are for high availability and others for better management and data protection
  • Only one storage backend per vault cluster, all the nodes share the same db backend, one node is active and rest are standby
  • Supported Storage backend documentation is available 🌐
  • Docker setup of Vault 🌐
  • Manages secrets
  • Secret engines can store, generate and encrypt data
  • Many engines can connect to other services to generate dynamic credentials on demand
  • There can be multiple instances of same type of secret engine
  • Secret engines are mounted at path and all interactions are done with the path itself
  • Manages authentication and manages identities
  • Responsible for assigning identity and policies to users
  • Multiple authentication methods can be enabled
  • There are 2 types of authentication methods classes: human and machine
  • Once authenticated, vault issues a token to the client or user to make all subsequent vault requests until TTL
  • Each token has a policy and a TTL
  • Default authentication method for vault is also token based
  • Keeps detailed log for all requests and responses to vault
  • More than one audit devices can be enabled
  • Audit log is formatted using json
  • Sensitive info is hashed before logging
  • There can be multiple audit devices enabled
  • Vault required at least one audit device to write the log before completing the vault request - if enabled
  • Prefers safety over availability
  • Log files should be protected as a user with a permission can still check the values of those secrets via the /sts/audit-hash API and compare to the log file
  • Writes to a local file
  • Does not assist with log rotation
  • Use fluent or similar tool to send to collector and a tool to rotate logs
  • Writes logs to a local syslog upstream sever
  • Send those logs to a local agent and local agent send that upstream to desired location
  • Writes to TCP, UDP or UNIX sockets
  • Unreliable due to underlying protocol (if its UDP)
  • Should be used where strong guarantees are required
CommandEffect
vault audit enable file file_path=FILE_PATHEnables file based audit device

How Vault Works (Broken link)

Vault Layers

  • More information can be seen at 🌐
  • Everything in vault is path based
  • The path prefix tells vault which component a request should be routed
  • Secret engines, authentication methods and audit devices are mounted at paths
  • Paths available are dependent on features that are enabled in the vault
  • System backend is the default backend in vault which is mounted at /sys endpoint
  • Every vault component has its own default path
  • Master key protects encryption key
  • Encryption key protects vault data
  • Encryption key is stored in vault node memory
  • Used to encrypt and decrypt encryption key
  • Created using initialization and re key operations
  • Never written to storage when using traditional unseal mechanism
  • Written to core/master (storage backend) when using auto unseal
  • Used to encrypt and decrypt the vault data written to storage backend
  • Encrypted by the master key
  • Stored alongside the data in a keyring on the storage backend
  • Can be easily rotated
  • Vault starts in sealed state, meaning it knows where to access the data but can not decrypt it. Users can seal it manually as well
  • Almost no operations are possible when the vault is in sealed state (only status check and unsealing are possible)
  • Unsealing vault means that a node can reconstruct the master key in order to decrypt the encryption key, and ultimately read the data
  • After unsealing, the encryption key is stored in memory
  • Every node in the cluster should be unsealed to do any operations
  • Sealing vault means it throws away the encryption key and requires another unseal to perform any further operations
  • The master key is broken into N parts and given to N people
  • While unsealing the vault,it requires a threshold of keys, threshold can be set at vault initialization
  • It is the default option
  • No single person should have access to all those shards
  • Shards should not be stored online
CommandEffect
vault statusSee vault status
vault operator initInitializes vault and gives root token, and key shards
vault operator unsealInitiate vault unseal or progress it, do this until the threshold is reached
vault login ROOT_TOKENLogin using root token
vault operator sealSeal the vault, requires root privilages on login token
2.5.1.2 Cloud Auto Unseal (cloud key management like KMS)
Section titled “2.5.1.2 Cloud Auto Unseal (cloud key management like KMS)”
  • Use cloud based key management solution to encrypt and decrypt master key or a on prem HSM
  • Master key is written to storage backend but is encrypted using cloud KMS
  • Vault configuration file identifies the key use for decryption
  • Cloud auto unseal automatically unseals the vault upon restart of node or service
  • When using auto unseal, it provides recovery keys instead of unseal keys
  • Vault is initialized in unsealed state as it reaches out to cloud KMS key and auto unseals itself
  • We can disable the KMS key to seal the vault
  • Utilizes another vault’s transit secrets engine to seal and unseal itself
  • Returns recovery keys instead of unseal keys
  • The transit secret engine may be configured in a namespace
  • Supports key rotation
  • This minimizes the overhead of creation of KMS key for all vaults in an organization and have better centralized protection
  • But all are dependent on some other vault except one, if the main one stops or is sealed, others stop working too (hierarchy)
  • The core vault must be highly available (multi node, HA storage backend)
  • Sets recovery seal type to transit