JustAGuy
JustAGuy

Reputation: 5941

LDAP Querying users in an OU

In Elasticsearch I'm trying to make it's user_search.filter take users from a specified OU (not groups, just the users contained in this OU). It should work like a regular LDAP Query.

So far I've come up with the following:

(&(objectClass=user)(samaccountname=*)(OU=ES Users,OU=app_users,DC=app
    ,DC=domain,DC=com))

Unfortunately that does not return any results and I'm not sure why.

Upvotes: 0

Views: 38605

Answers (2)

jwilleke
jwilleke

Reputation: 10976

A simple ldap request similar to:

ldapsearch -H ldaps://example.com:636 -x -D "cn=Admin" -W -b "ou=people,dc=example,dc=com" -s sub -a always -z 1000 "(objectClass=inetOrgPerson)" "objectClass"

Should work where the baseDN(="ou=people,dc=example,dc=com") is the OU you are looking to obtain the entries from within.

Upvotes: 1

EricLavault
EricLavault

Reputation: 16035

If you want to list all user entries with a dn built under the base "OU=ES Users" (as a container) you need to use OU=ES Users,OU=app_users,DC=app,DC=domain,DC=com as the search base dn.

For Active Directory user authentication in Elasticsearch, this means the following :

user_search.filter: (&(objectClass=user)(samaccountname=*))
user_search.base_dn: OU=ES Users,OU=app_users,DC=app,DC=domain,DC=com

See Active Directory Realm Settings

Upvotes: 2

Related Questions