Conversation
On FreeIPA (389 Directory Server) the AD LDAP_MATCHING_RULE_IN_CHAIN operator isn't supported, and the default member-attribute search only sees direct members, so a user's nested group memberships and their roles were dropped. Add a third resolution path: when groupSearchEnableMemberOf is set, read the user entry's own memberOf attribute, which the directory pre-flattens with nested membership. Split rolesFor() into three per-strategy private methods so each path stays readable; the two existing paths are moved unchanged and matchingRuleInChain keeps precedence when both are enabled.
…pa-memberof-nested-groups
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this PR for?
LdapRealmresolves a user's groups in one of two ways today: the Active DirectoryLDAP_MATCHING_RULE_IN_CHAINoperator, or a group search over thememberattribute. Neither works for nested groups on FreeIPA / 389 Directory Server — the AD matching rule isn't supported there, and the plainmembersearch only sees direct members. So if a user is indevanddevis a member ofeng, the user'sengmembership (and any role mapped to it) silently disappears.This adds a third path. When
ldapRealm.groupSearchEnableMemberOf = true, the realm reads the user entry's ownmemberOfattribute instead of walking the group tree. FreeIPA/389 DS already flattens direct and nested membership ontomemberOf, so a single lookup of the user entry gives you the full set, nested groups included.While adding it I split
rolesFor()into three small per-strategy methods (matching-rule / group-membership / memberOf) so each path is readable on its own. The two existing paths are moved as-is, no behavior change.New settings:
A few decisions worth calling out:
groupSearchEnableMatchingRuleInChainandgroupSearchEnableMemberOfare both set, the matching-rule path wins and we log a one-time warning, rather than refusing to start. This keeps existing AD setups behaving exactly as before; the cost is that a contradictory config isn't hard-rejected, just warned.memberOfvalue is a full group DN, and we take the group name from its leaf RDN without scanning ancestors. On FreeIPA a container on the path (cn=groups,cn=accounts,...) has the samecn=type as the group itself, so scanning would pick the wrong one. A malformed DN is skipped (and logged) instead of failing the login.One prerequisite (documented in
shiro_authentication.md):memberOfis only returned to an authenticated bind, which Zeppelin already does viasystemUsername/systemPassword. Deployments that split groups and members across separate backends may also need server-side memberOf scope configuration.What type of PR is it?
Improvement
Todos
rolesFor()into per-strategy methodsWhat is the Jira issue?
ZEPPELIN-6171
How should this be tested?
LdapRealmTest(11 tests, mock-based) covers the memberOf path: nested resolution, matching-rule precedence, leaf-RDN fallback, and the empty / missingmemberOfcases. The existing tests pass unchanged, which is what pins down that the two old paths still behave the same.I also ran it end-to-end against a real 389 Directory Server (FreeIPA's LDAP engine) with a nested setup —
alice∈dev, anddev∈eng:So the nested group is recovered only with the new flag on.
Questions:
docs/setup/security/shiro_authentication.mdis updated.