set transport to skip verify if se skip flag passed (#4102) (#4106)

pull/4229/head
Brian Downs 2021-10-07 12:47:50 -07:00 committed by GitHub
parent 9c7e871942
commit 1eeffbb330
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -36,12 +36,18 @@ type S3 struct {
// a new Minio client. // a new Minio client.
func NewS3(ctx context.Context, config *config.Control) (*S3, error) { func NewS3(ctx context.Context, config *config.Control) (*S3, error) {
tr := http.DefaultTransport tr := http.DefaultTransport
if config.EtcdS3EndpointCA != "" {
switch {
case config.EtcdS3EndpointCA != "":
trCA, err := setTransportCA(tr, config.EtcdS3EndpointCA, config.EtcdS3SkipSSLVerify) trCA, err := setTransportCA(tr, config.EtcdS3EndpointCA, config.EtcdS3SkipSSLVerify)
if err != nil { if err != nil {
return nil, err return nil, err
} }
tr = trCA tr = trCA
case config.EtcdS3 && config.EtcdS3SkipSSLVerify:
tr.(*http.Transport).TLSClientConfig = &tls.Config{
InsecureSkipVerify: config.EtcdS3SkipSSLVerify,
}
} }
var creds *credentials.Credentials var creds *credentials.Credentials