Hashicorp Vault
This page describes how to retrieve secrets from Hashicorp Vault for use in Kafka Connect.
Secure secrets in Hashicorp Vault and use them in Kafka Connect.
Secrets will only be reloaded if the Connector restarts.
From Version 2.2.0, the secret provider does not write secrets to files by default. If you require this behaviour (for trust stores, key stores or certs) you can enable this by adding the property file.write=true
.
Authentication
Multiple authentication methods are supported:
approle
userpass
kubernetes
cert
token
ldap
gcp
awsiam
jwt
github
Configuring the plugin
Name | Description |
---|---|
file.dir | The base location for any files to be stored |
file.write | Writes secrets to file on path. Required for Java trust stores, key stores, certs that need to be loaded from file. For ease of use for the secret provider, this is disabled by default. |
vault.auth.method | Available values are |
vault.addr | Address of the Vault server |
vault.token | Use when ‘vault.auth.method’ is ‘token’ to specify the token value |
vault.namespace | Set a global namespace to the Vault server instance. Requires Vault Enterprise Pro |
vault.pem | File containing the Vault Server certificate content as string |
vault.client.pem | File containing the Client certificate string content as string |
vault.engine.version | KV Secrets Engine version of the Vault server instance. Default is 2 |
vault.ssl.truststore.location | The location of the trust store file |
vault.ssl.keystore.location | The location of the key store file |
vault.ssl.keystore.password | The password for the key store file |
secret.default.ttl | If no TTL is configured in Vault, apply a default TTL. |
app.role.id | Use when vault.auth.method is |
app.role.secret.id | Use when vault.auth.method is |
app.role.path | Use when vault.auth.method is |
username | Use when vault.auth.method is |
password | Use when vault.auth.method is |
mount | Use when vault.auth.method is |
ldap.username | Use when vault.auth.method is |
ldap.password | Use when vault.auth.method is |
mount | Use when vault.auth.method is |
jwt.role | Use when vault.auth.method is |
jwt.provider | Use when vault.auth.method is |
jwt | Use when vault.auth.method is |
gcp.role | Use when vault.auth.method is |
gcp.jwt | Use when vault.auth.method is |
cert.mount | Use when vault.auth.method is |
github.token | Use when vault.auth.method is |
github.mount | Use when vault.auth.method is |
kubernetes.role | Use when vault.auth.method is |
kubernetes.token.path | Use when vault.auth.method is |
kubernetes.auth.path | Use when vault.auth.method is |
aws.role | Use when vault.auth.method is |
aws.request.url | Use when vault.auth.method is |
aws.request.body | Use when vault.auth.method is |
aws.request.headers | Use when vault.auth.method is |
aws.mount | Use when vault.auth.method is |
Example Worker Properties
Usage
To use this provider in a connector, reference the Hashicorp Vault containing the secret and the key name for the value of the connector property.
The indirect reference is in the form ${provider:path:key} where:
provider is the name of the provider in the worker property file set above
path is the path of the secret in Hashicorp Vault
key is the name of the secret key in secret to retrieve. Vault can store multiple keys under a path.
For example, if we store two secrets as keys:
my_username_key with the value lenses and
my_password_key with the value my-secret-password
in a secret called secret/my-vault-secret we would set:
This would resolve at runtime to:
Data encoding
The provider handles the following types:
utf_8
base64
The provider will look for keys prefixed with:
UTF8
UTF_FILE
BASE64
BASE64_FILE
The UTF8
means the value returned is the string retrieved for the secret key. The BASE64
means the value returned is the base64 decoded string retrieved for the secret key.
If the value for the tag is UTF8_FILE
the string contents are written to a file. The returned value from the connector configuration key will be the location of the file. The file location is determined by the file.dir configuration option is given to the provider via the Connect worker.properties
file.
If the value for the tag is BASE64_FILE
the string contents are based64 decoded and are written to a file. The returned value from the connector configuration key will be the location of the file. For example, if a connector needs a PEM file on disk set the prefix as BASE64_FILE
. The file location is determined by the file.dir configuration option is given to the provider via the Connect worker.properties
file.
If no prefix is found the contents of the secret string are returned.
Last updated