I have successfully run openldap and phpldapadmin container and able to use it with this command
docker run -p 389:389 -p 636:636 --name ldap-service --hostname ldap-service --env LDAP_DOMAIN=mydomain --env LDAP_CONFIG_PASSWORD=admin --detach osixia/openldap:1.1.8
docker run -d -p 443:443 -p 80:80 --name phpldapadmin-service --hostname phpldapadmin-service --link ldap-service:ldap-host --env PHPLDAPADMIN_LDAP_HOSTS=ldap-host --detach osixia/phpldapadmin:0.9.0
I can log in to the system and do stuff. But i cannot use the LDAP server with other software, e.g. Apache Directory Studio. It was able to create connection but always return invalid credentials as follow:
The authentication failed
- [LDAP result code 49 - invalidCredentials]
org.apache.directory.studio.connection.core.io.StudioLdapException: [LDAP result code 49 - invalidCredentials]
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.toStudioLdapException(DirectoryApiConnectionWrapper.java:1350)
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.access$2(DirectoryApiConnectionWrapper.java:1342)
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper$2.run(DirectoryApiConnectionWrapper.java:483)
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.runAndMonitor(DirectoryApiConnectionWrapper.java:1261)
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.doBind(DirectoryApiConnectionWrapper.java:488)
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.bind(DirectoryApiConnectionWrapper.java:323)
at org.apache.directory.studio.connection.core.jobs.CheckBindRunnable.run(CheckBindRunnable.java:79)
at org.apache.directory.studio.connection.ui.RunnableContextRunner$1.run(RunnableContextRunner.java:140)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
Caused by: org.apache.directory.api.ldap.model.exception.LdapAuthenticationException:
at org.apache.directory.api.ldap.model.message.ResultCodeEnum.processResponse(ResultCodeEnum.java:1995)
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.checkResponse(DirectoryApiConnectionWrapper.java:1337)
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.access$6(DirectoryApiConnectionWrapper.java:1333)
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper$2.run(DirectoryApiConnectionWrapper.java:479)
... 6 more
[LDAP result code 49 - invalidCredentials]
I enter exactly the same credentials used in phpldapadmin. how come the result is different
I have tried using the ldaps in Apache Directory Studio, but now it gives me other error as follows:
The authentication failed
- ERR_04169_RESPONSE_QUEUE_EMPTIED The response queue has been emptied, no response was found.
org.apache.directory.studio.connection.core.io.StudioLdapException: ERR_04169_RESPONSE_QUEUE_EMPTIED The response queue has been emptied, no response was found.
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.toStudioLdapException(DirectoryApiConnectionWrapper.java:1350)
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.access$2(DirectoryApiConnectionWrapper.java:1342)
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper$2.run(DirectoryApiConnectionWrapper.java:483)
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.runAndMonitor(DirectoryApiConnectionWrapper.java:1261)
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.doBind(DirectoryApiConnectionWrapper.java:488)
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.bind(DirectoryApiConnectionWrapper.java:323)
at org.apache.directory.studio.connection.core.jobs.CheckBindRunnable.run(CheckBindRunnable.java:79)
at org.apache.directory.studio.connection.ui.RunnableContextRunner$1.run(RunnableContextRunner.java:140)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
Caused by: org.apache.directory.api.ldap.model.exception.LdapException: ERR_04169_RESPONSE_QUEUE_EMPTIED The response queue has been emptied, no response was found.
at org.apache.directory.ldap.client.api.LdapNetworkConnection.bind(LdapNetworkConnection.java:1578)
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.bindSimple(DirectoryApiConnectionWrapper.java:339)
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.access$5(DirectoryApiConnectionWrapper.java:333)
at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper$2.run(DirectoryApiConnectionWrapper.java:395)
... 6 more
Caused by: org.apache.directory.api.ldap.model.exception.LdapException: ERR_04170_TIMEOUT_OCCURED TimeOut occurred
at org.apache.directory.ldap.client.api.LdapNetworkConnection.bind(LdapNetworkConnection.java:1549)
... 9 more
ERR_04169_RESPONSE_QUEUE_EMPTIED The response queue has been emptied, no response was found.
I also tried using nodejs module ldapjs with this code
// Import required modules
const ldap = require('ldapjs');
const dotenv = require('dotenv');
// Load environment variables from .env file
dotenv.config();
// LDAP server connection details
const ldapUrl = process.env.LDAP_URL;
const bindDN = process.env.LDAP_BIND_DN;
const bindPassword = process.env.LDAP_BIND_PASSWORD;
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
client.bind(bindDN, bindPassword, (err) => {
if (err) {
console.error('LDAP bind error:', err);
return;
}
but the result is the same
LDAP bind error: LDAPError [InvalidCredentialsError]: Invalid Credentials
at messageCallback (C:\Users\rafli\Documents\projects\ldaptest\node_modules\ldapjs\lib\client\client.js:1267:45)
at Parser.onMessage (C:\Users\rafli\Documents\projects\ldaptest\node_modules\ldapjs\lib\client\client.js:925:14)
at Parser.emit (node:events:527:28)
at Parser.write (C:\Users\rafli\Documents\projects\ldaptest\node_modules\ldapjs\lib\messages\parser.js:135:8)
at TLSSocket.onData (C:\Users\rafli\Documents\projects\ldaptest\node_modules\ldapjs\lib\client\client.js:875:22)
at TLSSocket.emit (node:events:527:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at TLSSocket.Readable.push (node:internal/streams/readable:228:10)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
lde_message: 'Invalid Credentials',
lde_dn: null
}