我已成功运行 openldap 和 phpldapadmin 容器,并能够通过此命令使用它
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
我可以登录系统并做一些事情。但我无法将 LDAP 服务器与其他软件一起使用,例如阿帕奇目录工作室。它能够创建连接,但始终返回无效凭据,如下所示:
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]
我输入的凭据与 phpldapadmin 中使用的凭据完全相同。怎么结果不一样
我尝试在 Apache Directory Studio 中使用 ldaps,但现在它给了我其他错误,如下所示:
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.
我还尝试使用nodejs模块ldapjs与此代码
// 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;
}
但结果是一样的
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
}