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
38 bucket, prefix string38 bucket, prefix string
39 debug bool39 debug bool
40 versions bool40 versions bool
41 insecure bool
41)42)
42 43
43// getMD5Sum returns MD5 sum of given data.44// getMD5Sum returns MD5 sum of given data.
@@ -55,6 +56,7 @@ func main() { · 11 unmodified lines
55 flag.StringVar(&prefix, "prefix", "", "Select a prefix")56 flag.StringVar(&prefix, "prefix", "", "Select a prefix")
56 flag.BoolVar(&debug, "debug", false, "Prints HTTP network calls to S3 endpoint")57 flag.BoolVar(&debug, "debug", false, "Prints HTTP network calls to S3 endpoint")
57 flag.BoolVar(&versions, "versions", false, "Verify all versions")58 flag.BoolVar(&versions, "versions", false, "Verify all versions")
59 flag.BoolVar(&insecure, "insecure", false, "Disable TLS verification")
58 flag.Parse()60 flag.Parse()
59 61
60 if endpoint == "" {62 if endpoint == "" {
@@ -78,12 +80,23 @@ func main() { · 17 unmodified lines
78 log.Fatalln(err)80 log.Fatalln(err)
79 }81 }
80 82
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
81 s3Client, err := minio.New(u.Host, &minio.Options{93 s3Client, err := minio.New(u.Host, &minio.Options{
82 Creds: credentials.NewStaticV4(accessKey, secretKey, ""),94 Creds: credentials.NewStaticV4(accessKey, secretKey, ""),
83 Secure: strings.EqualFold(u.Scheme, "https"),95 Secure: secure,
96 Transport: transport,
84 })97 })
85 if err != nil {98 if err != nil {
86 log.Fatalln()99 log.Fatalln(err)
87 }100 }
88 101
89 if debug {102 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