in plugins/client/kafka/client_config.go [78:105]
func (c *Client) configTLS() (tc *tls.Config, tlsErr error) {
if err := checkTLSFile(c.CaPemPath); err != nil {
return nil, err
}
if err := checkTLSFile(c.ClientKeyPath); err != nil {
return nil, err
}
if err := checkTLSFile(c.ClientPemPath); err != nil {
return nil, err
}
tlsConfig := new(tls.Config)
tlsConfig.Renegotiation = tls.RenegotiateNever
tlsConfig.InsecureSkipVerify = c.InsecureSkipVerify
caPem, err := os.ReadFile(c.CaPemPath)
if err != nil {
return nil, err
}
certPool := x509.NewCertPool()
certPool.AppendCertsFromPEM(caPem)
tlsConfig.RootCAs = certPool
clientPem, err := tls.LoadX509KeyPair(c.ClientPemPath, c.ClientKeyPath)
if err != nil {
return nil, err
}
tlsConfig.Certificates = []tls.Certificate{clientPem}
return tlsConfig, nil
}