Current state: Under discussion
Discussion thread: here [Change the link from the KIP proposal email archive to your own email thread]
JIRA: here [Change the link from KAFKA-1 to your own ticket]
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
Kafka Connect allows integration with many types of external systems. Some of these systems may require secrets to be configured in order to access them. Many customers have an existing Secret Management strategy and are using centralized management systems such as Vault, Keywhiz, or AWS Secrets Manager. Vault is very popular and has been described as "the current gold standard in secret management and provisioning". These Secret Management systems may satisfy the following customer requirements:
Other customers may be passing secrets into the host through various means (such as through Docker secrets), but do not want the secret to appear in cleartext in the Kafka Connect configuration.
There is a need for secrets from all of these systems to be injected into Kafka Connect configurations, and allow the customer to specify the means of injection through a plugin.
Two new interfaces will be available in Kafka Connect. These interfaces allow for custom ConfigProviders to be specified for Kafka Connect.
public interface ConfigProvider extends Configurable, Closeable { // Initialize the provider void start(ConfigContext ctx); // Transform the configs by resolving all indirect references Map<String, String> transform(ConfigContext ctx, Map<String, String> configs); } public interface ConfigContext { // Get the initialization parameters Map<String, String> parameters(); // The name of the connector String connectorName(); // Schedule a reload, possibly for secrets rotation void scheduleConfigReload(long delayMs); } |
Two existing interfaces will be modified. This will allow for Tasks to get the latest versions of their configs with all indirect references reloaded (requires the planned upgrade of Kafka to Java 8).
public interface SinkTaskContext { ... default Map<String, String> config() { ... } ... } public interface SourceTaskContext { ... default Map<String, String> config() { ... } ... } |
Currently the configuration for both Connectors and Tasks is stored in a Kafka topic. The goal is for these stored configurations to only contain indirect references to secrets. When a Connector or Task is started, the configuration will be read from Kafka and then passed to the specific Connector or Task. Before the configuration is passed to the Connector or Task, the indirect references need to be resolved.
The following are required in a design:
Example:
# Properties specified in the Worker config config.providers=vault # can have multiple comma-separated values config.provider.vault.class=VaultConfigProvider config.provider.vault.param.uri=1.2.3.4 config.provider.vault.param.token=/run/secrets/vault-token # Properties specified in the Connector config mysql.db.password=${vault:vault_db_password_key} |
In the above example, VaultConfigProvider will be passed the string "/run/secrets/vault-token" on initialization, which could be the filename for a Docker secret containing the initial Vault token, residing on the tmpfs mount, for instance. When resolving the value for "mysql.db.password", the VaultConfigProvider will use the key "vault_db_password_key". The VaultConfigProvider would use this key to look up the corresponding secret.
Secret Management systems such as Vault support secret rotation by associating a "lease duration" with a secret, which can be read by the client.
In general, secret rotation is orthogonal to a particular Connector. For example, a JDBC password may be stored in a Docker secret or in Vault. The JDBC connector does not need to know what the method of rotation is. Also, it is best if the JDBC connector is informed when it should re-obtain secrets rather than wait until a security exception occurs. So in this case, a push model is warranted.
Other connectors such as the S3 connector are tightly coupled with a particular secret manager, and may wish to handle rotation on their own.
To handle the different scenarios, the design offers support both a push model and a pull model for obtaining new secrets.
Different Connect components may have different responsibilities in handling secret rotation:
ConfigProvider
may have knowledge of the method of rotation. For Vault, it would be a "lease duration". For a file-based provider, it could be file watches. If it knows when a secret is going to be reloaded, it would call scheduleConfigReload()
to inform the Herder.scheduleConfigReload()
call, it will check a new connector configuration property config.reload.action
which can be one of the following:restart
, which means to schedule a restart of the Connector and all its Tasks. This will be the default.none
, which means to do nothing.config.reload.action
to none
. The methods SinkTaskContext.config()
and SourceTaskContext.config()
would be used by the Task to reload the config and resolve indirect references again.No changes are required for existing Connectors. Connectors that use a ConfigProvider and do not want the restart behavior can specify config.reload.action
as none
.
The current scope of this proposal is for Connectors only. It does not address brokers nor clients. The injection will happen at a very specific time in the lifecycle of Kafka Connect, i.e. after the configuration is stored and before the Connectors and Tasks are started.
A related feature for brokers is KIP-226, which allows for dynamic broker configuration. It can also store passwords. However,
A related feature for clients is KIP-76, which is for obtaining passwords through scripts. However,