plugin-LoginLdap icon indicating copy to clipboard operation
plugin-LoginLdap copied to clipboard

Support nested groups for LDAP

Open bluikko opened this issue 9 years ago • 21 comments

The plugin should resolve nested groups.

bluikko avatar Jan 06 '17 16:01 bluikko

Hi! What's the status of this issue?

thungsten avatar Sep 28 '17 06:09 thungsten

I would love to see that - or at least there should be the option to use the Extension:(memberOf:1.2.840.113556.1.4.1941:=cn=group,cn=users,DC=x)

I tried to set it up but unfortunately it doesn't seem to be used.

thungsten avatar Jan 12 '18 14:01 thungsten

+1 for this

dougti avatar Oct 26 '18 18:10 dougti

bump Is this issue on your ToDo Schedule ?

bobnautic avatar Aug 19 '21 09:08 bobnautic

bump just encountered the issue, it's blocking us from using Matomo at the moment.

lgromb avatar Sep 27 '22 12:09 lgromb

also bump

Mndarin avatar Jan 24 '23 13:01 Mndarin

Maybe @AltamashShaikh can help you have visibility on this subject?

heurteph-ei avatar Jan 24 '23 14:01 heurteph-ei

@all I have added this task "For Priortisation", meanwhile @Mndarin can you provide more context to this, so that we better understand the issue and it will help us in priortising it.

AltamashShaikh avatar Jan 25 '23 01:01 AltamashShaikh

Create a LDAP group "A". Create a LDAP group "B". Set user "X" as member to "A". Set group "A" as member to "B".
Configure the plugin to use group "B" as required for access.
User "X" cannot login because the nested groups are not resolved by the plugin.

Note that there could be more levels of nesting than just 2 groups.

bluikko avatar Jan 25 '23 01:01 bluikko

We're considering implementing this. I have a Q: from a LDAP perspective, should Nested Groups always be resolved? (or are there cases you'd want to disable that and then we also need a setting for this - but ideally we don't need a new setting)

mattab avatar Jan 27 '23 01:01 mattab

should Nested Groups always be resolved?

I could not think of any reason why one would not want to.

bluikko avatar Jan 27 '23 02:01 bluikko

We're considering implementing this. I have a Q: from a LDAP perspective, should Nested Groups always be resolved? (or are there cases you'd want to disable that and then we also need a setting for this - but ideally we don't need a new setting)

The rationale for making recursion optional is for cases of large/poorly structured directories where it could cause slow-downs. (Not a case I've ever faced personally).

dougti avatar Jan 28 '23 17:01 dougti

@dougti we should have an option to disable this I think @mattab what are your thoughts on this?

AltamashShaikh avatar Jan 28 '23 18:01 AltamashShaikh

No option needed @AltamashShaikh we can implement the nested resolution logic to all :+1:

mattab avatar Jan 30 '23 01:01 mattab

Are you guys sure, you want to implement the recursion yourself? This can get VERY bad and slow on big forests.

Normally the "1.2.840.113556.1.4.1941" search options is there for exactly this. Here is a simple User-Lookup which we use in sonarqube for example:

ldap.user.request=(&(objectClass=user)(sAMAccountName={login})(memberOf:1.2.840.113556.1.4.1941:=CN=complete cn of group))

As you can see there's a placeholder for finding the user. The trick here is not to get the users of the group and than match the user but instead offload the check for a given user directly to ldap / AD

pfeigl avatar Mar 09 '23 09:03 pfeigl

@pfeigl The LDAP_MATCHING_RULE_IN_CHAIN is great but I'm not sure it can currently be used with how LoginLdap is configured. Have you tested this with LoginLdap?

Often enabling recursion is behind a configuration flag.

bluikko avatar Mar 09 '23 10:03 bluikko

Having it togglable might be the right way.

Btw I finally managed to get it working with the current state of the implementation. The trick was not to use Ldap SearchFilter but only go with memberOf settings and more specifically set this as the memberOf Field: memberOf:1.2.840.113556.1.4.1941:

Than just put the correct group in the group field and you should be good to go.

See the following screenshot: image

With this combination, the search query is actually setup correctly internally.

pfeigl avatar Mar 09 '23 15:03 pfeigl

@pfeigl with the above setting, nested groups are working perfectly for you?

AltamashShaikh avatar Mar 09 '23 15:03 AltamashShaikh

Yes, it worked just as expected

(We are only doing login integration, no mass sync. This would probably not work this way)

pfeigl avatar Mar 09 '23 19:03 pfeigl

@pfeigl Tested and if memberOf:1.2.840.113556.1.4.1941: is set only the matching users are synced with ./console loginldap:synchronize-users and its better to use memberOf:1.2.840.113556.1.4.1941: to resolve nested groups

@Mndarin @lgromb Does setting LDAP memberOf Field as memberOf:1.2.840.113556.1.4.1941: and saving and testing wokrs for you ?

AltamashShaikh avatar Mar 28 '23 01:03 AltamashShaikh

@all We created a new FAQ to resolve nested groups using memberOf:1.2.840.113556.1.4.1941:, it will be great if anyone can review it

AltamashShaikh avatar Apr 02 '23 23:04 AltamashShaikh