Skip to content

Commit

Permalink
Pem cert support to connect to kafka clusters (#511)
Browse files Browse the repository at this point in the history
* Support for pem cert format

Signed-off-by: muralibasani <muralidahr.basani@aiven.io>
  • Loading branch information
muralibasani authored Jan 31, 2023
1 parent 341c5c4 commit 450e276
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,20 @@ public Properties getSslConfig(String clusterIdentification) {
Properties props = new Properties();

try {
if (!Strings.isNullOrEmpty(
env.getProperty(
clusterIdentification.toLowerCase() + ".kafkassl.keystore.certificate.chain"))) {
props.put(
SslConfigs.SSL_KEYSTORE_CERTIFICATE_CHAIN_CONFIG,
env.getProperty(
clusterIdentification.toLowerCase() + ".kafkassl.keystore.certificate.chain"));
}
if (!Strings.isNullOrEmpty(
env.getProperty(clusterIdentification.toLowerCase() + ".kafkassl.keystore.key"))) {
props.put(
SslConfigs.SSL_KEYSTORE_KEY_CONFIG,
env.getProperty(clusterIdentification.toLowerCase() + ".kafkassl.keystore.key"));
}
if (!Strings.isNullOrEmpty(
env.getProperty(clusterIdentification.toLowerCase() + ".kafkassl.keystore.location"))) {
props.put(
Expand Down
3 changes: 2 additions & 1 deletion cluster-api/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@

# Uncomment the below SSL properties to connect to Kafka clusters over SSL.
# Each of the below block can be repeated for a cluster with unique cluster identification id
# JKS/PKCS12/PEM certificate types can be configured

#clusterid.kafkassl.keystore.location=client.keystore.p12
#clusterid.kafkassl.keystore.pwd=klaw1234
#clusterid.kafkassl.key.pwd=klaw1234
#clusterid.kafkassl.keystore.type=pkcs12
#clusterid.kafkassl.truststore.location=client.truststore.jks
#clusterid.kafkassl.truststore.pwd=klaw1234
#clusterid.kafkassl.keystore.type=pkcs12
#clusterid.kafkassl.truststore.type=JKS

# Uncomment the below SASL properties to connect to Kafka clusters over SASL
Expand Down

0 comments on commit 450e276

Please sign in to comment.