The seal "transit" configuration section lets you configure automatic Stronghold unsealing using a key in the Transit secrets engine stored in another Stronghold or HashiCorp Vault cluster. The cluster that runs the key is called the transit cluster in this page, and the cluster that unseals with it is called the protected cluster.

The protected cluster sends the data it needs to protect the root key to the encrypt and decrypt endpoints of the transit cluster. The key itself never leaves the transit cluster.

The transit cluster must be available every time a node of the protected cluster starts. If it is sealed or unreachable, the node of the protected cluster does not start. If you lose the key or the data of the transit cluster, you cannot unseal the protected cluster. Back up the transit cluster and don’t delete the key.

The seal is configured in the server configuration file, so this page applies to standalone installations.

Use scenarios

Use the transit seal when you already have a Stronghold or Vault cluster that you trust more than the protected cluster, for example a small dedicated cluster of one security team that serves the other clusters, and you need auto-unseal without an HSM or a cloud KMS.

Do not set cross-unsealing between two clusters. If both clusters happen to be sealed at the same time, neither of them can unseal automatically. Unseal the transit cluster itself in a way that does not depend on the protected cluster: with Shamir keys, an HSM, or Yandex Cloud KMS.

Prepare the transit cluster

Prepare the following on the transit cluster:

  1. Enable the Transit secrets engine and create a key:

    stronghold secrets enable -path=transit transit
    stronghold write -f transit/keys/autounseal
  2. Create a policy that allows only encryption and decryption with this key:

    path "transit/encrypt/autounseal" {
      capabilities = ["update"]
    }
    
    path "transit/decrypt/autounseal" {
      capabilities = ["update"]
    }

    Save it to the autounseal.hcl file and write it to the cluster:

    stronghold policy write autounseal autounseal.hcl
  3. Create a token for the protected cluster. Make it orphan and periodic so that it doesn’t depend on its parent token and doesn’t expire while Stronghold renews it:

    stronghold token create -orphan -policy=autounseal -period=24h

    Use the client_token value from the response as the token parameter.

Stronghold renews the token by itself at startup, so keep the default policy on it: it contains the permission for auth/token/renew-self. If the token cannot be renewed (for example, it has no default policy or isn’t renewable), Stronghold doesn’t renew it and works with it until it expires, and after that the node cannot unseal.

Configuration example

Add the seal "transit" section to the configuration file of the protected cluster:

seal "transit" {
  address     = "https://transit.example.com:8200"
  token       = "<TOKEN>"
  mount_path  = "transit"
  key_name    = "autounseal"
  tls_ca_cert = "/etc/stronghold/transit-ca.pem"
}

In this example, <TOKEN> is a token of the transit cluster created in the previous section. Instead of the value you can pass a reference in the file:///<PATH/TO/FILE> or env://<VARIABLE_NAME> format: Stronghold reads the token from the file or from the environment variable. The file must contain only the token, without a trailing newline. Otherwise the server doesn’t start and reports that the token contains non-printable characters. Create such a file with printf '%s' "<TOKEN>" > /etc/stronghold/transit-token.

After you modify the configuration, restart Stronghold. When the server starts, it encrypts a test value with the key. If the transit cluster is unavailable, the token has no permissions, or the key doesn’t exist, the server doesn’t start and prints an Error parsing Seal configuration error that contains the cause description, for example connection refused or permission denied.

Transit seal parameters

The seal "transit" section accepts the following parameters:

ParameterRequiredDescription
mount_pathYesMount path of the Transit secrets engine on the transit cluster
key_nameYesName of the key in the Transit secrets engine
addressNoAddress of the transit cluster. If it isn’t set, the VAULT_ADDR environment variable or the client’s default address is used
tokenNoToken for the transit cluster. If it isn’t set, the VAULT_TOKEN environment variable is used
namespaceNoNamespace of the transit cluster where the Transit secrets engine is mounted
disable_renewalNoDisables renewal of the token in Stronghold. By default, false
tls_ca_certNoPath to a CA certificate file for verifying the transit cluster certificate
tls_ca_pathNoPath to a directory of CA certificates
tls_client_certNoPath to a client certificate for mutual TLS
tls_client_keyNoPath to the private key of the client certificate
tls_server_nameNoServer name for TLS verification (SNI)
tls_skip_verifyNoDisables verification of the server certificate. Don’t use this in production. By default, false
key_id_prefixNoPrefix that is added to the key identifier that Stronghold reports for the seal. The identifier consists of the prefix and the key version
disabledNoUsed during migration from one seal mechanism to another

