open-vault/website/content/docs/internals/architecture.mdx

88 lines
6.2 KiB
Plaintext
Raw Normal View History

2015-04-08 19:17:03 +00:00
---
layout: docs
page_title: Architecture
description: Learn about the internal architecture of Vault.
2015-04-08 19:17:03 +00:00
---
# Architecture
Vault is an intricate system with numerous distinct components. This page details the system architecture and hopes to assist Vault users and developers to build a mental model while understanding the theory of operation.
2015-04-08 19:17:03 +00:00
~> **Note:** This page covers the technical details of Vault. The descriptions and elements contained within are for users that wish to learn about Vault without having to reference the source code. Although not required, we encourage all users and operators to review the provided information before using Vault due to its significance in an environment.
2015-04-08 19:17:03 +00:00
2015-04-08 22:36:55 +00:00
# High-Level Overview
The diagram below illustrates the intricacies and distinct components of Vault.
2015-04-08 22:36:55 +00:00
New Docs Website (#5535) * conversion stage 1 * correct image paths * add sidebar title to frontmatter * docs/concepts and docs/internals * configuration docs and multi-level nav corrections * commands docs, index file corrections, small item nav correction * secrets converted * auth * add enterprise and agent docs * add extra dividers * secret section, wip * correct sidebar nav title in front matter for apu section, start working on api items * auth and backend, a couple directory structure fixes * remove old docs * intro side nav converted * reset sidebar styles, add hashi-global-styles * basic styling for nav sidebar * folder collapse functionality * patch up border length on last list item * wip restructure for content component * taking middleman hacking to the extreme, but its working * small css fix * add new mega nav * fix a small mistake from the rebase * fix a content resolution issue with middleman * title a couple missing docs pages * update deps, remove temporary markup * community page * footer to layout, community page css adjustments * wip downloads page * deps updated, downloads page ready * fix community page * homepage progress * add components, adjust spacing * docs and api landing pages * a bunch of fixes, add docs and api landing pages * update deps, add deploy scripts * add readme note * update deploy command * overview page, index title * Update doc fields Note this still requires the link fields to be populated -- this is solely related to copy on the description fields * Update api_basic_categories.yml Updated API category descriptions. Like the document descriptions you'll still need to update the link headers to the proper target pages. * Add bottom hero, adjust CSS, responsive friendly * Add mega nav title * homepage adjustments, asset boosts * small fixes * docs page styling fixes * meganav title * some category link corrections * Update API categories page updated to reflect the second level headings for api categories * Update docs_detailed_categories.yml Updated to represent the existing docs structure * Update docs_detailed_categories.yml * docs page data fix, extra operator page remove * api data fix * fix makefile * update deps, add product subnav to docs and api landing pages * Rearrange non-hands-on guides to _docs_ Since there is no place for these on learn.hashicorp, we'll put them under _docs_. * WIP Redirects for guides to docs * content and component updates * font weight hotfix, redirects * fix guides and intro sidenavs * fix some redirects * small style tweaks * Redirects to learn and internally to docs * Remove redirect to `/vault` * Remove `.html` from destination on redirects * fix incorrect index redirect * final touchups * address feedback from michell for makefile and product downloads
2018-10-19 15:40:11 +00:00
[![Architecture Overview](/img/layers.png)](/img/layers.png)
2015-04-08 22:36:55 +00:00
2022-08-09 22:09:49 +00:00
Vaults encryption layer, referred to as the _barrier_, is responsible for encrypting and decrypting Vault data. When the Vault server starts, it writes data to its storage backend. Since the storage backend resides outside the barrier, its considered untrusted so Vault will encrypt the data before it sends them to the storage backend. This mechanism ensures that if a malicious attacker attempts to gain access to the storage backend, the data cannot be compromised since it remains encrypted, until Vault decrypts the data. The storage backend provides a durable data persistent layer where data is secured and available across server restarts.
When a Vault server is started, it begins in a _sealed_ state. Before any
operation can be performed on Vault, it must be _unsealed_. This is done by
providing the unseal keys. During the Vault initialization, it generates an
encryption key, which is used to protect all Vault data. This key is protected by
a root key that is stored alongside all other Vault data, but is encrypted by another mechanism: the unseal key.
By default, Vault uses [Shamir's Secret
Sharing](https://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing) to split the
unseal key into a configured number of shards (key shares or unseal
keys). A precise number of shards are required to reconstruct the unseal key,
which is then used to decrypt the Vault's root key.
2015-04-08 22:36:55 +00:00
![Unseal keys](/img/vault-shamir-seal.png)
Refer to the [Seal/Unseal](/vault/docs/concepts/seal#seal-unseal) documentation for
further details.
2015-04-08 22:36:55 +00:00
The number of shares and the minimum number of shards required can both be specified.
Shamir's technique can be disabled, and the root key can be used directly for
unsealing. Once Vault retrieves the encryption key, it decrypts the
2017-09-21 21:14:40 +00:00
data in the storage backend, and enters the _unsealed_ state. Once unsealed,
Vault loads the configured audit devices, auth methods, and secrets
2017-09-21 21:14:40 +00:00
engines.
2015-04-08 22:36:55 +00:00
~> **Note:** The default Vault configuration uses a Shamir seal; however, Vault can be [auto
unsealed](/vault/docs/concepts/seal#auto-unseal) by a trusted cloud key management
system (KMS) or hardware security module (HSM) to increase security.
The configuration of the audit devices, auth methods, and secrets engines are security sensitive and are stored in Vault. Users with permissions can modify them and cannot be specified outside of the barrier. By storing them in Vault, changes are protected by the ACL system and tracked by audit logs.
2015-04-08 22:36:55 +00:00
Requests may be processed from the HTTP API to the core once Vault is unsealed.
The core manages the flow of requests through the system,
2017-09-21 21:14:40 +00:00
enforce ACLs, and ensure audit logging is done.
2015-04-08 22:36:55 +00:00
When a client first connects to Vault, the client needs to authenticate. Vault provides
configurable auth methods and offers flexibility within the authentication mechanism
used. Mechanisms such as username/password or GitHub may be
2017-09-21 21:14:40 +00:00
used for operators, while applications may use public/private keys or tokens to
authenticate. An authentication request that flows through the core and into an auth
method determines if the request is valid and returns a list of
2017-09-21 21:14:40 +00:00
associated policies.
Policies are just a named ACL rule. For example, the "root" policy is built-in
and permits access to all resources. You may create any number of named policies
with fine-grained control over paths. Vault operates in an allowed-access mode, meaning the action is not allowed unless access is granted via a policy explicitly. Since a user may have multiple policies associated, actions are allowed when policy permits. Policies are stored and managed by an internal
policy store. This internal store is affected through the system backend,
2017-09-21 21:14:40 +00:00
which is always mounted at `sys/`.
2015-04-08 22:36:55 +00:00
Once authentication takes place and an auth method provides a set of applicable
2017-09-21 21:14:40 +00:00
policies, a new client token is generated and managed by the token store. This
client token is used to make future requests.
This token method is similar to a cookie sent by a website when a user logs in. Depending on the auth method configuration, the client
token may have a lease associated with it, and may need to be renewed periodically to avoid invalidation.
Once authenticated, requests are made by providing the client token. The client token is
used to verify the client, ensuring they are authorized while loading the relevant policies. The
policies are used to authorize the client request. The request is then routed to the secrets engine, which is processed depending on its type. When the secrets engine returns the secret, the core registers it with the expiration manager and attaches a lease ID. Clients use the lease ID to renew or revoke their
secret. The expiration manager automatically revokes the secret if a client allows the lease to expire.
The core logs requests and responses to the audit broker, distributing the requests to all configured audit devices. Outside of the request
flow, the core performs specific background activities. Lease management is critical, allowing expired client tokens or secrets to be revoked automatically. Additionally, Vault handles specific partial-failure cases by using write-ahead logging with a rollback manager. This is managed transparently within the core and is not user-visible.
# Resources
- To learn more about each components and sub-systems within Vault, select a topic from the left-navigation menu.
- For in depth details, consult the code.
- To get started with Vault, try out our [Getting Started](/vault/tutorials/getting-started) tutorial.