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 support for looking up the account DN post-bind #12

Merged
merged 2 commits into from
Aug 28, 2016

Conversation

skemper
Copy link
Contributor

@skemper skemper commented Jul 1, 2016

For AD environments like ours, a user's DN is hard to programmatically generate. However, MS lets you bind with a username of form 'DOMAIN\username' which is what we use for our template. In order to test group membership, we have to look up their DN later. We opted to go this route, rather than trying for the memberOf attribute, because that overlay isn't a guaranteed thing in the OpenLDAP world.

EDIT: specifically, this was causing problems for the allowed_groups feature, which was looking for the bind DN in the membership lists of groups.

help="""LDAP attribute that stores the user's username.

For most LDAP servers, this is uid. For Active Directory, it is
sAMAccountName.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

capital S?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, it's actually sAMAccountName in keeping with the LDAP convention that attribute names always start lowercase.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aah, thanks :)

@yuvipanda
Copy link
Collaborator

Hello! Thank you very much for your patch, and sorry for the super delayed response!

The code looks good to me, with the exception of one minor comment (which I'm happy to fix myself). I do not have access to an AD instance to test this, however. Are you still running this? Do you think you can add a section to the README with an example configuration for running it against AD?

@skemper
Copy link
Contributor Author

skemper commented Aug 25, 2016

Yes, we're using this in production today, against our corporate AD. I'll add an AD example to the README later tonight, sure!

@yuvipanda
Copy link
Collaborator

Wonderful! I'll be happy to merge this after the README update!

Thank you very much!

@skemper
Copy link
Contributor Author

skemper commented Aug 26, 2016

OK, README has been updated with some examples.

@yuvipanda yuvipanda merged commit 96082c8 into jupyterhub:master Aug 28, 2016
@yuvipanda
Copy link
Collaborator

Thanks for the patch! \o/ I'll probably do a release in a bit...

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.

2 participants