Skip to content
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

DM-23878: Allow the LDAP group search to be configured #860

Merged
merged 4 commits into from
Oct 2, 2023
Merged

Conversation

rra
Copy link
Member

@rra rra commented Sep 19, 2023

Most LDAP servers put the full user DN in the membership attribute of the group tree. Add a boolean configuration option to specify this search behavior, constructing the DNs using the user base DN and search attribute. This requires that user LDAP information also be enabled, but I'm hoping to drop support for getting only groups from LDAP and not also users, so this isn't a major drawback and it allows simplification of the configuration and avoids supporting too many degrees of freedom.

Log more debugging information about upstream OIDC tokens.

Restructure the validation of the LDAP settings object to take more advantage of Pydantic v2 validators by using model validators instead of field validators where more appropriate. Remove all of the defaults from the frozen config, since that should be determined entirely by the settings models.

@rra rra force-pushed the tickets/DM-23878 branch 2 times, most recently from 4f40eec to 74ec416 Compare September 19, 2023 00:52
The IPA LDAP server used in the base cluster only puts full DNs for
users in the member field of group LDAP entries. Allow customization
of the group search template so that the configuration can tell
Gafaelfawr to construct the user DN from a template in order to find
the groups they belong to.
Make more use of structured logging when logging the retrieval of
the upstream OIDC token, and log the unverified contents of that
token at debug level to assist in debugging OIDC issues.
Rather than allowing the user to specify a full template for the
group search, instead add a boolean flag saying whether to search
by DNs. This requires that the attributes for retrieving user
information also be set, but I'm hoping to drop support for getting
only groups from LDAP and not also users, so this isn't a major
drawback and it allows simplification of the configuration and
avoids supporting too many degrees of freedom.

Add a test for finding user group membership by DN. Refactor the
LDAP storage layer a little to avoid some duplicate code.

Restructure the validation of the LDAP settings object to take more
advantage of Pydantic v2 validators by using model validators instead
of field validators where more appropriate. Remove all of the defaults
from the frozen config, since that should be determined entirely by
the settings models.
Add a change log and Helm configuration documentation. Stress that
the best Gafaelfawr configuration with OIDC is to use LDAP for all
user metadata, and that Keycloak is not apparently capable of
generating group information in the token that meets our requirements.
@rra rra marked this pull request as ready for review October 2, 2023 23:43
@rra rra enabled auto-merge October 2, 2023 23:43
@rra rra merged commit 0515f60 into main Oct 2, 2023
5 checks passed
@rra rra deleted the tickets/DM-23878 branch October 2, 2023 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant