-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Can't import the User from Microsoft Active Directory #3186
Comments
I can imagine that the problem sits behind what you marked red. |
I had only covered it in red for data protection reasons. I have therefore attached my user to you as a log. In any case, there are currently only 2 users in the group, i.e. no users are currently synchronized. Only the admin user is created. complete log: [2024-10-15 14:44:45,070] WARN {cps.admin:1661} LDAP User: CN=Unzen, Phillip,OU=LDAP-Benutzer,OU=Benutzer,DC=phillipde,DC=local Not Found the target username is the SAMAccountname: phillip.unzen But the log show the DN from the user... |
Hey, I've been playing around with the "Member User Filter" a bit. If I set the filter to "distingushedName=%s" here, then I get the following error message: Could Not Parse LDAP User: CN=Unzen, Phillip,OU=LDAP-Benutzer,OU=Benutzer,DC=phillipde,DC=local |
I find the previous Yesterday's message that the user was not found in the database can be a bit strange. The user is supposed to be created, and therefore cannot exist yet... |
Hi @phillipunzen , It's been a few years since I set this up, so I'm not sure if this is your issue or not... In my setup which also authenticates against Active Directory, I have LDAP Member User Filter set to: |
Hey @joed96! So that I can compare mine once? I just tried it again with the Samaccount name, unfortunately without success... Error Message: "Could not parse LDAP-User: |
Hi @phillipunzen, Sorry, I was going back through my system and although I can authenticate existing users, it looks like I can no longer import users from LDAP - I'm getting the same error as you are. Looking at the code, off hand, I can't really see how I ever imported users successfully. My initial read, could be wrong through... It looks like calibre-web is trying to look up the members of the group, and then look up the user details. The problem, I think, is in this block of if '=' in user:
# if member object field is empty take user object as filter
if config.config_ldap_member_user_object:
query_filter = config.config_ldap_member_user_object
else:
query_filter = config.config_ldap_user_object
try:
user_identifier = extract_user_identifier(user, query_filter) I'll try to get some time to look more closely at this, but off hand I'm not seeing a way to get around this in config (but I'll be happy to be proven wrong :)). @OzzieIsaacs, to try to answer your earlier question, the username displayed in Phillip's output looks right for AD, we need this string unaltered so that we can go lookup the username and/or other user details. This should look like:
|
Okay nice for your work! Tell me if i can help. |
Hi, The basic issue above is that that both @phillipunzen and I have characters in the user's name that are not catered to by the regex in Option 1: Simply extend the regex in Option 2 (recommended): Allow the configuration to leave the entire DN (e.g. if 'distinguishedName' in config.config_ldap_member_user_object:
### Logic for AD
user_identifier = user
query_filter = config.config_ldap_member_user_object
elif '=' in user:
### as is
else:
### as is In this case, the LDAP configuration for AD users would look something like:
I'd like to recommend Option 2 as it avoids having to rely on the extraction logic, so should be more robust across a wider variety of use cases, but is trying to be a low risk change by keeping the existing logic for anyone not trying to match the user by DN. @OzzieIsaacs , if you're happy with this conceptually, I'll be happy to submit a PR if that's helpful. Please let me know your thoughts. |
Nice work @joed96! |
I understand the problem, and I can reproduce it with my test setup. My preferred option is to extend the regex (Umlauts and Unicodes are working, just the special characters are the problem). As my fear it the next one will come and in the end it turns out he uses the magic string "distinguishedName" in some other context. I agree with you, we would need to add every special character we know. I ended up using: I think we need to invert the regex, matching: everything till end of string or an unescaped ",". I need to think on it(meaning google and chatgpt need to find an answer to this) |
Looks good, l‘ll try to fix it till end of the week |
Sounds great, thank you very much for your help! |
Please try the newest nightly version |
Hey @OzzieIsaacs, I used the linuxserver.io Image from Docker-Hub. |
Maybe it needs some time for them to update |
To update the container or the app in the container? I hope the maintainer can fast update the image... |
Don‘t ask me this docker stuff, I don‘t know |
Hi @OzzieIsaacs, The update resolves the ldap user import issues I was having, though of course I'll defer to @phillipunzen as it's his issue report. One thing I noticed is that I'm receiving the following on the console now, that I wasn't previously. I'm running by cloning the master branch.
It's certainly not relevant to this thread, but just mentioning in case there were any recent changes in this part of the code. |
You can probably disregard that warning. I restarted calibre-web and the warning did not recur, and the previously build I was using had the most recent check-in on that file. Not sure what happened there. |
Unfortunately, I can't get the patch updated in the container. Even restarting the container didn't help here... Unfortunately, I can't test the "update" right now... |
I wanted to let you know that there have been 2 updates of the image in the meantime. Unfortunately still the same problem... [2024-11-03 19:31:07,218] WARN {cps.admin:1661} LDAP User: CN=Unzen, Phillip,OU=LDAP-Benutzer,OU=Benutzer,DC=phillipde,DC=local Not Found |
Hi Phillip,
Can you share the full version tag of the two new docker images you’ve tried?
Thanks,
Joe
|
Sorry, i have didn't see your Message @joed96! Errormessage: [2024-11-18 07:29:26,014] WARN {cps.admin:1676} LDAP User: CN=Unzen, Phillip,OU=LDAP-Benutzer,OU=Benutzer,DC=phillipde,DC=local Not Found |
Describe the bug/problem
A clear and concise description of what the bug is. If you are asking for support, please check our Wiki if your question is already answered there.
To Reproduce
Steps to reproduce the behavior:
Logfile
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
Environment (please complete the following information):
Additional context
Add any other context about the problem here. [e.g. access via reverse proxy, database background sync, special database location]
The text was updated successfully, but these errors were encountered: