Run the following command to set the owner of the Vault binary:
Shell
sudo chown root:root vault
3
Run the following command to check that the Vault is available on the system path:
Shell
sudo mv vault /usr/local/bin/
4
Run the following command to verify the Vault version:
Shell
vault --version
5
The vault command features opt-in autocompletion for flags, subcommands, and arguments (where supported).Install autocompletion by using the following command:
Shell
vault -autocomplete-install
6
Run the following command to enable autocompletion:
Shell
complete -C /usr/local/bin/vault vault
7
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
sudo setcap cap_ipc_lock=+ep /usr/local/bin/vault
8
Run the following command to create a unique, non-privileged system user to run Vault:
Run the following command to create a Vault service file at /etc/systemd/system/vault.service:
Shell
sudo touch /etc/systemd/system/vault.service
2
Add the following configuration to the Vault service file:
None
[Unit]Description="HashiCorp Vault - A tool for managing secrets"Documentation=https://www.vaultproject.io/docs/Requires=network-online.targetAfter=network-online.targetConditionFileNotEmpty=/etc/vault.d/vault.hclStartLimitIntervalSec=60StartLimitBurst=3[Service]User=vaultGroup=vaultProtectSystem=fullProtectHome=read-onlyPrivateTmp=yesPrivateDevices=yesSecureBits=keep-capsAmbientCapabilities=CAP_IPC_LOCKCapabilities=CAP_IPC_LOCK+epCapabilityBoundingSet=CAP_SYSLOG CAP_IPC_LOCKNoNewPrivileges=yesExecStart=/usr/local/bin/vault server -config=/etc/vault.d/vault.hclExecReload=/bin/kill --signal HUP $MAINPIDKillMode=processKillSignal=SIGINTRestart=on-failureRestartSec=5TimeoutStopSec=30StartLimitInterval=60StartLimitIntervalSec=60StartLimitBurst=3LimitNOFILE=65536LimitMEMLOCK=infinity[Install]WantedBy=multi-user.target
The kms_library stanza of vault.hcl isolates platform-specific configuration for managed keys. It defines logical names referenced within an API configuration, keeping cluster and node-specific details separated along with deployment concerns for each.To integrate the Vault Enterprise server with an HSM for supporting the Managed Keys feature, the configuration file must define the kms_library stanza providing necessary connection information, as shown in the following example:
This guide sets the storage backend to the local file system (/tmp/vault) to make the verification step easy.
The example configuration defines the following parameters in its kms_library stanza:
You can define multiple kms_library stanzas, but the value for the name key must be a unique value across all the stanza definitions in a case-insensitive manner.
Parameter
Description
name
The logical name referred to by a managed key
library
The path to the PKCS #11 library shared object file.