add unauthenticated lookup-bind mode to LDAP identity (#11655)

Closes #11646
This commit is contained in:
cbows
2021-02-28 21:57:31 +01:00
committed by GitHub
parent c5b3a675fa
commit c67d1bf120
2 changed files with 6 additions and 1 deletions

View File

@@ -180,6 +180,9 @@ func getGroups(conn *ldap.Conn, sreq *ldap.SearchRequest) ([]string, error) {
}
func (l *Config) lookupBind(conn *ldap.Conn) error {
if l.LookupBindPassword == "" {
return conn.UnauthenticatedBind(l.LookupBindDN)
}
return conn.Bind(l.LookupBindDN, l.LookupBindPassword)
}
@@ -422,7 +425,7 @@ func Lookup(kvs config.KVS, rootCAs *x509.CertPool) (l Config, err error) {
// Lookup bind user configuration
lookupBindDN := env.Get(EnvLookupBindDN, kvs.Get(LookupBindDN))
lookupBindPassword := env.Get(EnvLookupBindPassword, kvs.Get(LookupBindPassword))
if lookupBindDN != "" && lookupBindPassword != "" {
if lookupBindDN != "" {
l.LookupBindDN = lookupBindDN
l.LookupBindPassword = lookupBindPassword
l.isUsingLookupBind = true