Reputation: 170310
I sill fail to see the light
in LDAP ;) ...
Here is the use case: I am trying to setup Jira to sync LDAP directory for login but because the directory is huge I do need to be very sensitive on how do I make the query, in order to eliminate the garbage.
I need both Users and Service Accounts.
HEre are the requirements (you are free to suggest more):
_
#
or `Upvotes: 0
Views: 6004
Reputation: 170310
Here is a partial solution that I have, still not completely happy. In order to make it easier to read I will put the conditions separated.
They are ordered in order to improve query speed:
(samAccountType=805306368) // user/person (optimum test)
(userAccountControl:1.2.840.113556.1.4.803:=512) // normal account
(!(userAccountControl:1.2.840.113556.1.4.803:=32)) // allow only accounts with passwords
(mail=*) // with email
(uSNChanged=*) // eliminates few invalid accounts
(!(sAMAccountName=_*))
(!(sAMAccountName=#*))
(!(sAMAccountName=$*))
Compiled query:
(&(samAccountType=805306368)(!sAMAccountName=*)(userAccountControl:1.2.840.113556.1.4.803:=512)(!(userAccountControl:1.2.840.113556.1.4.803:=32))(mail=*)(uSNChanged=*)(!sAMAccountName=_*)(!sAMAccountName=#*)(!sAMAccountName=$*))
Upvotes: 5