-
-
Notifications
You must be signed in to change notification settings - Fork 585
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 ldap support #815
add ldap support #815
Conversation
Thanks for your work on this, this is my view on your questions:
Some apps I use with LDAP:
Probably no. Local accounts coexisting with LDAP accounts are with exception of some kind of admin account uncommon.
If groups are important part of an app, then it is always nice to have support for LDAP groups.
People which want to use LDAP generally know how to use it, so I would let them configure it. Group base, group name attribute, group search filter, membership attribute and optionally reverse membership attribute (memberof) could do it. Example:
Yes, correct way is to try to bind to LDAP with user credentials.
Some kind of auto cleanup option is nice to have feature, but not without confirmation, or time delay, or other foolproof mechanism.
Again, I would leave that to admin. User search filter should do it all. Example: |
Thanks @army1349 for your input!
Some feedback to your points:
A couple of things can't be added easily, as I am using another library for the groundwork. Especially the group / role transfer for permissions is unclear to me. What I can provide as solution, is mapping LDAP attributes to the user and from there to Kimai groups. |
Glad I can help.
I would not use groupId or gid attribute. Let's split this problem into few smaller ones.
|
@army1349 Could you maybe setup and share such an example configuration as LDIF file? I am missing the knowledge how to administrate an LDAP server or setup such a structure. |
Here is simple example.
|
If this is how it works, then I would leave LDAP groups idea for now. |
Thanks for all your input! I finally found a way to sync all fields on each login (abusing the framework a bit, but who cares, it works), updated the branch and added extensive documentation: https://www.kimai.org/documentation/ldap.html I wouldn't mind some feedback on that. |
Don't mention it. |
@kevinpapst I'm back in the game. I don't know how far you have got but this drupal 8 module https://www.drupal.org/project/ldap uses LDAP to sync users and is written on top of the symfony framework (although not fosuser). The source code is here: https://git.drupalcode.org/project/ldap I'll take a better look today. |
I agree with @army1349, pretty much totally I think Peter's most salient point is LDAP admins tend to know what they are doing, so Kimai could mandate a group name for each of it's roles and we could add a roadmap entry to adding mapping latter if the LDAP uptake seems popular. We don't use the memberOf to include users into groups but instead use memberuid in the group to indicate who is in a given group, e.g.
I've just seen @army1349's comment about fixed names and the answer is yes. ROLE_TEAMLEAD is fixed, https://github.com/kevinpapst/kimai2/blob/master/src/Entity/User.php#L33 If it works with your bundle then expecting a ROLE_TEAMLEAD to be in an LDAP group named |
Not sure that I understand the question. Kimai uses roles exclusively to check permissions while the user is performing tasks. I could add a command that you can use in a cron job, but not in this PR. If it would be a requirement for you to sync roles also in between (e.g. when you configure very long session times or use the "remember me" feature), open up a new feature request later on. @tobybatch thanks, I'll have a look at the Drupal stuff, but I think I am too far with the other bundle. What I documented (see link in the initial posting) should already work.
Hahaha, I hope so! The thing is: I don't in this PR (at least for the LDAP part), thats why I need more input. I don't need exact Kimai role names to be returned, I will leave the mapping as is. So you configure a mapping. This can be As I already added my own query to sync attributes during each login, I can add another search to find the user groups. But I'd need detailed information how that works, including:
I guess for the start you need to be able to define one query for the groups?!?
Please provide as many input as possible! This could be also a working LDIF example and a working config from another software. I should be able to extract the logic from there as well (but words make it even clearer). |
Great work. After last commit with accountFilterFormat not set and: |
Docu updated once again: https://www.kimai.org/documentation/ldap.html @army1349 in that case the initial search will execute |
Why they are two searches and search filters anyway? |
"Internals" - ZendLdap requires one query including the uid=%s for finding the users DN before the bind (user authorization). And I need one without the %s as well for loading the user.
so I though "you are right, fuck it" - the users has to configure it properly once. And I already spent a lot of hours with that (failed) optimization. Some things sound so easy but then they aren't. |
Yeah, I can imagine, just one proposal: |
I have to use the configured "usernameAttribute" to build that. Do you know anything about ADs? |
Yeah, I know few things about AD. It is not that much different from OpenLDAP for basic usage like bind and searches. Just an LDAP implementation with few specifics and own preferred schemas. |
One more "last" try ;-) |
@army1349 your idea was implemented, don't know why it didn't work the last time, probably it was simply too late ;-) And one more time: THANKS FOR ALL YOUR SUPPORT!!!! |
Nice! It is working for me and correct search filter is in logs.
My pleasure gentlemen. We did good :-) |
Ha, 99 comments when it was finished while 99 files were changed: Nice one! Thanks @tobybatch thanks @army1349 ! |
Very nice! |
@kevinpapst Thanks so much for this.I'm also here to support the LDAP stuff if needed. Do you think we could have a 0.9.1 release including the LDAP auth? |
@tobybatch Can't do that right now, as I found out (after merging) that the new ZendLdap package requires the php-ldap extension and therefor Kimail will not install on many systems, as the DLAP package is not included in default installs (my demo server included). I have to find a way around this. |
I'm only building containers against releases at the moment. I could build us a container against a commit I suppose. Let me have a think about the non-composer requirements too. Do we have a list of supported architectures? OSX (obviously). Linux, I guess supporting rpm and deb distros should be enough. Do we try and support windows? |
There are a couple of Kimai users on Arch (pacman?). But its, like Windows, not very high on my priority list. |
@kevinpapst We'll probably wait for the 1.0 release. I can test an arch / debian/ fedora release process if you want me to. I can easily spin up VM for each of those and run from a clean install to running kimai. |
This is normal. If someone wants LDAP functionality, php-ldap extension is required. |
The code works without ldap extension. The problem is that the zend-ldap composer package requires php-zend extension instead of suggesting it. That leads to composer stop the installation if LDAP is not available ... one could use the |
Oh, I see. How about removing zend-ldap from kimai's composer? |
I will try, that would be the easiest way. |
Found a solution which requires a bit more configuration for the initial setup. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. If you use Kimai on a daily basis, please consider donating to support further development of Kimai. |
Description
Documentation can be found at: https://www.kimai.org/documentation/ldap.html
Features:
TODO
How to test
composer install
config/packages/local.yaml
to your needs (see documentation)bin/console cache:clear
Open questions for EVERY reader
If anything else comes to your mind, please share it. This is one of the features I have to develop without having a proper LDAP setup/knowledge, so I am "flying blindly" here and need YOUR input.
Fixes #193
Fixes #795
Fixes #449
Types of changes
Checklist
composer code-check
)