osixia / docker-openldap

OpenLDAP container image 🐳🌴
MIT License
4.03k stars 974 forks source link

group search filters not working #38

Open sundaresh2016 opened 8 years ago

sundaresh2016 commented 8 years ago

I have created user entries, created entries with object class - groupOfNames, groupOfUniqueNames and added users under it.

But ldapsearch filters are not working which makes group entries futile. For example i have, uid=testuser,ou=allusers,dc=example,dc=com ou=admin,ou=allusers,dc=example,dc=com - groupOfUniqueNames entry uniqueMember - uid=testuser,ou=allusers,dc=example,dc=com

ldapsearch -D "cn=admin,dc=example,dc=com" -b "ou=admin,ou=allusers,dc=example,dc=com" uniqueMember=test

hsuhw commented 8 years ago

Hi,

I assumed that you are using the default settings that come with the image, and what you want to do is to "filter" out some of the user against others based on your grouping.

So several things here if my assumption is correct: The premade configuration is on groupOfUniqueNames so it would be the one you use. Make sure that the setting of the membership is done after the creation of the user record. And the filter you want for your group would be memberOf.

Here's the search command that you might be looking for:

ldapsearch -D 'cn=admin,dc=example,dc=com' -b 'ou=allusers,dc=example,dc=com' 'memberOf=ou=admin,ou=allusers,dc=example,dc=com'

It helps you pick out the users in your group ou=admin,... from all your other users ou=allusers,.... You might also want to check out the search filter syntax for more advanced cases.