mirror of
https://github.com/restic/restic.git
synced 2026-11-22 05:14:23 +00:00
Add --insecure-tls flag to disable SSL cert verification
Signed-off-by: Sam Lucidi <slucidi@redhat.com>
This commit is contained in:
1 parent
1827b16ade
commit
897d8e662c
4 files changed
+21
No files matched your search
@@ -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