浏览代码

Add ServerName to tls.Config in LDAP auth (#3104)

From https://godoc.org/crypto/tls#Config

    ServerName is used to verify the hostname on the returned
    certificates unless InsecureSkipVerify is given. It is also included
    in the client's handshake to support virtual hosting unless it is
    an IP address.

This is needed for certificate validation without InsecureSkipVerify.
Paul Tötterman 8 年之前
父节点
当前提交
fb970b9d87
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      modules/auth/ldap/ldap.go

+ 1 - 0
modules/auth/ldap/ldap.go

@@ -213,6 +213,7 @@ func ldapDial(ls *Source) (*ldap.Conn, error) {
 	if ls.UseSSL {
 		log.Debug("Using TLS for LDAP without verifying: %v", ls.SkipVerify)
 		return ldap.DialTLS("tcp", fmt.Sprintf("%s:%d", ls.Host, ls.Port), &tls.Config{
+			ServerName:         ls.Host,
 			InsecureSkipVerify: ls.SkipVerify,
 		})
 	} else {