我有一个PHP脚本,可以进行LDAP连接,绑定和搜索。它与大多数Active Directory服务器一起工作得非常好,但是我们的一个客户端存在问题。脚本返回
Strong(er) authentication required.
尝试ldap_bind时出现错误。
我所做的所有搜索都指向了两个可能的问题:
LDAP_OPT_PROTOCOL_VERSION
设置为3
- 我之前做过和做过,所以这不是我的问题。这个错误可能会导致什么其他原因?
Active Directory服务器上需要SSL ...
答案 0 :(得分:6)
如果Active Directory服务器需要,则必须使用ldaps://
。如果它是无效证书颁发机构的问题,您可以通过发出
putenv('LDAPTLS_REQCERT=never');
在你的PHP代码中。在* nix中,您需要修改/etc/ldap.conf
以包含
TLS_REQCERT never
对于其他常见问题,您可以参考PHP cannot connect to LDAP Oracle Directory Server Enterprise Edition
上的帖子对于工作示例代码,您可以查看:Problems with secure bind to Active Directory using PHP
答案 1 :(得分:1)
我遇到了同样的问题,似乎我的bind_rdn
中存在拼写错误,因此请确保凭据正确无误。
答案 2 :(得分:0)
消息"强(呃)认证要求"如果您尝试使用以下命令更新LDAP实体,也会出现:
不使用可选参数调用bind函数:
string $bind_rdn = NULL [, string $bind_password = NULL
此代码不起作用:
$ldap = ldap_connect($ldap_url);
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
$bind = ldap_bind($ldap);
$userdata=array();
$userdata['userattribute'][0]='test';
ldap_modify ($ldap, "cn=myuser,dc=example,dc=com", $userdata);
此代码有效,请注意对bind函数的不同调用:
$ldap = ldap_connect($ldap_url);
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
$bind = ldap_bind($ldap,'cn=admin,dc=example,dc=com','secretpassword');
$userdata=array();
$userdata['userattribute'][0]='test';
ldap_modify ($ldap, "cn=myuser,dc=example,dc=com", $userdata);
答案 3 :(得分:0)
This answer似乎已满,尽管很短。它涵盖了有关如何处理错误的两个选项。