LDAP limit user search on specific OUs - ldap

I have been wondering whether it is possible to limit OUs in search base. This is how my hierarchy looks like:
Now, my search base is: dc=prod,dc=prod,dc=co
Is there possibility to limit user search only to these:
OU=PROD,OU=SYS
OU=PROD,OU=Int
OU=UNIX
I'm a noob in this area, would be really welcome if someone could help.
Not sure if it is possible to use userSearchBase for multiple OUs (so far I understood that it is not possible, although for sssd I saw example which works)
I think some user search filter might do it but wasn't really successful unfortunately

Yes, you can limit the search base to multiple or single OU's.
Ranger does accept multiple search bases, for example:-
OU=PROD,OU=SYS,dc=prod,dc=prod,dc=co;OU=PROD,OU=Int,dc=prod,dc=prod,dc;OU=UNIX,dc=prod,dc=prod,dc=co
Few thing to note, it has to be separated by ";" and it needs full path including "dc" values.

Related

Ldap search for objects where attribute X contains multiple values

I would like to know if it is possible to do a search like this:
"give me all objects where description has more than 1 value"
The short answer is no. At least not from a single LDAP Query without somehow parsing the results.
I know of a tool that will provide those results however it has not been updated in a while but last time I used it, it worked.

Bigtable - read_rows and start_key

Is there a way to write the start_key for Bigtable? I was not able to find a clear documentation on what the syntax is for start_key.
Suppose I have a row key of {domain}_{timestamp} of user activity.
To filter the query to a specific domain I could use a filter (slower), or a start_key (faster).
I have been writing my start_key string as {domain}_, but what if we now have domain, user ID, and timestamp, and now I want to filter by any user but a specific time, can I use something like {domain}_*_{timestamp}?
You have to use a Filter with RegexStringComparator. You can also setStart({domain}_) for better performance. Unfortunately, that's going to pretty much going to do a scan on {domain}_ and filter on the server-side.
It might be faster to do a search with either a random user id, or if you need all users, to use Table.get(List<Get>) where each Get correspond to individual user.

Is there a way to properly experiment with Solr field-types?

I'm working with Solr for a basic search engine, and I've created a couple different fieldTypes that include various filters and tokenizers in their analyzer chains.
However, I'm finding it very difficult to assess how these components of the chain interact and when I query in the Solr Admin, I consistently get different results than I expect-- with no clue as to why.
Is there a way to see what a phrase like education:"x university" is being transformed into when I type it in the q section of the Admin?
Also, when the phrase goes through the chain can it be transformed into multiple things that are all searched or is it just a single modified phrase?
Thanks for any help!
Use Analysis in Solr Admin to check how each field and its type process the tokens both while querying and indexing.
Analyse Fieldname / FieldType:
from the drop down option select field/type that you want to analyse and clieck on Analyse values.
ex: what tokenizer used, which all filter classes applied to token and how token is transformed after passing each filter class.
if
Verbose Output is checked, it shows more details about each filter class used for the selected field/type.

LDAP Search String for Two OUs

I am looking to include two separate OUs in an LDAP search string. I've searched for answers and found some but none seem to work once I include the second OU. Specifically, this is to narrow down a scan to email list on a Canon Copier. The following string works on a single OU:
OU=People (Staff),DC=DOMAIN1,DC=DOMAIN2,DC=com
I'd like to add a second OU so all emails included in the second OU are also available in the scan to email address search. The second one is OU=People (Vendors)
I can remove the OU completely but the search takes too long without the extra filter. Is this possible? Thanks.
Depends.
The Extensible Match Search Filter supports this functionality assuming that your LDAP server implementations supports that functionality. (Microsoft Active Directory does NOT support this)
(&(|(ou:dn:=People (Staff))(ou:dn:=OU=People (Vendors)))(objectclass=inetorgperson))

Retrieving group membership in LDAP

I am using a sample LDAP which is available online here.
I want to retrieve a user's group membership given their uid. In the example, Gauss (uid=gauss) is a member of the Mathematicians group (ou=mathematicians,dc=example,dc=com).
I tried several LDAP queries but I cannot seem to find the one that returns me the ou=mathematicians given the uid.
There are a lot of similar answers on SO but none seem to fit this very simple use case.
Thanks,
David.
You won't be able to retrieve the group membership by simply using the uid as the groupmemberships are stored using the uniqueMember-attribute which requires a complete DN as value. Therefore you'll have to use a searchfilter like uniqueMember=uid=gauss,dc=example,dc=com.
You might think "that's great, so I just add uid=gauss to the baseDN and I'm finished". You might not always have luck with that as it's not defined that users have to be located right in the baseDN. They might be distributed acros the complete LDAP-tree and then it's going to be tough. But when you already have searched for the user (IE for binding) you got the DN back "for free" so you can use that on.
Hope that helps!
Not sure if I get right what you want to do, but retrieving group membership is done by a filter similar to this one:
(&(objectClass=group)(member:1.2.840.113556.1.4.1941:=<<<USER-DN>>>))
I always pull the user dn with a seperate search:
(&(objectCategory=person)(objectClass=user)(samaccountname=<<<USER LOGON NAME>>>))
I don't know if uid, dn and samaccountname can be used in every filter interchangeable, but try it with uid=<<>> instead.
See this article for details : https://msdn.microsoft.com/en-us/library/aa746475(v=vs.85).aspx