Add skip-verify flag for using self-signed certificates

This commit adds a `skip-verify` flag to the replica configuration
so that it can be used with self-signed certificates. This is useful
when running a local instance of MinIO with TLS for testing.
This commit is contained in:
Ben Johnson
2021-03-27 08:00:09 -06:00
parent ef39987cc7
commit f1d2df3e73
2 changed files with 12 additions and 1 deletions

View File

@@ -3,11 +3,13 @@ package s3
import (
"bytes"
"context"
"crypto/tls"
"fmt"
"io"
"io/ioutil"
"log"
"net"
"net/http"
"os"
"path"
"regexp"
@@ -79,6 +81,7 @@ type Replica struct {
Path string
Endpoint string
ForcePathStyle bool
SkipVerify bool
// Time between syncs with the shadow WAL.
SyncInterval time.Duration
@@ -769,6 +772,12 @@ func (r *Replica) config() *aws.Config {
if r.ForcePathStyle {
config.S3ForcePathStyle = aws.Bool(r.ForcePathStyle)
}
if r.SkipVerify {
config.HTTPClient = &http.Client{Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}}
}
return config
}