Details
-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
-
None
-
Observium 26.10.15440 ; openldap 2.6.16
Description
Hi,
LDAP admin here, not really an observium user. Our LDAP setup has some very tight ACLs, so some of this was self-inflicted pain, but I just helped debug LDAP auth and wanted to share a couple notes while it's fresh in my mind.
All of this is in html/includes/authentication/ldap.inc.php
1)
function ldap_internal_auth_user_id($result)
|
{
|
if ($config['auth_ldap_attr']['uidNumber'] === "objectSid") { |
# don't care
|
} else { |
$userid = $result[strtolower($config['auth_ldap_attr']['uidNumber'])][0]; |
print_debug("LDAP[UserID][Attribute " . $config['auth_ldap_attr']['uidNumber'] . " yields user ID " . $userid . "]"); |
}
|
if (!is_numeric($userid)) // FIXME, do this configurable? $config['auth_ldap_uid_number_generate'] = TRUE|FALSE; |
{
|
$userid = string_to_id('ldap|' . $result[strtolower($config['auth_ldap_attr']['uid'])][0]); |
}
|
If the uidNumber attr is not in the result (because of tight ACLs), the debug printout is non-obviously a problem: "LDAP[UserID][Attribute uidNumber yields user ID ]"
Then, if the uid attr is not in the result (because of tight ACLs), the following stanza gets fun too. if not-is-numeric (true!) then $userid = string_to_id('ldap|') - because there was no uid.
This yields all of your LDAP users having the same user_id. The first person in works fine. Subsequent logins fail with a DB error 1062 - dupe user id.
This is 'shown' as ldap_auth_user_id / print_debug("LDAP[UserID][$userid]"); - but since the userid is a 9 digit string (289270003), it's plausible as an internally-generated number until you dig much farther.
2)
function ldap_auth_user_id($username)
|
{
|
$search = ldap_search($ds, trim($config['auth_ldap_suffix'], ', '), $filter); |
}
|
This search does not contain the attributes parameter. As LDAP admin, I checked the logs, and no attributes were requested. This slowed down my detection of the issue above, because I had no indication you were expecting any particular user attributes, I ass-u-me'd it was a simple rebind from the bind user to the human user, and a lookup of just the entry. Had this search included the parameters it was going to use, it would've been a big clue to the overtight ACLs and where we needed to loosen up.
We're working now, so no triage needed, just suggesting things.
Thanks for reading.