-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
connector/ldap: Add LDAP simple bind mode. #1585
base: master
Are you sure you want to change the base?
Conversation
1b8f320
to
19b6e28
Compare
eb23e4d
to
814af60
Compare
814af60
to
dfb6185
Compare
e7f9b09
to
cfa232e
Compare
cfa232e
to
0c437aa
Compare
This is a feature I'd really like to have. Is there anything I can do to assist with testing? My environment is very service-principal-averse, so all our other services besides dex bind directly as the user they're authenticating. Would be nice to have that here as well. |
0c437aa
to
74a6281
Compare
Hi, the-maldridge. Thanks for your comment. |
74a6281
to
19bc17c
Compare
19bc17c
to
87acab5
Compare
87acab5
to
2b7e509
Compare
connector/ldap/ldap.go
Outdated
bindPW = string(c.pass) | ||
} | ||
|
||
c.logger.Debugf("ldap: - bindDN=<%s>", bindDN) |
Check failure
Code scanning / CodeQL
Log entries created from user input
86f62a0
to
0a6b0a6
Compare
@sagikazarmark @seankhliao @vsychov @nabokihms can you please merge? I'm setting suffix as '@my.company.domain' so I can use incoming ActiveDirectory user creds to bind to ldap instead of relying on a common service/generic account to bind for all incoming users |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution!
Can you please take a look at my comment?
Also, can you please add tests making sure this feature works? Thanks!
@batatch are u still working on this? |
@tooptoop4 ok, i'll try it. |
6771505
to
c6e974b
Compare
Signed-off-by: batatch <[email protected]>
Signed-off-by: batatch <[email protected]>
Signed-off-by: batatch <[email protected]>
Signed-off-by: batatch <[email protected]>
c6e974b
to
0bd9cd5
Compare
Signed-off-by: batatch <[email protected]>
Signed-off-by: batatch <[email protected]>
0bd9cd5
to
c77c83f
Compare
@sagikazarmark |
Thanks for making the changes and sorry for the long delay. The PR looks good to me, but I'd like to raise a question before we merge it (bear in mind I'm not that familiar with how apps generally integrate LDAP): I'm a little bit concerned that it may be too easy to provide invalid data in the configuration that could result in errors. For example: if you don't provide a prefix, but you provide a suffix, the DN could look something like this: Another concern (and again, not sure how other applications do it: What if the username contains special characters? For example: Then the DN will look like this: Here comes the question: would it make sense to add some better validation and/or escaping to make sure the DN is correct? Also (and once again, no idea if this is an accepted practice or not), I'm thinking maybe we should introduce these options instead: bindDN: "uid={username},cn=users..."
simpleBind: true When What do you think? |
Thank you for your comment, sagikazarmark-san. The configuration method for specifying prefix and suffix is based on the most commonly found PostgreSQL example and more. If we use templates, I couldn't determine which template method to use, as it requires an uniform rules in configuration. I think the boolean flag of simpleBind=true and the template setting definitions to be redundant, In the validation of prohibited characters in usernames, "," might be better to be checked. |
Obviously, it would have to be documented.
I don't think it's any more redundant than the current proposal. Simple bind setting would essentially change the behavior of how the other parameter is used.
I would argue this is actually a potential security issue, since usernames are accepted as an input entered by a user. This could essentially be the LDAP version of an SQL injection, so the user name MUST be escaped somehow. No idea if there is any builtin tool for that in the LDAP library (ie. something like prepared statements in SQL). |
🙏 |
Supports LDAP simple bind mode
If
BindDNPrefix
orBindDNSuffix
are set,BindDNPrefix username BindDNSuffix
is used asBindDN
.