Current state: Accepted

Discussion thread:

Voting thread:



Currently kafka supports ssl.keymanager.algorithm and ssl.trustmanager.algorithm parameters as part of secure config. These parameters can be configured to load the key manager and trust managers which provide keys and certificates for ssl handshakes with the clients/server. The algorithms configured by these parameters need to be registered by Java security provider classes. These provider classes are configured as JVM properties through file. A sample file given below

$ cat /usr/lib/jvm/jdk-8-oracle-x64/jre/lib/security/

Custom keymanager and trustmanager algorithms can be used to supply the kafka brokers with keys and certificates, these algorithms can be used to replace the traditional, non-scalable static keystore and truststore jks files.

To take advantage of these custom algorithms, we want to support java security provider parameter in security config. For instance, in streaming applications like Flink, Spark or Storm, one can configure 'spiffe.provider.SpiffeProvider' which helps in fetching the keys and certificates via a gRPC endpoint. This param can be used by kafka brokers or kafka clients(when connecting to the kafka brokers). The security providers can also be used for configuring security algorithms in SASL based communication.

Public Interfaces

SecurityProviderCreator interface will be added

* An interface for generating security providers.
public interface SecurityProviderCreator extends Configurable {

* Configure method is used to configure the generator to create the Security Provider
* @param config configuration parameters for initialising security provider
default void configure(Map<String, ?> config) {


* Generate the security provider configured
Provider getProvider();

The following line will be added to the kafka and the configured provider classes will be registered at the time of kafka broker start up 

Proposed Changes

We add new config parameter in KafkaConfig named “security.provider.class.names”. The value of “security.provider.class.names” is expected to be a comma separated string representing the providers' full classname. This provider classes will be added to the JVM through Security.addProvider api. Security class can be used to programmatically add the provider classes to the JVM. The provider classes will be added at the starting position in the list of providers and in the order they are passed. So any algorithm implemented in the earlier classes will replace algorithm implementations with the same name in following providers. For SASL, we add the providers after the login modules are configured so that the algorithms in the providers passed can take precedence over the passed SASL login modules.

for (String provider : givenProvidersListReversed) {
   // Adds at position 0
   Security.addProvider((Provider) Class.forName(provider).newInstance());

Compatibility, Deprecation, and Migration Plan


Rejected Alternatives

There are few other ways of adding a custom provider

  1. Add a new security provider class in the file

A new configuration like the one below can be added to the file

       2. Pass the security policies as system level arguments

# Append or override parts of the default file

Asking all the clients to do this is harder to achieve similar to the alternative 1

Existing Properties

There already exists a property “ssl.provider”, however there is a problem with using this parameter. The expected value of this property is the name of the algorithm and the provider class registering the algorithm needs to be added as part of static file or system level variables as per the SslContext implementation. Therefore, this param can’t be used for registering a security provider.

  • No labels