Current state: Accepted
Discussion thread: https://firstname.lastname@example.org/msg99419.html
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 java.security file. A sample file given below
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.
The following line will be added to the kafka server.properties and the configured provider classes will be registered at the time of kafka broker start up
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.
Compatibility, Deprecation, and Migration Plan
There are few other ways of adding a custom provider
- Add a new security provider class in the java.security file
A new configuration like the one below can be added to the java.security file
2. Pass the security policies as system level arguments
Asking all the clients to do this is harder to achieve similar to the alternative 1
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 java.security file or system level variables as per the SslContext implementation. Therefore, this param can’t be used for registering a security provider.