Testing PKI operations
This section demonstrates through several PKI operations how to create Root and intermediate CAs, which can then issue leaf certificates under them.
Before performing the test PKI operations, perform the following steps to initialize, unseal (if required), and log in to Vault:
In a different terminal window from where Vault is running, run the following commands to set the VAULT_ADDR and PIN environment variables.
Run the following command to check the Vault status.
If the operation succeeds, the output should be similar to the following example:
Run the following command to initialize Vault:
We do not recommend using 1 for both the key shares and the key threshold in production.
If the operation succeeds, the output should be similar to the following example:
Optionally, if HSM auto unseal is not configured, run the following command to unseal Vault manually:
Run the following command to log in to Vault:
Run the following command to generate a managed key on the HSM for the Root CA:
The value specified in the library field in the preceding command must match the value set in the name field of the kms_library stanza in the Vault configuration file (shown in the following example):
The value specified in the token_label field in the preceding command must be Futurex.
Run the following command to generate a managed key on the HSM for the intermediate CA:
Run the following command to verify that the key configurations were written to Vault:
Run the following commands to verify that the key configurations are valid by test signing some data:
Run the following command to enable the PKI secrets engine for the Root CA:
Run the following command to enable the PKI secrets engine for the Intermediate CA:
Create a Root CA certificate with the corresponding managed key that you generated and stored on the HSM
Run the following command to create a Root CA certificate with its corresponding managed key and output it to a file:
Run the following command to verify that the certificate looks correct:
Run the following command to create an Intermediate CA certificate with its corresponding managed key and output it to a file:
The following command requires you to install the jq package on your system. This package processes JSON output.
Run the following command to verify that the certificate looks correct:
Run the following command to sign the intermediate CA certificate with the managed Root CA and output it to a file:
The following command requires you to install the jq package on your system. This package processes JSON output.
Run the following command to write the signed Intermediate CA certificate to Vault:
Run the following command to create a new role:
Run the following command to issue a leaf certificate: