使用 Zend_Ldap 连接到远程 LDAP 服务器时出现问题

Trouble Connecting to Remote LDAP Server using Zend_Ldap

我们正在尝试使用 Zend_Ldap 通过订户的 LDAP 服务器对访问我们网站的用户进行身份验证。我们有几个客户端已经设置好并可以正常工作,但是当我们添加一个新客户端时,连接刚刚挂起,30 分钟后(!)我们收到以下(没有帮助)错误:

0x51 (Can't contact LDAP server): ldap://x.x.x.x

我唯一知道的其他调试步骤是使用 ldapsearch。如果我只是 ldapsearch -h x.x.x.x 很长时间没有任何反应(我不想等 30 分钟,但我猜我会得到 "Can't connect to LDAP server" 错误)并且如果我 运行 它使用 -d5 我得到以下输出。

ldap_create
ldap_url_parse_ext(ldap://x.x.x.x)
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 x.x.x.x:389
ldap_new_socket: 3
ldap_prepare_socket: 3
ldap_connect_to_host: Trying x.x.x.x:389
ldap_pvt_connect: fd: 3 tm: -1 async: 0
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 0x7f9ad5666410 msgid 1
wait4msg ld 0x7f9ad5666410 msgid 1 (infinite timeout)
wait4msg continue ld 0x7f9ad5666410 msgid 1 all 1
** ld 0x7f9ad5666410 Connections:
* host: x.x.x.x  port: 389  (default)
  refcnt: 2  status: Connected
  last used: Mon Jul 13 09:14:44 2015


** ld 0x7f9ad5666410 Outstanding Requests:
 * msgid 1,  origid 1, status InProgress
   outstanding referrals 0, parent count 0
  ld 0x7f9ad5666410 request count 1 (abandoned 0)
** ld 0x7f9ad5666410 Response Queue:
   Empty
  ld 0x7f9ad5666410 response count 0
ldap_chkResponseList ld 0x7f9ad5666410 msgid 1 all 1
ldap_chkResponseList returns ld 0x7f9ad5666410 NULL
ldap_int_select

<20+ minute delay>

read1msg: ld 0x7f9ad5666410 msgid 1 all 1
ber_get_next
ldap_err2string
ldap_start_tls: Can't contact LDAP server (-1)
ldap_free_request (origid 1, msgid 1)
ldap_free_connection 1 1
ldap_free_connection: actually freed

客户端的 LDAP 服务器是 Windows Server 2008 R2,我们使用 Ubuntu 12.04.4 LTS 和来自 OpenLDAP 2.4.28 的 ldapsearch。

对于接下来要解决的问题有什么建议吗?我的猜测是它在客户网络中的某个地方,但我想在开始询问他们之前尽可能多地检查我的结束。

更新:

我补充说:

ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);

到我的 php 脚本并得到与从 ldapsearch 返回的相同的输出。

总而言之,客户端的防火墙设置为允许连接,但设置了不同的协议,因此深度数据包检测将其关闭。希望如果这一切都发生在其他人身上,这将有所帮助。