Environment variables

Environment variables take precedence over the values in the configuration file for the following parameters:

ParameterEnvironment variables
mount_pathTRANSIT_WRAPPER_MOUNT_PATH, VAULT_TRANSIT_SEAL_MOUNT_PATH
key_nameTRANSIT_WRAPPER_KEY_NAME, VAULT_TRANSIT_SEAL_KEY_NAME
disable_renewalTRANSIT_WRAPPER_DISABLE_RENEWAL, VAULT_TRANSIT_SEAL_DISABLE_RENEWAL
namespaceVAULT_NAMESPACE

If both variables of a parameter are set, the variable with the TRANSIT_WRAPPER_ prefix is used.

For the address and token parameters, the order is reversed: the value from the configuration file takes precedence over the VAULT_ADDR and VAULT_TOKEN variables.

Initialization

When you initialize the protected cluster with the transit seal, Stronghold issues recovery keys instead of unseal keys. Specify their number with the -recovery-shares and -recovery-threshold parameters:

stronghold operator init -recovery-shares=5 -recovery-threshold=3

You need recovery keys for operations such as generating a root token, changing the unseal keys (rekeying), and migrating to another seal. Store them in the same way as Shamir unseal keys.

After a restart, the node of the protected cluster unseals itself without manual entry of keys.

Migration from Shamir keys to the transit seal

To switch Stronghold from Shamir unseal keys to the transit seal, follow these steps:

  1. Add the seal "transit" section to the configuration as shown above.

  2. Restart Stronghold. The following message appears in the logs: entering seal migration mode; Stronghold will not automatically unseal even if using an autoseal.

  3. Perform the migration by entering the unseal keys:

    stronghold operator unseal -migrate

After the migration is complete, Stronghold unseals itself using the transit seal on restart. The unseal keys become recovery keys.

For a cluster with several nodes, follow the general seal migration procedure. Before the migration, create a cluster data backup. Note that the cluster has to be stopped for a duration of the migration.

Migration from the transit seal to Shamir keys

To switch Stronghold back to Shamir keys, follow these steps:

  1. Add disabled = "true" to the seal "transit" section:

    seal "transit" {
      address    = "https://transit.example.com:8200"
      token      = "<TOKEN>"
      mount_path = "transit"
      key_name   = "autounseal"
      disabled   = "true"
    }
  2. Restart Stronghold.

  3. Perform the migration by entering the recovery keys:

    stronghold operator unseal -migrate

After the migration is complete, Stronghold requires manual entry of unseal keys on each restart.

To move from the transit seal to another auto-unseal mechanism, for example an HSM, keep the seal "transit" section with disabled = "true" and add the new seal section next to it. Then perform the migration by entering the recovery keys.

Recommendations

  • Run the transit cluster as a separate HA cluster with a backup, and monitor its availability: the protected cluster depends on it at every node start.
  • Use a dedicated key and a dedicated token with the minimum permissions for each protected cluster. A token that can decrypt the data of one cluster must not be reused for another one.
  • You can rotate the key on the transit cluster. Don’t delete the key or old key versions that Stronghold may still need for decryption: a version number is stored in the ciphertext, and without that version the root key cannot be decrypted.
  • Don’t pass the token as plain text in the configuration file in production: use file:// or env://, and restrict access to the file.
  • Use TLS with certificate verification (tls_ca_cert) for the connection to the transit cluster.
  • If you use double encryption, the transit cluster must be available during normal operation of Stronghold, not only during unseal.

Additional resources