我正在尝试使用SSL连接到LDAP服务器,但是失败。
ldapsearch -d 1 -Z -D "cn=root,dc=westr" -w ldappwd
但是我总是
ldap_start_tls: Can't contact LDAP server (-1)
我试图关闭证书检查(TLS_REQCERT允许/从不)并使用服务器的证书(TLS_CACERT /path/to/file.cer),但这没有帮助。
然后我检查了服务器上的日志,发现一些令人困惑的地方:
21 TLS:错误:接受-错误-收到非SSL消息[0x30]
22 TLS:不能接受:TLS错误-12261:SSL收到格式错误的Hello Request握手消息。
23 5bd6e432 connection_read(29):TLS接受失败错误= -1 id = 1014,正在关闭
24 5bd6e432 connection_closing:准备关闭conn = 1014 sd = 29
25 5bd6e432 connection_close:conn = 1014 sd = 29
26 5bd6e432守护程序:删除29
27 5bd6e432 conn = 1014 fd = 29已关闭(TLS协商失败)
Apache Directory Studio可以在此服务器上正常使用。有没有人知道如何使ldapsearch与服务器一起工作?
OS:Ubuntu 18.04.1 初始连接成功。正如我已经提到的,建立TLS存在一些问题(服务器使用TLS关闭了连接:无法接受:TLS错误-12261:SSL接收到格式错误的Hello Request握手消息。)。
venom@serv$ ldapsearch -d 1 -Z -D "cn=root,dc=iswga" -w "pass"
ldap_create
ldap_extended_operation_s
ldap_extended_operation
ldap_send_initial_request
ldap_new_connection 1 1 0
ldap_int_open_connection
ldap_connect_to_host: TCP 10.10.0.100:636
ldap_new_socket: 3
ldap_prepare_socket: 3
ldap_connect_to_host: Trying 10.10.0.100:636
ldap_pvt_connect: fd: 3 tm: -1 async: 0
attempting to connect:
connect success
ldap_open_defconn: successful
ldap_send_server_request
ber_scanf fmt ({it) ber:
ber_scanf fmt ({) ber:
ber_flush2: 31 bytes to sd 3
ldap_result ld 0x7fffd1c2ae90 msgid 1
wait4msg ld 0x7fffd1c2ae90 msgid 1 (infinite timeout)
wait4msg continue ld 0x7fffd1c2ae90 msgid 1 all 1
** ld 0x7fffd1c2ae90 Connections:
* host: 10.10.0.100 port: 636 (default)
refcnt: 2 status: Connected
last used: Thu Nov 1 14:03:52 2018
** ld 0x7fffd1c2ae90 Outstanding Requests:
* msgid 1, origid 1, status InProgress
outstanding referrals 0, parent count 0
ld 0x7fffd1c2ae90 request count 1 (abandoned 0)
** ld 0x7fffd1c2ae90 Response Queue:
Empty
ld 0x7fffd1c2ae90 response count 0
ldap_chkResponseList ld 0x7fffd1c2ae90 msgid 1 all 1
ldap_chkResponseList returns ld 0x7fffd1c2ae90 NULL
ldap_int_select
read1msg: ld 0x7fffd1c2ae90 msgid 1 all 1
ber_get_next
ldap_err2string
ldap_start_tls: Can't contact LDAP server (-1)
ldap_sasl_bind
ldap_send_initial_request
ldap_send_server_request
ldap_err2string
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
ldap_free_request (origid 1, msgid 1)
ldap_free_connection 1 1
ldap_free_connection: actually freed