-
-
Notifications
You must be signed in to change notification settings - Fork 551
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 fails if using sAMAccountName #2936
Comments
Hello, While googling your error, I found this page https://ldapwiki.com/wiki/Common%20Active%20Directory%20Bind%20Errors |
weird thing. If I use cn as the username with which to bind, change the username attribute to cn and then test the configuration with the following: "firstname" "surname" (theres a space between the two), it succesfully passes. as soon as I change back to samaccountname it fails. @nilsteampassnet the only difference i can see between both of our configs is that you are using OpenLDAP whereas I am using Active Directory. I did read somewhere about issues when the cn and samaccountname's are different, but I cannot seem to find that link again and dont even know if this is a valid reason? |
hi @nilsteampassnet. Do you have any further updates on this? Has anyone got TeamPass 3.0.0.8 working using samAccountName with Active Directory? |
Hello, For the life of me I can get LDAP to work. We have an old version of teampass (2.1.23) and rather than going through the upgrade path, I figured maybe installing the latest version would be better and then just manually transfer the passwords over. Installation of 3.0.0.7 went fine but I can't get LDAP to function. I updated 3.0.0.7 to 3.0.0.8, and while I no longer get the "couldn't connect to LDAP" error, I'm either getting an authentication error or just "in progress" with errors in the apache log. I've tried all sorts of combinations. I can't upload pictures from work, but if I use as the bind user the full distinguished name like for example: Username : CN=sa_ldap,OU=ServiceAccounts,OU=foo,DC=bar,DC=com User name attribute : cn Then in the logs I get:
It adds this double CN=. Tried without, no luck. I must be doing something wrong. Is anyone getting LDAP to work with AD? sAMAccountName does not work as others pointed out. |
Ok I ended up getting the ldap test to pass by doing the same thing as @hitenmandalia with cn as the user attribute and using the first name + last name combo in the test. However when I go to users and do an ldap synchronization, no users get listed? Switching back to sAMAccountName and it no long works. Specifically I get: Error : 49 - Invalid credentials From a quick google search, "data 52e" points to the password being incorrect, even though it is correct since the same test using cn works. Here's the ldap wiki: https://ldapwiki.com/wiki/Common%20Active%20Directory%20Bind%20Errors |
hi @zorgman |
Yeah I have been scratching my head for the past 2 days wondering if I was doing something wrong, clearly this is a bug in teampass. I know 3.0.0.x are still considered beta at this point anyway and probably other things need to be sorted out. I guess we'll stick to good old 2.1.23 for now :) |
@zorgman THis error you get in the log clearly indicates that the query returns nothing. Teampass uses a PHP library for LDAP. It creates a configuration that is sent to this library that performs on its own everything else. Then returns the results to Teampass that analyses them. That's all. |
@zorgman |
Hi @nilsteampassnet, Yes I realized I was using the wrong username to test the configuration. It had been a long day and I wasn't paying attention. sa_ldap is just a service account used to do the ldap queries. However with any other regular user it never works when you use the sAMAccountName as the attribute. The only way the ldap test passes, is when I use the "cn" attribute, as @hitenmandalia pointed out and do the test query with the first and last name of any user, like "Jean Dupond" for example. |
@nilsteampassnet |
I can testify that this pull request is needed. Reason: you can't expect to know how a DN of a user in ldap is built. From the original code it is assumed to be something like uid=login,dc=my,dc=site (just an example). But in many installations the DN is more cn=myname,dc=my,dc=site. So there's always the need to first search the user, get the DN from the resulting entry and then use that to login. |
Not weird at all. In large corporate environments, you can't assume that the people setting up TeamPass also have permission to create and manage groups in Active Directory. So it makes sense to require the account to exist in TeamPass as the master list of authorized users, with the authentication coming from AD. |
Many systems use AD (or LDAP) for auth and if auth succeeds, then create the relevant user in the application (with configurable groups sometimes). Asking to manually create users in teampass is an administrative task that can (and should) be avoided. Only for this behavior alone, we decided against teampass (well, that and in fact the poorly written ldap auth code). |
Then it needs to be an option. You can't assume that your users have permission to create and manage accounts in AD. |
@liedekef What did you end up choosing instead of teampass? |
Just to update this (the original issue) - it seems the LDAP library being used squashes the case of retrieved LDAP attribute names to lowercase, but the given field ('sAMAccountName' in this case) is looked up from the results case sensitively. Workaround here is to use lower case attribute names ('samaccountname' and 'distinguishedname' for Active Directory), but the proper fix will be to lowercase these in the code before looking them up in the LDAP results. I also agree that there should be an option to 'auto-create' LDAP users rather than requiring creation. Ideally this would be via a group (could just be part of the users LDAP filter once #3040 is fixed, possibly by #3118). However I understand from the encryption details that I've stumbled across that this may be problematic - do you have thoughts on this @nilsteampassnet ? The initial encryption key seems to be the stumbling block, but I'm a little hazy on the details. |
After doing the configuration of the LDAP service several times, I identified that the Bug is in the User name attribute, which in the documentation says to put it as sAMAccountName as it is written, but when I copy the way it is written it does not synchronize with AD, by the irony of fate I wrote everything in lower case and saved it synced. so I understood that the BUG is there, it worked in my environment I don't know if it will work in others. |
I got the same error with my active directory sync and solved it. I didn't want to rollback the version of TeamPass only for an error. |
@nilsteampassnet https://teampass.readthedocs.io/en/latest/install/ldap/#more-debug Page on which it happenedindex.php?page=roles Steps to reproduceExpected behaviourTell us what should happen Actual behaviourTell us what happens instead Server configurationOperating system: Linux teampass 5.4.203-1-pve #1 SMP PVE 5.4.203-1 (Fri, 26 Aug 2022 14:43:35 +0200) x86_64 Web server: Apache/2.4.62 (Debian) Database: 10.5.26-MariaDB-0+deb11u2 PHP version: 8.1.29 Teampass version: 3.1.2 Teampass configuration file:
Updated from an older Teampass or fresh install: Client configurationBrowser: Chrome - 128.0.0.0 Operating system: Windows - 64bits LogsWeb server error log
Teampass 10 last system errors
Log from the web-browser developer console (CTRL + SHIFT + i)
|
Take a look to #4243 (comment) |
Steps to reproduce
Expected behaviour
Authentication succeeds
Actual behaviour
Caution
Error : 49 - Invalid credentials
80090308: LdapErr: DSID-0C090453, comment: AcceptSecurityContext error, data 52e, v3839
Server configuration
Operating system:
Alpine Linux
Web server:
Apache
Database:
Amazon Aurora RDS (mysql 5.7)
PHP version:
7.4
Teampass version:
3.0.0.8
Teampass configuration file:
Updated from an older Teampass or fresh install:
PLEASE attach to this issue the file
/includes/config/tp.config.php
.Client configuration
Browser:
Operating system:
Logs
Web server error log
Log from the web-browser developer console (CTRL + SHIFT + i)
The text was updated successfully, but these errors were encountered: