in image/resources/netapp-exports/transport.go [35:61]
func (config *TLSConfig) transport() (http.RoundTripper, error) {
transport := http.DefaultTransport.(*http.Transport).Clone()
tls := transport.TLSClientConfig
if config.CACertificate != "" {
ca := x509.NewCertPool()
ok := ca.AppendCertsFromPEM([]byte(config.CACertificate))
if !ok {
return nil, errors.New("ca_certificate did not contain any PEM encoded certificates")
}
tls.RootCAs = ca
}
if config.insecure {
tls.InsecureSkipVerify = true
} else {
transport.RegisterProtocol("http", denyHTTPTransport{})
if config.AllowCommonName {
// Replace the standard validation with our custom validation
tls.InsecureSkipVerify = true
tls.VerifyConnection = verifyWithCommonName(tls)
}
}
return transport, nil
}