History

Add `--insecure` flag to skip TLS verification in s3-md5-check tool (#14980)

Praveen raj Mani committed 4 years ago

Commit 62cd6431 parent c0bf02b1 file · +16 −3Browse files

Showing the changes to docs/debugging (1 of 1 file). Show all

Unified · Split

docs/debugging/s3-check-md5/main.go+16−3
@@ -38,6 +38,7 @@ var ( · 37 unmodified lines
3838 bucket, prefix string
3939 debug bool
4040 versions bool
41+ insecure bool
4142 )
4243
4344 // getMD5Sum returns MD5 sum of given data.
@@ -55,6 +56,7 @@ func main() { · 11 unmodified lines
5556 flag.StringVar(&prefix, "prefix", "", "Select a prefix")
5657 flag.BoolVar(&debug, "debug", false, "Prints HTTP network calls to S3 endpoint")
5758 flag.BoolVar(&versions, "versions", false, "Verify all versions")
59+ flag.BoolVar(&insecure, "insecure", false, "Disable TLS verification")
5860 flag.Parse()
5961
6062 if endpoint == "" {
@@ -78,12 +80,23 @@ func main() { · 17 unmodified lines
7880 log.Fatalln(err)
7981 }
8082
83+ secure := strings.EqualFold(u.Scheme, "https")
84+ transport, err := minio.DefaultTransport(secure)
85+ if err != nil {
86+ log.Fatalln(err)
87+ }
88+ if insecure {
89+ // skip TLS verification
90+ transport.TLSClientConfig.InsecureSkipVerify = true
91+ }
92+
8193 s3Client, err := minio.New(u.Host, &minio.Options{
82− Creds: credentials.NewStaticV4(accessKey, secretKey, ""),
83− Secure: strings.EqualFold(u.Scheme, "https"),
94+ Creds: credentials.NewStaticV4(accessKey, secretKey, ""),
95+ Secure: secure,
96+ Transport: transport,
8497 })
8598 if err != nil {
86− log.Fatalln()
99+ log.Fatalln(err)
87100 }
88101
89102 if debug {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t