Add --insecure-tls flag to disable SSL cert verification

Signed-off-by: Sam Lucidi <slucidi@redhat.com>
This commit is contained in:
Sam Lucidi committed 2021-09-21 10:52:40 -04:00
1 parent 1827b16ade
commit 897d8e662c
4 files changed
+21

No files matched your search

+7
View File
@@ -22,6 +22,9 @@ type TransportOptions struct {
// contains the name of a file containing the TLS client certificate and private key in PEM format
TLSClientCertKeyFilename string
// Skip TLS certificate verification
InsecureTLS bool
}
// readPEMCertKey reads a file and returns the PEM encoded certificate and key
@@ -79,6 +82,10 @@ func Transport(opts TransportOptions) (http.RoundTripper, error) {
TLSClientConfig: &tls.Config{},
}
if opts.InsecureTLS {
tr.TLSClientConfig.InsecureSkipVerify = true
}
if opts.TLSClientCertKeyFilename != "" {
certs, key, err := readPEMCertKey(opts.TLSClientCertKeyFilename)
if err != nil {