Skip to content

Commit

Permalink
fix(kafka source, kafka sink, auth): fixed kafka tls config (#19117)
Browse files Browse the repository at this point in the history
* fixed kafka tls authentication for tls.verify_certificate=false
* fixed kafka tls authentication for tls.verify_hostname=false
  • Loading branch information
zjj authored Nov 17, 2023
1 parent b595fb4 commit d4189e0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/kafka.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,20 @@ impl KafkaAuthConfig {
if tls_enabled {
let tls = self.tls.as_ref().unwrap();

if let Some(verify_certificate) = &tls.options.verify_certificate {
client.set(
"enable.ssl.certificate.verification",
&verify_certificate.to_string(),
);
}

if let Some(verify_hostname) = &tls.options.verify_hostname {
client.set(
"ssl.endpoint.identification.algorithm",
if *verify_hostname { "https" } else { "none" },
);
}

if let Some(path) = &tls.options.ca_file {
let text = pathbuf_to_string(path)?;
if text.contains(PEM_START_MARKER) {
Expand Down

0 comments on commit d4189e0

Please sign in to comment.