The Vault Hardware Security Module (HSM) auto-unseal and Seal Wrap features require Vault Enterprise with the Governance & Policy Module.
- Download and install Vault.
- Configure Vault.
- Use Vault.
- Enable the Seal Wrap feature.
- Test the Seal Wrap feature.
- Enable and test the Entropy Augmentation feature.
Download Vault
Download precompiled Vault binaries at https://releases.hashicorp.com/vault/. To download Vault Enterprise binaries, follow the instructions HashiCorp provides Vault customers. This integration requires the Enterprise HSM binary, which is available for testing: https://releases.hashicorp.com/vault/1.7.2+ent.hsm/Install Vault
Perform the following steps to install Vault:Run the following command to unzip the downloaded package and then move the vault binary to
/usr/local/bin:Shell
The vault command features opt-in autocompletion for flags, subcommands, and arguments (where supported).Install autocompletion using the following command:
Shell
Run the following command to configure Vault to use the mlock syscall without running the process as root. This operation prevents the system from swapping memory to disk.
Shell
Configure Vault
To configure Vault, perform the following tasks:- Configure systemd.
- Configure Vault settings.
- Configure HSM Auto-unseal and Entropy Augmentation
Configure systemd
Systemd uses documented sane defaults (www.freedesktop.org/software/systemd/man/systemd.directives.html), so you need to set only non-default values in the configuration file.Run the following command to create a Vault service file at
/etc/systemd/system/vault.service:Shell
Configure Vault settings
Vault uses documented sane defaults, so you need to set only non-default values in the configuration file.Configure HSM Auto-unseal and Entropy Augmentation
When you start a Vault server, it normally starts in a sealed state where you must have a quorum of existing unseal keys to unseal it. By integrating Vault with the KMES Series 3, a trusted HSM key provider can automatically unseal the Vault server. To integrate the Vault Enterprise server with a KMES Series 3, the configuration file must define the PKCS11 seal stanza and provide the necessary connection information, as shown in the following example: Example:vault.hcl
None
This guide sets the storage backend to the local file system (
/tmp/vault) to make the verification step easy.| Parameter | Description |
|---|---|
| lib | The path to the PKCS #11 library on the machine where Vault Enterprise is installed. |
| slot | The slot number to use. Set this value to 0 because the FXPKCS11 config file sets the slot to 01 by default. |
| key_label | The label of the key to use. |
| hmac_key_label | The label of the key to use for HMACing |
| generate_key | If no existing key with the label specified by key_label exists at Vault initialization, Vault generates a key. |
For this integration, set the generate\key parameter to
true so that Vault automatically creates the encryption keys that it uses for the Seal Wrap functionality on the KMES. The values set for the key\label and hmac\key\label parameters correspond with the special key label defines that youneed to set in the <CONFIG> section of the fxpkcs11.cfg file).Use Vault
To get started using Vault, perform the following tasks:- Start the Vault server.
- Initialize Vault.
- Access the Vault UI.
Start the Vault server
Perform the following steps to start the Vault server:Run the following command to set the PKCS #11 PIN to log in. Use the password of the user you created on the KMES and defined in the
fxpkcs11.cfg file.Shell
You can also set the PKCS #11 PIN in the Vault configuration file (
vault.hcl) with the pin parameter, but we do not recommend that method in a production setting. As a best practice, specify the pin with the VAULT\HSM\PIN environment variable, as shown here, to prevent password exposure if the config file is compromised or stored in an insecure location. If you set it through the environment variable, Vault obfuscates the environment variable after reading it. One caveat: You must reset the VAULT\HSM\PIN environment variable when Vault restarts.Run the following command to start the Vault server:
Shell
If the command succeeds, expect output similar to the following example:
None
Initialize Vault
Perform the following steps to initialize Vault:Run the following command to check the Vault status:
Shell
The output should be similar to the following example:
None
Run the following command to initialize Vault:
Shell
The output should be similar to the following example:
None
Access the Vault UI
Perform the following steps to access the Vault UI:Enable the Seal Wrap feature
You can enable Seal Wrap by using the following methods:- CLI command
- Web UI
Method 1: CLI command
Perform the following steps to execute the CLI command method:To compare seal-wrapped data against unwrapped data, enable key/value v1 secrets engine at two different paths: kv-unwrapped and kv-seal-wrapped.Run the following command to enable k/v v1 without seal wrap at kv-unwrapped:Run the following command to enable k/v v1 with seal wrap by using the -seal-wrap flag when you enable the KV workflow:To enable seal wrap, pass the -seal-wrap flag when you enable a secrets engine
Shell
Shell
Method 2: Web UI
Perform the following steps to execute the Web UI method:Open a web browser and launch the Vault UI (for example,
http://127.0.0.1:8200/ui) and then log in.Test the Seal Wrap feature
You can test Seal Wrap and view encrypted secrets by using one of the following methods:- CLI command
- Web UI
Method 1: CLI command
Perform the following steps to execute the CLI command method:Run the following command to read the path to verify:
Shell
If the command succeeds, the output is similar the the following example:
None
View the encrypted secrets
Remember that you configured the Vault server to use the local file system (/tmp/vault) as its storage backend, as shown in the following example:
None
SSH into the machine where the Vault server is running, and check the stored values in the The
/tmp/vault directory:Shell
/tmp/vault/logical directory has two sub-directories. One maps to kv-unwrapped/ and another maps to kv-seal-wrapped/ although you cannot tell by the folder names.Example of viewing encrypted secrets
The following example demonstrates viewing encrypted secrets:Go to the other directory that maps to
kv-seal-wrapped/wrapped. Then, run the following command to view its content. The password value is encrypted.Method 2: Web UI
Perform the following steps to execute the Web UI method:Enter
unwrapped in the Path for this secret field. Use password in the secret key field and my-longpassword in the value field.Repeat the same step for kv-seal-wrapped to write the same secret at the
kv-seal-wrapped/wrapped path.View the encrypted secrets
Remember that you configured the Vault server to use the local file system (/tmp/vault) as its storage backend, as shown in the following example:
None
SSH into the machine where the Vault server is running, and check the stored values in the The
/tmp/vault directory.Shell
/tmp/vault/logical directory has two sub-directories. One maps to kv-unwrapped/ and another maps to kv-seal-wrapped/ although you cannot tell by the folder names.Example of viewing encrypted secrets
The following example demonstrates viewing encrypted secrets:Enable and test the Entropy Augmentation feature
To leverage an external entropy source, you must set the external_entropy_access parameter totrue when you enable a secrets engine or auth method.
Perform the following steps to enable the KMES as the external entropy source on a transit secrets engine:
You must enable the Entropy Augmentation feature through the CLI because we do not support using the Web UI at this time.
Run the following command to enable the transit secrets engine with an external entropy source by using the -external-entropy-access flag:
Shell
Run the following command to list the enabled secrets engine with -detailed flag:Example output:Notice that the External Entropy Access is set to
Shell
None
true for transit/.
