-
-
Notifications
You must be signed in to change notification settings - Fork 441
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
LDAP authentication error with 3rd party providers #919
Comments
Most of the ldap functionality is contributed. Since I do not use ldap myself I only have a high level understanding of its inner workings. I'm willing to take a look at this, however it would be useful if you can reproduce the issue with verbose logging enabled. Presuming you are on a typical installation, this can be done by adding |
Here's the updated log file with verbose logging enabled via the environment variable. I'm definitely not an expert with LDAP either, but I'll do my best to take another close look at this as well when I get some more free time. I really appreciate your help with this, thank you so much! |
After looking at the log I don't see anything that would suggest a bug in the ldap code, so I suspect there is a configuration issue. The group DN shouldn't be part of the Edit:
This may be a problem if the ldap server can't filter by cn. In this case, authentik will need to extend its filter support to work with Moonraker. |
I went ahead and removed the group DN from I realized that error messages were only being sent along with the HTTP response instead of to the output logs, so I checked the browser console and saw the error was Adding a quick debug message, the ldap3 module throws the error I didn't get the chance to look into exactly where ldap3 tries to validate it and runs into the issue; however, when inputting an invalid username, it does return the appropriate error. I tried adding |
Same error for me for another application (radicale) with authentik. What was the solution, who did you set the attributes in authentik LDAP provider? |
Apologies for the slow response, I've been preoccupied with other projects these past couple weeks. I wasn't able to find any clear documentation on setting custom LDAP attributes for all users, As such, I tried modifying the user and adding the following to the createTimestamp: 20250117114153Z
modifyTimestamp: 20250117114153Z I also tried the date/time format described here; however, I ran into the same exact error both times. I was able to manually perform the LDAP query and saw the attributes were set though: I'm absolutely not an expert in LDAP so take my word with a grain of salt, but my guess is that these attributes have an actual date/time type that ldap3 is expecting in addition to the attributes being present in the first place. As the Authentik LDAP Outpost likely can not/does not set the type simply based on what's set as the custom attributes, ldap3 fails in the same way as when they're not set. As per cannatag/ldap3#1017 (comment), these attributes are mandatory to the schema it expects, and you can't really work around it. There's an open issue to try and get Authentik to support these attributes (goauthentik/authentik#10474), but there hasn't been much movement on it as of writing. |
I've also been having issues that may be related to this issue i am using Active Directory as a backend provider though. I've done some tests with different configuration options enabled and disabled and it seems based on the Moonraker logs the LDAP authentication succeeds. My ldap config:
Logs with config as above:
Logs with bad credentials:
Logs with no group filter:
Seems a bit strange that this issue affects three different LDAP providers, something else change somewhere? Happy to assist with any further testing and provide more logs if required. |
@DanAE111 Your issue does not appear to be the same as described by the OP. I changed the title as its misleading, the The original issue in this post seems to be caused by a third party LDAP provider not supporting the full LDAP spec, thus its an issue with the provider and not Moonraker. As mentioned by BastelBaus, the issue is not exclusive to Moonraker and affects other applications attempting to login with Authentik. Your log snippets indicate that the provider successfully logs in the user, but authentication fails further downstream. My suspicion is that you are attempting to log in with an LDAP user that shares a username with a previously created local user. This would result in an authentication source mismatch and you will need to delete the local user if you want to login to an LDAP user of the same name. I pushed a commit that logs the full exception traceback when verbose logging is enabled (as it appears to be in your snippets). You can update, reproduce the error, then attach the resulting log which should be helpful in further diagnosis. |
@Arksine thanks for the advice you were indeed correct it was because i had an existing local user with the same username i just assumed that because i could select an authentication provider at login the user names clashing wouldn't be an issue. Possibly worth making a note of that in the docs, would avoid silly people like me making similar mistakes in future. I'm happy to submit a PR for updating the docs if you like? |
What happened
Hello! I've gone ahead and configured authentication with LDAP as described in the documentation for Moonraker and Fluidd. Now, whenever I try to sign in using my LDAP credentials, Fluidd shows an "Invalid credentials" error message, and Moonraker's logs show an error 401 with the message "[No User]". I've manually updated Fluidd, Moonraker, and Klipper to the latest versions as described in Fluidd's documentation to no avail.
The LDAP server I'm trying to authenticate through is Authentik's LDAP outpost, which I've verified is working properly through manual queries with the ldapsearch command and by configuring it with another application (OPNsense). I can also see Moonraker properly querying the server in its logs.
Client
Fluidd
Browser
Chrome, Firefox
How to reproduce
Assuming you already have working Moonraker, Fluidd, and Authentik instances:
Setup an LDAP in provider as described here.
AUTHENTIK_HOST
,AUTHENTIK_TOKEN
, andAUTHENTIK_INSECURE
variables provided when viewing the outpost in Authentik.Update
moonraker.conf
, adding a[ldap]
section pointing to the Authentik outpost and updating[authorization]
to force logins and default to LDAP.iam-fluidd
group to authenticate. The issue still occurs without this being declared.Restart Moonraker with
systemctl restart moonraker
. Navigate to your Fluidd instance in your web browser of choice and try signing in using your Authentik/LDAP account credentials.Additional information
moonraker.log - The login attempts are at the very bottom of the file.
moonraker.conf
Relevant logs in the LDAP server
Error message as seen in Fluidd
The text was updated successfully, but these errors were encountered: