1
0
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:
Ludovic Fernandez 2024-12-01 16:29:02 +01:00 committed by GitHub
parent c2f179f144
commit 19a02023b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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
}
}