The HashiCorp Vault plugin supports the following types of credentials:
- Vault Token (recommended)
- AppRole (for automation/service accounts)
- Other Auth Methods (Kubernetes, LDAP, AWS IAM, OIDC, GitHub, etc.)
- Use the resulting Vault token in the plugin configuration
Token Generation
Login to Vault
vault loginUse your organization's auth method (userpass/LDAP/OIDC/GitHub/etc.).
Create a Token with TTL
vault token create -policy="root" -ttl=24h- Replace
rootwith a policy that grants read/list permissions to the engines you intend to scan. - Adjust
-ttl(e.g.,1h,24h,72h). Tokens expire after TTL and must be renewed or recreated.
Non‑Expiring Tokens (Use with caution)
vault token create -policy="root"- Omitting
-ttlcreates a token with default TTL; in many setups this can be long-lived or effectively non-expiring depending on token role constraints. - Prefer short-lived, renewable tokens for security. If you must use a non-expiring token, scope it narrowly via policy and rotate periodically.
AppRole (Programmatic)
vault write auth/approle/login role_id="<ROLE_ID>" secret_id="<SECRET_ID>"- Extract the
client_tokenfrom the response and use it asvaultTokenin the plugin.
Required Policies / Permissions
Grant list/read on relevant paths. Example for KV v2 mounted at secret/:
# KV v2 data read/listpath "secret/data/*" { capabilities = ["read", "list"]}# KV v2 metadata list (needed to enumerate)path "secret/metadata/*" { capabilities = ["list"]}For other engines (Transit, PKI, etc.), grant the minimal read/list capabilities needed to enumerate and read metadata.
Security Notes
- Prefer short-lived, renewable tokens. Rotate credentials regularly.
- Scope policies to the minimal paths required for discovery.
- Avoid broadly-permissive tokens; use narrow mounts and namespaces.