mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
rpc: Support SNI in TLS certificates (#3009)
This commit is contained in:
parent
6fc81dc162
commit
c189337b6e
@ -78,7 +78,12 @@ func (rpcClient *RPCClient) dialRPCClient() (*rpc.Client, error) {
|
|||||||
var conn net.Conn
|
var conn net.Conn
|
||||||
|
|
||||||
if rpcClient.secureConn {
|
if rpcClient.secureConn {
|
||||||
conn, err = tls.Dial("tcp", rpcClient.node, &tls.Config{})
|
hostname, _, splitErr := net.SplitHostPort(rpcClient.node)
|
||||||
|
if splitErr != nil {
|
||||||
|
return nil, errors.New("Unable to parse RPC address <" + rpcClient.node + "> : " + splitErr.Error())
|
||||||
|
}
|
||||||
|
// ServerName in tls.Config needs to be specified to support SNI certificates
|
||||||
|
conn, err = tls.Dial("tcp", rpcClient.node, &tls.Config{ServerName: hostname})
|
||||||
} else {
|
} else {
|
||||||
// Have a dial timeout with 3 secs.
|
// Have a dial timeout with 3 secs.
|
||||||
conn, err = net.DialTimeout("tcp", rpcClient.node, 3*time.Second)
|
conn, err = net.DialTimeout("tcp", rpcClient.node, 3*time.Second)
|
||||||
|
Loading…
Reference in New Issue
Block a user