Gerrit shows LDAP: error code 48 - anonymous bind disallowed

75 Views Asked by At

I try to setup Gerrit with openldap authentication. Here's my config:

[auth]
        type = LDAP
        gitBasicAuthPolicy = HTTP
        userNameCaseInsensitive = true
[ldap]
        server = ldap://ldap_server_ip
        username = cn=admin,dc=company,dc=com
        accountBase = dc=company,dc=com
        groupBase = dc=company,dc=com

ldap password store in secure.config file.

When trying login with my ldap credential, I received the error:

[2023-11-29T18:35:09.376-08:00] [HTTP POST /login/%2F (N/A from [0:0:0:0:0:0:0:1])] ERROR com.google.gerrit.auth.ldap.LdapRealm : Cannot query LDAP to authenticate user
javax.naming.AuthenticationNotSupportedException: [LDAP: error code 48 - anonymous bind disallowed]

The ldap server is working with other client, and that account is permitted to read for sure.
Please guide me to figure out which part of my configuration went wrong. Thank you.

1

There are 1 best solutions below

0
Sora Tseng On

Figured out the correct configuration. Although document says:

ldap.username
(Optional) Username to bind to the LDAP server with. If not set,
an anonymous connection to the LDAP server is attempted.

It seems gerrit will still make an anonymous connection attemp. To completely turn off anonymous connection require following configuration:

ldap.supportAnonymous = false