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

make "memberOf" Searchfilter configurable #1583

Closed
schwatvogel opened this Issue Nov 24, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@schwatvogel

schwatvogel commented Nov 24, 2015

Hi,
we cannot use Ldap group Mapping because we are using a Sun Directory Server,
the Ldapsearch ldapsearch -x -LLL -h ldap.server -b"dc=company,dc=tld" '(uid=user.name)' memberOf
returns an empty Result.
Searching for ismemberOfinstead, returns all the Groups.
The memberOf Filter seems to be hardcoded in
graylog2-server/src/main/java/org/graylog2/security/ldap/LdapConnector.java
Line 135 and 154
Since this will be quite rare, maybe a configuration Setting in server.conf will suffice?

best regards
Serge

@schwatvogel

This comment has been minimized.

schwatvogel commented Nov 27, 2015

have build a small fix for this
(had no idea how to get to configurationvariables in this class, would be thankfull for a hint)

diff --git a/graylog2-server/src/main/java/org/graylog2/security/ldap/LdapConnector.java b/graylog2-server/src/main/java/org/graylog2/security/ldap/LdapConnector.java
index 769d9b4..ff49f87 100644
--- a/graylog2-server/src/main/java/org/graylog2/security/ldap/LdapConnector.java
+++ b/graylog2-server/src/main/java/org/graylog2/security/ldap/LdapConnector.java
@@ -132,7 +132,7 @@ public class LdapConnector {
             entryCursor = connection.search(searchBase,
                                             filter,
                                             SearchScope.SUBTREE,
-                                            groupIdAttribute, displayNameAttribute, "dn", "uid", "userPrincipalName", "mail", "rfc822Mailbox", "memberOf");
+                                            groupIdAttribute, displayNameAttribute, "dn", "uid", "userPrincipalName", "mail", "rfc822Mailbox", "memberOf","ismemberOf");
             final Iterator<Entry> it = entryCursor.iterator();
             if (it.hasNext()) {
                 final Entry e = it.next();
@@ -155,7 +155,11 @@ public class LdapConnector {
                         for (Value<?> group : attribute) {
                             groupDns.add(group.getString());
                         }
-
+                   }
+                    if ("ismemberOf".equalsIgnoreCase(attribute.getId())) {
+                        for (Value<?> group : attribute) {
+                            groupDns.add(group.getString());
+                        }
                     }
                 }
             } else {

@bernd bernd added the ldap label Dec 8, 2015

bernd added a commit that referenced this issue Dec 8, 2015

@bernd bernd closed this in fe2b27f Dec 8, 2015

@bernd

This comment has been minimized.

Member

bernd commented Dec 8, 2015

This will be in the upcoming Graylog 1.3 release. Thank you for the report and the diff!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment