-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot use dn search strings for searching at the domain level? #73
Comments
Adding some debugging statements to the code ( ckanext-ldap/ckanext/ldap/lib/search.py Line 93 in afded53
def ldap_search(cnx, filter_str, attributes, non_unique='raise'):
.
.
.
try:
res = cnx.search_s(toolkit.config['ckanext.ldap.base_dn'], ldap.SCOPE_SUBTREE,
filterstr=filter_str, attrlist=attributes)
log.debug("\n==========\n")
log.debug(res)
log.debug("\n==========\n") I can see that the filter does appear to be working (kinda), but is returning multiple entries in the
...(note that tuple with the "myuser" sAMAccountName is the user I want to sign in as) but can't really tell what I am looking at since the docs for Not really sure what to do about / make of this. |
I expect this is a problem with your LDAP search filter rather than this extension. The search filter needs to be constructed so that it can only return a maximum of one result. Try |
IC, thank you for the info. |
The issue appear to be with the l = ldap.initialize('ldap://foobar')
l.set_option(ldap.OPT_REFERRALS,0) ...yet adding this code (around here: ckanext-ldap/ckanext/ldap/lib/search.py Line 25 in afded53
Also tried to change the order like ldap.set_option(ldap.OPT_REFERRALS,0)
res = cnx.search_s(toolkit.config['ckanext.ldap.base_dn'], ldap.SCOPE_SUBTREE, filterstr=filter_str, attrlist=attributes) and still getting the referrals in the result list from the Would you know what could be done about this? Have no other users run into the issue before (I feel like my use case is pretty reasonable)? |
Just talked to someone else more familiar with For now, the only approach they recommended was to filter these values with something like: results = ldap.search_s(...)
results = [ x for x in results if x.0 is not None ] Noting that the structure of the results returned from
When it's a referralm it's a dn of (Note that in the Ultimately I modified the ckanext-ldap/ckanext/ldap/lib/search.py Line 93 in afded53
became res = cnx.search_s(toolkit.config['ckanext.ldap.base_dn'], ldap.SCOPE_SUBTREE,
filterstr=filter_str, attrlist=attributes)
res = [ x for x in results if x[0] is not None ] and also ckanext-ldap/ckanext/ldap/lib/search.py Line 25 in afded53
became cnx = ldap.initialize(toolkit.config['ckanext.ldap.uri'], bytes_mode=False,
trace_level=toolkit.config['ckanext.ldap.trace_level'])
cnx.set_option(ldap.OPT_NETWORK_TIMEOUT, 10)
cnx.set_option(ldap.OPT_REFERRALS,0) (just to stop the Again, I believe that this problem is due to the base DN being a domain level path (which I still contend from my original use case that it is not that unreasonable a use (unless there is some other * For others, if you are going to change the extension code, you need to reload the cached package in ckan libs, eg...
(if you did not install ckan as a package, then no need to do the sudo and abs. python path reference). |
Description
A clear and concise description of what the bug is.
Extension throwing errors when using search string that searches multiple AD (sub)paths for users, eg.
Getting errors like...
Basically, my issue is that I have a base DN like...
that has a bunch of Group CNs under it like...
...(where the CN groups contain users/Person objects that are defined in various other places) and I am trying to get all of the users (
objectCategory=Person
) to be able to log in using the ldap extension.Is the extension not able to accommodate such a structure? Can I only point to a single place where user objects themselves are explicitly defined?
Expected Behaviour
What you expected to happen instead.
Be able to sign in using AD users defined in either of the DN paths described in the example search query above.
To Reproduce
Steps to reproduce the bug.
Set
or some other set of multiple DN paths to search for AD users in.
Error Log
Paste any relevant error logs below:
Screenshots
Add screenshots to illustrate the bug if you want.
Your Setup
Anything Else?
Note that when I use ADExplorer to look at the AD properties, I see that the
objectCategory
value for our users is not actually just "Person", butCN=Person,CN=Schema,CN=Configuration,DC=myorg,DC=local
. Don't work with AD internals much (nor LDAP querying at all) so not sure if this is an issue (and I may be misunderstanding something else here as well).The text was updated successfully, but these errors were encountered: