# Percona mongodb external authentication with VLDAP

**URL:** https://forums.percona.com/t/percona-mongodb-external-authentication-with-vldap/10951
**Category:** Percona Server for MongoDB
**Tags:** percona, mongodb, ldap
**Created:** [June 21, 2021, 7:01am UTC](https://forums.percona.com/t/percona-mongodb-external-authentication-with-vldap/10951 "2021-06-21T07:01:48Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![khasimsoudagar](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/khasimsoudagar/32/3802_2.png) [@khasimsoudagar](https://forums.percona.com/u/khasimsoudagar)
#### Post date: [June 21, 2021, 7:01am UTC](https://forums.percona.com/t/percona-mongodb-external-authentication-with-vldap/10951/1 "2021-06-21T07:01:48Z")

</div>

Hi, we are using ldap authentication with percona mongodb. We have installed saslauth daemon to authenticate with onelogin vldap. Sanity test is working fine and from mongodb server we are able to communicate with vldap using ldapsearch command. But when trying from mongodb shell using $external auth db, it is not able to authenticate. Can anyone please help me on this.

## This is the mongo shell command output

> db.getSiblingDB(“$external”).auth({ mechanism:“PLAIN”, [user:"mongo.db@example.com](mailto:user:%22mongo.db@example.com)", pwd:“XXXXXXXX”, digestPassword:false})  
> Error: Authentication failed.  
> 0

## This is the error log which we are seeing.

{“t”:{“$date”:“2021-06-17T21:34:12.546+05:30”},“s”:“I”, “c”:“ACCESS”, “id”:20249, “ctx”:“conn10”,“msg”:“Authentication failed”,“attr”:{“[mechanism":“PLAIN”,“speculative”:false,“principalName”:"mongo.db@example.com](mailto:mechanism%22:%22PLAIN%22,%22speculative%22:false,%22principalName%22:%22mongo.db@example.com)”,“authenticationDatabase”:“$external”,“remote”:“127.0.0.1:45234”,“extraInfo”:{},“error”:“OperationFailed: SASL step did not complete: (authentication failure)”}}

---

<div class="post-metadata">

### Author: ![khasimsoudagar](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/khasimsoudagar/32/3802_2.png) [@khasimsoudagar](https://forums.percona.com/u/khasimsoudagar)
#### Post date: [June 21, 2021, 7:46am UTC](https://forums.percona.com/t/percona-mongodb-external-authentication-with-vldap/10951/2 "2021-06-21T07:46:49Z")

</div>

## Configurations

##under mongodb configuration  
cat /etc/mongod.conf  
setParameter:  
authenticationMechanisms: PLAIN  
saslauthdPath: /var/run/saslauthd/mux

##saslauthdb configuration  
cat /etc/saslauthd.conf  
ldap\_servers: ldaps://example.ldap.com:636  
ldap\_mech: PLAIN  
ldap\_search\_base: dc=domain1,dc=domain2,dc=com  
ldap\_filter: (cn=%u)  
ldap\_bind\_dn: [cn=mongo.db@example.com](mailto:cn=mongo.db@example.com),ou=users,dc=domain1,dc=domain2,dc=com  
ldap\_password: XXXXXXXX

##under saslauthd lib configuration  
cat /etc/sasl2/mongodb.conf  
pwcheck\_method: saslauthd  
saslauthd\_path: /var/run/saslauthd/mux  
log\_level: 5  
mech\_list: plain

###Sanity test  
sudo testsaslauthd -u [mongo.db@example.com](mailto:mongo.db@example.com) -p XXXXXXX -f /var/run/saslauthd/mux  
0: OK “Success.”

---

<div class="post-metadata">

### Author: ![khasimsoudagar](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/khasimsoudagar/32/3802_2.png) [@khasimsoudagar](https://forums.percona.com/u/khasimsoudagar)
#### Post date: [June 21, 2021, 10:25pm UTC](https://forums.percona.com/t/percona-mongodb-external-authentication-with-vldap/10951/3 "2021-06-21T22:25:14Z")

</div>

**This is the error log in mongodb.log**

{“t”:{“$date”:“2021-06-22T03:50:01.532+05:30”},“s”:“I”, “c”:“ACCESS”, “id”:20249, “ctx”:“conn11”,“msg”:“Authentication failed”,“attr”:{“mechanism”:“PLAIN”,“speculative”:false,“principalName”:“mongotest\_userm”,“authenticationDatabase”:“$external”,“remote”:“127.0.0.1:35230”,“extraInfo”:{},“error”:“OperationFailed: SASL step did not complete: (authentication failure)”}}

**And this the erro log got for saslauthd daemon**

user ldap\_search\_st() failed: Timed out  
Retrying authentication  
Entry not found ((cn=mongotest\_userm)).  
Authentication failed for mongotest\_userm: User not found (-6)  
auth failure: [user=mongotest\_userm] [service=mongodb] [realm=] [mech=ldap] [reason=Unknown]

Can any one from percona team or any other please help me on this.

---

<div class="post-metadata">

### Author: ![radoslaw.szulgo](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/radoslaw.szulgo/32/17315_2.png) [@radoslaw.szulgo](https://forums.percona.com/u/radoslaw.szulgo)
#### Post date: [July 16, 2024, 11:09am UTC](https://forums.percona.com/t/percona-mongodb-external-authentication-with-vldap/10951/4 "2024-07-16T11:09:38Z")

</div>

Hi @khasimsoudagar is that still the issue with the latest Percona Server for MongoDB?
