Table of Contents
Status
Current state: Under Discussion Accepted
Discussion thread: https://www.mail-archive.com/dev@kafka.apache.org/msg99419.html
Voting thread: https://www.mail-archive.com/dev@kafka.apache.org/msg99826.htmlDiscussion thread: KAFKA-8669
JIRA: KAFKA-8669
Motivation
...
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 org.apache.kafka.common.security.auth
/**
* An interface for generating security providers.
*/
@InterfaceStability.Evolving
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();
}
Code Block | ||
---|---|---|
| ||
security.provider.classclasses=com.security.ProviderClass,com.security.ProviderClass2 |
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
Proposed Changes
We add new config parameter in KafkaConfig named “security“security.provider.class.names”. The value of “security.provider.class.provider” names” is expected to be a string comma separated string representing the provider’s providers' full classname. This provider class classes will be added to the JVM properties 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.
Code Block | ||
---|---|---|
| ||
for (String provider : givenProvidersListReversed) { // Adds at position 0 Security.addProvider(configuredProvider)((Provider) Class.forName(provider).newInstance()); } |
Compatibility, Deprecation, and Migration Plan
...
Code Block | ||
---|---|---|
| ||
# Append or override parts of the default java.security file java -Djava.security.policyproperties=/some/path/my-augmented-security.policyproperties |
Asking all the clients to do this is harder to achieve similar to the alternative 1
...
There already exists a property “ssl.providers”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.
...