mirror of
https://github.com/go-acme/lego.git
synced 2025-01-09 01:18:01 +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
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -51,8 +50,11 @@ func newClient(ctx *cli.Context, acc registration.User, keyType certcrypto.KeyTy
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ctx.Bool(flgTLSSkipVerify) {
|
if ctx.Bool(flgTLSSkipVerify) {
|
||||||
config.HTTPClient.Transport = &http.Transport{
|
defaultTransport, ok := config.HTTPClient.Transport.(*http.Transport)
|
||||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
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