mirror of
https://github.com/minio/minio.git
synced 2025-09-22 22:21:13 +02:00
fix: LDAP TLS handshake fails with StartTLS and tls_skip_verify=off (#21582)
Some checks failed
VulnCheck / Analysis (push) Has been cancelled
Some checks failed
VulnCheck / Analysis (push) Has been cancelled
Fixes #21581
This commit is contained in:
parent
ae71d76901
commit
7a80ec1cce
@ -21,6 +21,7 @@ import (
|
|||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"errors"
|
"errors"
|
||||||
|
"net"
|
||||||
"sort"
|
"sort"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -190,10 +191,18 @@ func Lookup(s config.Config, rootCAs *x509.CertPool) (l Config, err error) {
|
|||||||
if ldapServer == "" {
|
if ldapServer == "" {
|
||||||
return l, nil
|
return l, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set ServerName in TLS config for proper certificate validation
|
||||||
|
host, _, err := net.SplitHostPort(ldapServer)
|
||||||
|
if err != nil {
|
||||||
|
host = ldapServer
|
||||||
|
}
|
||||||
|
|
||||||
l.LDAP = ldap.Config{
|
l.LDAP = ldap.Config{
|
||||||
ServerAddr: ldapServer,
|
ServerAddr: ldapServer,
|
||||||
SRVRecordName: getCfgVal(SRVRecordName),
|
SRVRecordName: getCfgVal(SRVRecordName),
|
||||||
TLS: &tls.Config{
|
TLS: &tls.Config{
|
||||||
|
ServerName: host,
|
||||||
MinVersion: tls.VersionTLS12,
|
MinVersion: tls.VersionTLS12,
|
||||||
NextProtos: []string{"h2", "http/1.1"},
|
NextProtos: []string{"h2", "http/1.1"},
|
||||||
ClientSessionCache: tls.NewLRUClientSessionCache(100),
|
ClientSessionCache: tls.NewLRUClientSessionCache(100),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user