mirror of
https://github.com/minio/minio.git
synced 2025-01-23 12:43:16 -05:00
Add --insecure
flag to skip TLS verification in s3-md5-check tool (#14980)
This commit is contained in:
parent
c0bf02b8b2
commit
62cd643868
@ -38,6 +38,7 @@ var (
|
|||||||
bucket, prefix string
|
bucket, prefix string
|
||||||
debug bool
|
debug bool
|
||||||
versions bool
|
versions bool
|
||||||
|
insecure bool
|
||||||
)
|
)
|
||||||
|
|
||||||
// getMD5Sum returns MD5 sum of given data.
|
// getMD5Sum returns MD5 sum of given data.
|
||||||
@ -55,6 +56,7 @@ func main() {
|
|||||||
flag.StringVar(&prefix, "prefix", "", "Select a prefix")
|
flag.StringVar(&prefix, "prefix", "", "Select a prefix")
|
||||||
flag.BoolVar(&debug, "debug", false, "Prints HTTP network calls to S3 endpoint")
|
flag.BoolVar(&debug, "debug", false, "Prints HTTP network calls to S3 endpoint")
|
||||||
flag.BoolVar(&versions, "versions", false, "Verify all versions")
|
flag.BoolVar(&versions, "versions", false, "Verify all versions")
|
||||||
|
flag.BoolVar(&insecure, "insecure", false, "Disable TLS verification")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if endpoint == "" {
|
if endpoint == "" {
|
||||||
@ -78,12 +80,23 @@ func main() {
|
|||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
secure := strings.EqualFold(u.Scheme, "https")
|
||||||
|
transport, err := minio.DefaultTransport(secure)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalln(err)
|
||||||
|
}
|
||||||
|
if insecure {
|
||||||
|
// skip TLS verification
|
||||||
|
transport.TLSClientConfig.InsecureSkipVerify = true
|
||||||
|
}
|
||||||
|
|
||||||
s3Client, err := minio.New(u.Host, &minio.Options{
|
s3Client, err := minio.New(u.Host, &minio.Options{
|
||||||
Creds: credentials.NewStaticV4(accessKey, secretKey, ""),
|
Creds: credentials.NewStaticV4(accessKey, secretKey, ""),
|
||||||
Secure: strings.EqualFold(u.Scheme, "https"),
|
Secure: secure,
|
||||||
|
Transport: transport,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln()
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if debug {
|
if debug {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user