How to sync secrets from Infisical to HashiCorp Vault
Infisical connects to Vault via the AppRole auth method.
Currently, each Infisical project can only point and sync secrets to one Vault cluster / namespace but with unlimited integrations to different paths within it.
This tutorial makes use of Vault’s UI but, in principle, instructions can executed via Vault CLI or API call.
Lastly, you should note that we provide a simple use-case and, in practice, you should adapt and extend it to your own Vault use-case and follow best practices, for instance when defining fine-grained ACL policies.
Prerequisites:
This section mirrors the latter parts of the Vault quickstart provided by HashiCorp and uses sample names/values for demonstration.
To begin, navigate to the cluster / namespace that you want to sync secrets to in Vault; we’ll use the default admin
namespace (in practice, we recommend creating a namespace and not using the default admin
namespace).
In Secrets, enable a KV Secrets Engine at a path for Infisical to sync secrets to; we’ll use the path kv
.
In Access > Auth Methods, enable the AppRole auth method.
Now in Policies, create a new ACL policy scoped to the path(s) you wish Infisical to be able to sync secrets to.
We’ll call the policy test
and have it grant access to the dev
path in the KV Secrets Engine where we will be syncing secrets to from Infisical.
kv
comes from the path of the KV Secrets Engine that we enabled and dev
is the chosen path within it
that we want to sync secrets to.
We now create a infisical
role with the generated token’s time-to-live (TTL) set to 1 hour and can be renewed for up to 4 hours from the time of its creation.
>_
) to open a command shell in the browser.Finally, we need to generate a RoleID and SecretID (like a username and password) that Infisical can use to authenticate with Vault.
Click the Vault CLI shell icon (>_) again to open a command shell.
Read the RoleID.
Example output:
infisical
role.Example output:
Great. We’re now ready to connect Infisical to Vault!
Back in Infisical, press on the HashiCorp Vault tile and input your Vault instance and infisical
role RoleID and SecretID.
For additional details on each field:
If using HCP, you can copy your Cluster URL in the Cluster Overview:
infisical
role.infisical
role.Select which Infisical environment secrets you want to sync to Vault.
For additional details on each field:
kv
.Press create integration to start syncing secrets to Vault.