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

Add a config option to normalize LDAP groups case #3344

Open
2 tasks done
rci-kmccolm opened this issue Feb 9, 2024 · 0 comments
Open
2 tasks done

Add a config option to normalize LDAP groups case #3344

rci-kmccolm opened this issue Feb 9, 2024 · 0 comments

Comments

@rci-kmccolm
Copy link

Preflight Checklist

  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Problem Description

We are using Pinniped with Dex in Kubernetes for authenticating Kubernetes users against AD. When LDAP groups are presented to Pinniped for the purpose of assigning group memberships, if the LDAP group case does not match then the group memberships are not matched and the authentication fails.

Proposed Solution

In my understanding, in most LDAP environments, attribute values are considered case-insensitive. Therefore I believe it would be beneficial to have an option in Dex to normalize case for LDAP group IDs (and perhaps user IDs as well) when Dex retrieves them from the directory to avoid this problem. Example code below,

In connector/ldap/ldap.go:

// Config holds configuration options for LDAP logins.
type Config struct {
[...]
		// If set to true, convert all group names to lower case
		NormalizeGroups bool `json:"normalizeGroups"` // Defaults to false
[...]
func (c *ldapConnector) groups(ctx context.Context, user ldap.Entry) ([]string, error) {
[...]
		// Convert group name to lower case if config value normalizeGroups is true
		if c.GroupSearch.NormalizeGroups {
			name = strings.ToLower(name)
		}

Alternatives Considered

No response

Additional Information

If the community is happy with this approach, I can submit a PR, but first I wanted to float the idea and see if it is welcomed.

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

No branches or pull requests

1 participant