-
-
Notifications
You must be signed in to change notification settings - Fork 482
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
User authentication via LDAP #11501
Comments
comment:1
patch is based on Rado Kirov's major changes in the patch: user_manager.py: user.py conf.py/server_conf.py account_settings.html worksheet_share.html |
comment:2
the first comment should actually say: patch is based on Rado Kirov's "rkirov-flask" repo. requires module "python-ldap" (available via easy_install like in Rado's install instructions) (and the list of changes is missing newlines, sorry for that) |
comment:3
Copied over from discussion on sage-notebook.
class ExtAuthUserManager(OpenIDUserManager): It would seem to me that this should be reversed. ExtAuthUserManager should be the generic class, and OpenIDUserManager should turn into an OpenIDAuth otion in the _auth_methods dict.
ldaps://hostname which is impossible to configure for in your current code: it is fixed with "ldap".
My best guess is that "ldap_username_attrib" will typically be "uid", but I can tell you that in our LDAP server the same user may have multiple entries for different LDAP namespaces. We have one namespace for system users, and another for web portal users, so my username ijstokes shows up twice: uid=ijstokes,cn=users,cn=portal,dc=nebiogrid,dc=org Plus on a big LDAP server this is an expensive search. The admin will know where users are kept, and the search should be limited just to that part of the LDAP tree. In my LDAP implementation, I did a synchronous search as follows: results = self._ldap_con.search_s("uid=%s,cn=users,cn=portal,dc=nebiogrid,dc=org" % username, ldap.SCOPE_BASE, attrlist=['uid','cn','mail'])
|
comment:4
Replying to @sagetrac-ijstokes:
My bad, the comment went horribly wrong. I meant Rado's instruction for getting his flask notebook running (he also uses easy_install from sage's ipython) on top of which my patch is based. To get python-ldap easy_install'ed you need OpenLDAP's libldap but I can't confirm if that suffices.
You are right. I'm not experienced with OpenID so I have no idea if/how this can be done.
I'd favour that too but unfortunately lists of preset values can not be configured in the UI (yet).
Indeed. I didn't want to break functionality and OpenID seems to be a quite special case. This should be changed if possible
A reference to a ServerConfiguration (server_conf.py object is passed. Configuration is done in the browser UI (settings -> notebook settings).
Right! I will change that immediately, completely forgot about ldaps
The first bind is with a "generic" DN (i.e. a non-user account).
The generic DN is then unbound and either one ldap object or "None" is returned. After unbinding the connection must be reset with ldap.initialize If a unique object is returned, we use that object's DN and the provided to try and bind with ldap. If that succeeds, the user has successfully logged in. See this screenshot for a config example: !http://rmartinjak.de/notebooksettings.png
Done in ExtAuthUM's "_user()" |
comment:5
Attachment: trac_11501_ldap_auth.patch.gz they say I have to build ldap 2.13 from source on MacOSX 10.6, otherwise ldap doesn't work. |
comment:6
Replying to @dimpase:
oops, I meant 2.3.13
in its source directory, I was able to get to
after attempting to log in (well, it could well be that the "Bind DN" is set wrongly in my case). by the way, there is obvious typo in the patch in flask_version/authentication.py
we guessed that "'True" should be gone there. |
comment:9
Just by the way, we are currently using this patch (rebased and modified a bit) to do authentication for our Sage-based undergraduate class. Thanks for your work, rmartinjak! Hopefully we can eventually review this and get it into the main notebook codebase (but that will probably take some more discussion). |
comment:10
I'm glad to hear that. Actually, the username normalization to ascii is problematic, as it allows logging in with invalid usernames (i.e. rmärtinjak or rm*rtinjak instead of rmartinjak) I attached a newer class that uses python-ldaps filter_format() method to build valid ldap queries @dimpase: |
Attachment: ldapauth.py.gz |
comment:12
One more thing that we just noticed: our LDAP has case-insensitive login names, resulting in nb creating separate sws directories for, say, user bond007, if he logs in as BOND007, or as Bond007, or as bond07. This has to be a feature of ldapauth, to canonise login names in some way for such LDAP (our is an AD Windows thing). |
Upstream: Reported upstream. Developers acknowledge bug. |
comment:14
This is now basically happening upstream. See this pull request, apparently unrelated to anything here, and the continuation of this material at this fork by rmartinjak. |
comment:15
Correction: the pull request is based on rmartinjak's patch from this ticket, though it was done by someone else (Konstantin Podshumok, who also submitted a nice gettext cleanup and Russian translation). Personally I am wondering what happened to ijstokes's list of concerns, all of which seem very reasonable to me. |
comment:16
Looking at rmartinjak's current "ldap" branch on sagenb, it seems that some of ijstokes's comments have been addressed... |
comment:17
Replying to @kini:
This is true, anything but "3." (ordered list of auth methods) should've been taken care of. |
comment:18
Note from this thread https://groups.google.com/forum/?fromgroups#!topic/sage-support/6DmaZW8cY98 |
comment:19
This is now clearly a duplicate of #14330, or depends on it, or something like that. |
Dependencies: #14430 |
Changed dependencies from #14430 to none |
This comment has been minimized.
This comment has been minimized.
Changed author from Robin Martinjak to none |
Reviewer: Robin Martinjak |
Support (optional) user authentication via LDAP or other external backends.
This will be useful for i.e. universities (especially once the notebook is scalable).
Users should also be able to search for (i.e. when adding collaborators to a ws) that are available but not yet known to sage.
See #14330 instead.
Upstream: Reported upstream. Developers acknowledge bug.
CC: @rkirov @kini @sagetrac-jasonbhill @novoselt
Component: notebook
Keywords: notebook, auth, ldap
Reviewer: Robin Martinjak
Issue created by migration from https://trac.sagemath.org/ticket/11501
The text was updated successfully, but these errors were encountered: