mirror of
https://github.com/go-acme/lego.git
synced 2025-01-08 01:13:29 +02:00
fix(cli): clone the transport with tls-skip-verify (#2369)
This commit is contained in:
parent
c2f179f144
commit
19a02023b4
@ -1,7 +1,6 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
@ -51,8 +50,11 @@ func newClient(ctx *cli.Context, acc registration.User, keyType certcrypto.KeyTy
|
||||
}
|
||||
|
||||
if ctx.Bool(flgTLSSkipVerify) {
|
||||
config.HTTPClient.Transport = &http.Transport{
|
||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
||||
defaultTransport, ok := config.HTTPClient.Transport.(*http.Transport)
|
||||
if ok { // This is always true because the default client used by the CLI defined the transport.
|
||||
tr := defaultTransport.Clone()
|
||||
tr.TLSClientConfig.InsecureSkipVerify = true
|
||||
config.HTTPClient.Transport = tr
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user