LDAP Plugin Help
-
i am trying to get the LDAP plugin to work however I get the following error when using the LDAP Plugin with BBPress,
Warning: ldap_bind(): Unable to bind to server: No such object in /srv/www/htdocs/forum/my-plugins/ldap-authentication.php on line 322
any ideas on howto fix?
-
I’d need more info to help out. But assuming:
- The host/ip and optionally the port specified is correct.
- The domain string is correct.
- You are logging in using the uid of the user, not their full name. Usually “johndoe” instead of “John Doe”.
- Your password is correct
Try these steps:
- Turn off TLS encryption if it is on. Some webservers don’t handle requesting TLS connections.
- Check the LDAP server firewall to see if it is letting you in.
- Make sure you have set any necessary options.
Can you connect to your LDAP server using any other tools, web sites on the same server as bbPress?
Hi
thanks for the quick reply.
Yes the IP, userid, pass is correct.
The domain string is where i may be having trouble as i am not sure wat to put in there. I have tried multiple domain strings but no success.
Have tried both TLS on/off.
I am fairly certain that the firewall is set ok.
We have other applications using the ldap server successfully, however from different servers.
I have successfully used the following code example to produce a connection and return a result from the LDAP server. maybe this can help you debug the issue?
<?php
// basic sequence with LDAP is connect, bind, search, interpret search
// result, close connection
echo "<h3>LDAP query test 2</h3>";
echo "Connecting ...";
$ds=ldap_connect("192.168.1.73"); // must be a valid LDAP server!
echo "connect result is " . $ds . "";
if ($ds) {
echo "Binding ...";
$r=ldap_bind($ds); // this is an "anonymous" bind, typically
// read-only access
echo "Bind result is " . $r . "";
echo "Searching for (sn=S*) ...";
// Search surname entry
$sr=ldap_search($ds, "o=Lions", "sn=S*");
echo "Search result is " . $sr . "";
echo "Number of entires returned is " . ldap_count_entries($ds, $sr) . "";
echo "Getting entries ...";
$info = ldap_get_entries($ds, $sr);
echo "Data for " . $info["count"] . " items returned:";
for ($i=0; $i<$info["count"]; $i++) {
echo "dn is: " . $info[$i]["dn"] . "";
echo "first cn entry is: " . $info[$i]["cn"][0] . "";
echo "first email entry is: " . $info[$i]["mail"][0] . "<hr />";
}
echo "Closing connection";
ldap_close($ds);
} else {
echo "<h4>Unable to connect to LDAP server</h4>";
}
?
The LDAP-Auth plugin does not bind anonymously, it binds as the user who is trying to log in, and it searches for that users UID in the specified domain. If your users are all in the “o=Lions” domain you specified in your search, then that should be it. Provided that they have a valid uid/password in that branch of your LDAP tree they should be able to authenticate.
I am also having difficulty getting the ldap plugin to authenticate.
I can connect via command line (telnet) and my portal also authenticates with a user/pass bind specifically created for that purpose.
I simply get a [HTTP 500] error on the [bb-login.php] page after attempting to log in with AD credentials.
I am having problem with the bb_get_user() function in the ldap_authentication plugin, it is not returning any value although the $user variable shows a valid user id. Because of this the plugin will try to create a new user which resulted in an error – ‘Failed to add new LDAP user to local database.’
Can someone please help?
I’m having the same problem as the original poster. (Note – error is from line 332.)
I changed uid= to cn= in the connectUser function, but that didn’t help.
I have the WPMU LDAP plugin working OK, using the same server settings.
Any ideas on possible fixes?
Thanks.
- You must be logged in to reply to this topic.