mirror of
https://github.com/restic/restic.git
synced 2025-10-09 15:30:24 +00:00
Add --insecure-tls flag to disable SSL cert verification
Signed-off-by: Sam Lucidi <slucidi@redhat.com>
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user