Skip to content

Commit 9fdf2e7

Browse files
Add ca.location support to SASL_SCRAM auth (#123)
1 parent 0df99d5 commit 9fdf2e7

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ To connect to Kafka over SASL/SCRAM authentication define the following addition
6363
- `KAFKA_SASL_MECHANISM`: SASL mechanism to use for authentication, defaults to `""`
6464
- `KAFKA_SASL_USERNAME`: SASL username for use with the PLAIN and SASL-SCRAM-.. mechanisms, defaults to `""`
6565
- `KAFKA_SASL_PASSWORD`: SASL password for use with the PLAIN and SASL-SCRAM-.. mechanism, defaults to `""`
66+
- `KAFKA_SSL_CA_CERT_FILE`: Kafka SSL broker CA certificate file, defaults to `""`
6667

6768
When deployed in a Kubernetes cluster using Helm and using a Kafka external to the cluster, it might be necessary to define the kafka hostname resolution locally (this fills the /etc/hosts of the container). Use a custom values.yaml file with section `hostAliases` (as mentioned in default values.yaml).
6869

main.go

+4
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ func main() {
6060
kafkaConfig["sasl.mechanism"] = kafkaSaslMechanism
6161
kafkaConfig["sasl.username"] = kafkaSaslUsername
6262
kafkaConfig["sasl.password"] = kafkaSaslPassword
63+
64+
if kafkaSslCACertFile != "" {
65+
kafkaConfig["ssl.ca.location"] = kafkaSslCACertFile
66+
}
6367
}
6468

6569
producer, err := kafka.NewProducer(&kafkaConfig)

0 commit comments

Comments
 (0)