Trying to setup vault with ldap (Active Directory) and getting the “ldap operation failed: unable to retrieve user bind DN” error after trying
vault login -method=ldap username=user1
After searching here and Googling I’ve checked all my config and then performed these ldapsearch queries:
ldapsearch -x -H ldap://dc01.abc.local -D “user1@abc.local” -W -b “cn=Users,dc=abc,dc=local”
ldapsearch -x -LLL -E pr=200/noprompt -h dc01.abc.local -D “ldaps.account@abc.local” -W -b “dc=abc,dc=local” “(sAMAccountName=user1)” dn memberOf sAMAccountName dn: CN=user1,OU=Groups,OU=Users,DC=abc,DC=local memberOf: CN=Linux,OU=Groups,DC=abc,DC=local sAMAccountName: user1
Both work fine and return results from ad/ldap.
I’ve turned on trace logging and also see this in the logs after trying to login:
[DEBUG] auth.ldap.auth_ldap_5ecfdbb7: error getting user bind DN: error="LDAP bind (service) failed: LDAP Result Code 49 “Invalid Credentials”: 80090308: LdapErr: DSID-0C090453, comment: AcceptSecurityContext error, data 52e, v3839
Have double checked the credentials of the binddn account I’m using and tried a different account together with various client accounts and same result. I’ve even tried creating a new server from scratch as a test and get the exact same error. We use many other services to bind against AD such as Confluence, Duo and a few others all with no issues.
Here is the ldap config file:
vault write auth/ldap/config \ url="ldaps://dc01.abc.local" \ userattr="sAMAccountName" \ userdn="OU=Users,DC=abc,DC=local" \ discoverdn=true \ groupdn="CN=Linux,OU=Groups,DC=abc,DC=local" \ groupfilter="(&(objectClass=group)(member:1.2.840.113556.1.4.1941:={{.UserDN}}))" \ binddn="cn=ldaps.account,cn=Service Accounts,dc=abc,dc=local" \ bindpass='*************' \ groupattr="memberOf" \ certificate=@ldapcert.pem \ insecure_tls=false \ starttls=true
There must be something I’m missing, any assistance would be appreciated.
Environment:
- Ubuntu Server 20.04
- Vault Server Version 1.5.0
- Vault CLI Version v1.5.0