fix: for FTP server driver allow implicit trust of TLS (#17541)

fixes #17535
This commit is contained in:
Harshavardhana
2023-06-30 08:04:13 -07:00
committed by GitHub
parent 9d628346eb
commit 7f782983ca
6 changed files with 12 additions and 12 deletions

View File

@@ -322,7 +322,7 @@ func (driver *ftpDriver) getMinIOClient(ctx *ftp.Context) (*minio.Client, error)
return minio.New(driver.endpoint, &minio.Options{
Creds: credentials.NewStaticV4(cred.AccessKey, cred.SecretKey, cred.SessionToken),
Secure: globalIsTLS,
Transport: globalRemoteTargetTransport,
Transport: globalRemoteFTPClientTransport,
})
}
@@ -336,7 +336,7 @@ func (driver *ftpDriver) getMinIOClient(ctx *ftp.Context) (*minio.Client, error)
return minio.New(driver.endpoint, &minio.Options{
Creds: credentials.NewStaticV4(ui.Credentials.AccessKey, ui.Credentials.SecretKey, ""),
Secure: globalIsTLS,
Transport: globalRemoteTargetTransport,
Transport: globalRemoteFTPClientTransport,
})
}

View File

@@ -34,6 +34,8 @@ import (
"golang.org/x/crypto/ssh"
)
var globalRemoteFTPClientTransport = NewRemoteTargetHTTPTransport(true)()
// minioLogger use an instance of this to log in a standard format
type minioLogger struct{}

View File

@@ -256,7 +256,7 @@ func serverHandleCmdArgs(ctx *cli.Context) {
globalProxyTransport = NewCustomHTTPProxyTransport()()
globalProxyEndpoints = GetProxyEndpoints(globalEndpoints)
globalInternodeTransport = NewInternodeHTTPTransport()()
globalRemoteTargetTransport = NewRemoteTargetHTTPTransport()()
globalRemoteTargetTransport = NewRemoteTargetHTTPTransport(false)()
globalForwarder = handlers.NewForwarder(&handlers.Forwarder{
PassHost: true,

View File

@@ -143,7 +143,7 @@ func (f *sftpDriver) getMinIOClient() (*minio.Client, error) {
return minio.New(f.endpoint, &minio.Options{
Creds: credentials.NewStaticV4(cred.AccessKey, cred.SecretKey, cred.SessionToken),
Secure: globalIsTLS,
Transport: globalRemoteTargetTransport,
Transport: globalRemoteFTPClientTransport,
})
}
@@ -157,7 +157,7 @@ func (f *sftpDriver) getMinIOClient() (*minio.Client, error) {
return minio.New(f.endpoint, &minio.Options{
Creds: credentials.NewStaticV4(ui.Credentials.AccessKey, ui.Credentials.SecretKey, ""),
Secure: globalIsTLS,
Transport: globalRemoteTargetTransport,
Transport: globalRemoteFTPClientTransport,
})
}

View File

@@ -664,14 +664,14 @@ func newCustomDialContext() dialContext {
// NewRemoteTargetHTTPTransport returns a new http configuration
// used while communicating with the remote replication targets.
func NewRemoteTargetHTTPTransport() func() *http.Transport {
func NewRemoteTargetHTTPTransport(insecure bool) func() *http.Transport {
return xhttp.ConnSettings{
DialContext: newCustomDialContext(),
DNSCache: globalDNSCache,
RootCAs: globalRootCAs,
TCPOptions: globalTCPOptions,
EnableHTTP2: false,
}.NewRemoteTargetHTTPTransport()
}.NewRemoteTargetHTTPTransport(insecure)
}
// Load the json (typically from disk file).