LDAP Logins not working
Expected Behavior (or desired behavior if a feature request)
Ability to log into users imported from LDAP.
Actual Behavior
The users and emails etc all synchronize correctly, but you cannot log into any of the imported accounts (after enabling them).
In the LDAP admin panel, when running "Test LDAP Sync", this comes up: Connection to LDAP server established!
However, just below it, running "Test LDAP Login", I get the message "Login Failed. barntzen did not successfully bind to LDAP."
Additionally, when attempting to login to a valid LDAP user, this appears in the Laravel log: production.ERROR: There was an error authenticating the LDAP user: Could not find user in LDAP directory
Please confirm you have done the following before posting your bug report:
- [x] I have enabled debug mode
- [X] I have read checked the Common Issues page
Provide answers to these questions:
- Is this a fresh install or an upgrade? Fresh
- Version of Snipe-IT you're running - v4.1.11-pre - build 3307 (master)
- Version of PHP you're running - php5.6-fpm (5.6.33-3+ubuntu16.04.1+deb.sury.org+1)
- Version of MySQL/MariaDB you're running - mysqld Ver 5.7.21-0ubuntu0.16.04.1 for Linux on x86_64 ((Ubuntu))
- What OS and web server you're running Snipe-IT on - Ubuntu 16.04 + nginx version: nginx/1.10.3
- What method you used to install Snipe-IT (install.sh, manual installation, docker, etc) - Git
- WITH DEBUG TURNED ON, if you're getting an error in your browser, include that error
- What specific Snipe-IT page you're on, and what specific element you're interacting with to trigger the error - http://foo.bar.com/admin/ldap
- If a stacktrace is provided in the error, include that too. - N/A
- Any errors that appear in your browser's error console. - None
- Confirm whether the error is reproducible on the demo: https://snipeitapp.com/demo. - N/A
- Include any additional information you can find in
storage/logsand your webserver's logs. - Included above - Include what you've done so far in the installation, and if you got any error messages along the way. - Install completed, added a bunch of assets
- Indicate whether or not you've manually edited any data directly in the database - No
My LDAP Settings
LDAP Integration: Yes, checked and enabled Active Directory: No, unchecked LDAP Password Sync: Yes, checked and enabled
Active Directory domain: bar.com.au LDAP Server: ldaps://foo.bar.com.au Use TLS: No, unchecked LDAP SSL certificate validation - Allow invalid SSL Certificate: Yes, checked and enabled
LDAP Bind Username: cn=bind,ou=services,dc=bar,dc=com,dc=au
LDAP Bind Password:
LDAP Filter: &(objectClass=posixAccount) Username Field: uid Last Name: sn LDAP First Name: givenname
LDAP Authentication query: uid= LDAP Version: 3 LDAP Active Flag: null LDAP Employee Number: null LDAP Email: mail
I have something weird - Distinguished Name: cn=Benjamin Arntzen,ou=users,dc=bar,dc=com,dc=au
Maybe it's finding cn, not uid? or something
I've tried the following as LDAP Authentication query:
- uid
- uid=
- uid=uid
- cn
- cn=
- cn=cn
I tried setting "Username Field" to cn and LDAP Authentication Query to "cn=" and that did not help (using either full name "Benjamin Arntzen" or username "barntzen")
WTF.
I tried the CN trick again - set "Username Field" to cn and LDAP Authentication Query to "cn=", then tried to log in as "Benjamin Arntzen" and it worked. I can authenticate cleanly and it seems to work.
This is unfortunately not a full solution - I need to be able to auth using username. However it does show that LDAP at least sort-of-works.
I had a similar issue to this when I was setting it up. You need to check the ' This is an Active Directory server' box. It's kind of confusing because it doesn't mean that the current server Snipe-IT is on is an Active Directory server. The checkbox is asking if the server you are connecting to is an Active Directory server vs an LDAP server. Confusing but give it a try. Also, I have LDAP Authentication query set to 'sAMAccountName=', not sure if you'll need to change that too.
I'm using OpenLDAP, not Active Directory.
@blackrandom this resolved the issue for me, thank you.
@Zorlin Hi,
I have tried you CN trick but it doesn't work for me :/ I'm using OpenLDAP.
LDAP Filter -> &(objectClass=posixAccount) Username Field -> cn LDAP Authentication query -> cn=
Connection test is successful Test LDAP Sync -> Connection to LDAP server established!
But the second test has failed Test LDAP Login -> ldap_search(): Search: No such object Pretty weird error message :) If I'm using a incorrect password -> Login Failed. Louis PARROUY did not successfully bind to LDAP.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions!
I tried the CN trick again - set "Username Field" to cn and LDAP Authentication Query to "cn=", then tried to log in as "Benjamin Arntzen" and it worked. I can authenticate cleanly and it seems to work.
This is unfortunately not a full solution - I need to be able to auth using username. However it does show that LDAP at least sort-of-works.
This is my first installation, using 4.6.15. I'm running into the same exact problem: I can't use 'uid'/'uid=' as username/auth query for logging in, while using 'cn'/'cn=' works. Similarly, this is suboptimal, as I can't expect our users to type in their full names to log in.
We're using openLDAP as our LDAP service.
I'm having a similar problem using OpenLDAP.
For some reason, I'm binding, but it's not returning correctly.
Is there any kind of debug logging I can enable for SnipeIT's LDAP features?
I'm also trying to figure out how to debug the LDAP so that I can figure out what's wrong, as I have this exact error. Enabling debug in .env doesn't seem to do it, and the logs are not helpful.
Not sure if this is related but we too have OpenLDAP. I managed to get it working after few hours debugging the code. I am shouting at the screen very loudly right now.
APP_LOG_LEVEL=debug is a must have setting for this.
Problem 1: BaseDN
I am not using LDAP sync. I want only to authenticate the user via LDAP and create the local account record JIT style during first login.
Normal LDAP access usually looks something like this:
- Bind to directory using service account
- Find user object in BaseDN subtree
- Bind using the DN of that object
- Do anything else
SnipeIT does this:
-
Binds to the directory using
Username Field+=+username+Base Bind DNFor example: If you have user
uid=user,ou=abc,dc=xyzand you only specify basedn =dc=xyzit won't authenticate -> You have to specify the exact parent object where your user are stored. Forget searching the LDAP database from the top. -
Searches for the the object using the filter:
LDAP Authentication query+username
Problem 2: Attributes must be in lowercase
LDAP attribute names are converted to the lowercase for some reason! Try setting givenName (which is correct attribute name) as your LDAP First Name. It won't find it. You have to set givenname as your LDAP First Name.
Yea docs says it but it could explain why because this behavior is kind of unique:
In most cases, all attribute values you enter should be all lowercase
@MichalMMac how were you able to get this working? I am running into the same issue where the only way to get to the LDAP search is to "login" with "First Last" as opposed to username.
Please try the following settings. I hope this help you guys.
I tried the all the above methods,but didn't work
Is there anybody found the solutions?
I am still struggling with this. I use zimbra, and I can login to seafile, nextcloud just fine. But for this one it's really difficult, ldapt test works, but users won't bind.
I am trying to use email as login. this is my config

Any pointers?
Actually I managed to make it work, but only with uid... I want to use emails

Another issue I have is that I only want to allow login for (zimbraIsAdminAccount=TRUE), again, this works well as a filter, the test ldap connection works fine, but it won't allow login, even if I add it to what is currently working.