Skip to content

Commit 06b3688

Browse files
committed
Don't verify TLS certs on support bundle requests
1 parent 1f9e478 commit 06b3688

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

cmd/troubleshoot/cli/run.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cli
22

33
import (
4+
"crypto/tls"
45
"encoding/base64"
56
"encoding/json"
67
"fmt"
@@ -23,6 +24,12 @@ import (
2324
"github.com/replicatedhq/troubleshoot/pkg/collect"
2425
)
2526

27+
var (
28+
insecureHTTPClient = &http.Client{Transport: &http.Transport{
29+
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
30+
}}
31+
)
32+
2633
func runTroubleshoot(v *viper.Viper, arg string) error {
2734
fmt.Print(cursor.Hide())
2835
defer fmt.Print(cursor.Show())
@@ -45,7 +52,7 @@ func runTroubleshoot(v *viper.Viper, arg string) error {
4552
return errors.Wrap(err, "make request")
4653
}
4754
req.Header.Set("User-Agent", "Replicated_Troubleshoot/v1beta1")
48-
resp, err := http.DefaultClient.Do(req)
55+
resp, err := insecureHTTPClient.Do(req)
4956
if err != nil {
5057
return errors.Wrap(err, "execute request")
5158
}
@@ -120,12 +127,15 @@ the %s Admin Console to begin analysis.`
120127
for _, ac := range collector.Spec.AfterCollection {
121128
if ac.UploadResultsTo != nil {
122129
if err := uploadSupportBundle(ac.UploadResultsTo, archivePath); err != nil {
123-
return errors.Wrap(err, "upload support bundle")
130+
c := color.New(color.FgHiRed)
131+
c.Printf("%s\r * Failed to upload support bundle: %v\n", cursor.ClearEntireLine(), err)
132+
} else {
133+
fileUploaded = true
124134
}
125-
fileUploaded = true
126135
} else if ac.Callback != nil {
127136
if err := callbackSupportBundleAPI(ac.Callback, archivePath); err != nil {
128-
return errors.Wrap(err, "execute callback")
137+
c := color.New(color.FgHiRed)
138+
c.Printf("%s\r * Failed to notify API that support bundle has been uploaded: %v\n", cursor.ClearEntireLine(), err)
129139
}
130140
}
131141
}
@@ -299,7 +309,7 @@ func uploadSupportBundle(r *troubleshootv1beta1.ResultRequest, archivePath strin
299309
req.Header.Set("Content-Type", contentType)
300310
}
301311

302-
resp, err := http.DefaultClient.Do(req)
312+
resp, err := insecureHTTPClient.Do(req)
303313
if err != nil {
304314
return errors.Wrap(err, "execute request")
305315
}
@@ -325,7 +335,7 @@ func callbackSupportBundleAPI(r *troubleshootv1beta1.ResultRequest, archivePath
325335
return errors.Wrap(err, "create request")
326336
}
327337

328-
resp, err := http.DefaultClient.Do(req)
338+
resp, err := insecureHTTPClient.Do(req)
329339
if err != nil {
330340
return errors.Wrap(err, "execute request")
331341
}

0 commit comments

Comments
 (0)