From 19a02023b4f22680f404add31b9ec5bf9da8935f Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Sun, 1 Dec 2024 16:29:02 +0100 Subject: [PATCH] fix(cli): clone the transport with tls-skip-verify (#2369) --- cmd/setup.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/setup.go b/cmd/setup.go index 4a802ba132..6adc60d416 100644 --- a/cmd/setup.go +++ b/cmd/setup.go @@ -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 } }