Skip to content

Commit

Permalink
Merge pull request #92 from errm/host-root-cas
Browse files Browse the repository at this point in the history
Set RootCAs to nil in default case.
  • Loading branch information
danielqsj authored Jan 9, 2023
2 parents d520b86 + 3852615 commit 9d9cd65
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kafka_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,12 @@ func NewExporter(opts kafkaOpts, topicFilter string, groupFilter string) (*Expor

config.Net.TLS.Config = &tls.Config{
ServerName: opts.tlsServerName,
RootCAs: x509.NewCertPool(),
InsecureSkipVerify: opts.tlsInsecureSkipTLSVerify,
}

if opts.tlsCAFile != "" {
if ca, err := ioutil.ReadFile(opts.tlsCAFile); err == nil {
config.Net.TLS.Config.RootCAs = x509.NewCertPool()
config.Net.TLS.Config.RootCAs.AppendCertsFromPEM(ca)
} else {
return nil, err
Expand Down

0 comments on commit 9d9cd65

Please sign in to comment.