Centos – ldap_search: Invalid DN syntax (binddn)

centosiredmailldapwindows-server-2012-r2

I am integrating an iRedMail mail server with Active Directory (running on Windows 2012 R2) using this (official) guide, but when I try to perform a search in LDAP, I get an error message:

ldap_bind: Invalid DN syntax (34)
additional info: invalid DN

I used this command:

ldapsearch -x -h win.basecamp.local -D 'vmail' -W -b 'cn=users,dc=basecamp,dc=local'

Best Answer

The value passed to -D option is invalid. Man page has this explanation for -D option:

-D binddn
    Use the Distinguished Name binddn to bind to the LDAP directory.

You apparently used a username (vmail) while you should have used a distinguished name (similar to what you have in -b option) for password authentication.

I suspect (but CANNOT be sure) that distinguished name for your vmail user might be:

'cn=vmail,cn=users,dc=basecamp,dc=local'
Related Topic