ldap_search(): Search: Bad search filter #680

Closed
opened 2026-02-04 21:49:02 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @tesaorif on GitHub (May 17, 2018).

  • BookStack Version: 0.21.0
  • PHP Version: PHP 7.0
  • MySQL Version: MariaDB 10.0.34
Expected Behavior

Allows AD users to Login via LDAP

Current Behavior

ldap_search(): Search: Bad search filter
ldap_search(): Search: Unable to reach LDAP server

Hey there,

I'm getting multiple error from BookStack when i try to enable the LDAP login option. After enabling the advanced debug option i found out that BookStack wasn't acception my search filters.

Here's my LDAP config :

LDAP_SERVER=192.168.23.110
LDAP_BASE_DN="OU=Section informatique,DC=orinfo,DC=lan"
LDAP_DN="CN=autouser,OU=Users,OU=Section informatique,DC=orinfo,DC=lan"
LDAP_PASS=REDACTED
LDAP_USER_FILTER=(&(uid=${user}))
LDAP_VERSION=3

and a screenshot of the error message :

error

Originally created by @tesaorif on GitHub (May 17, 2018). * BookStack Version: 0.21.0 * PHP Version: PHP 7.0 * MySQL Version: MariaDB 10.0.34 ##### Expected Behavior Allows AD users to Login via LDAP ##### Current Behavior ldap_search(): Search: Bad search filter ldap_search(): Search: Unable to reach LDAP server Hey there, I'm getting multiple error from BookStack when i try to enable the LDAP login option. After enabling the advanced debug option i found out that BookStack wasn't acception my search filters. Here's my LDAP config : LDAP_SERVER=192.168.23.110 LDAP_BASE_DN="OU=Section informatique,DC=orinfo,DC=lan" LDAP_DN="CN=autouser,OU=Users,OU=Section informatique,DC=orinfo,DC=lan" LDAP_PASS=REDACTED LDAP_USER_FILTER=(&(uid=${user})) LDAP_VERSION=3 and a screenshot of the error message : ![error](https://user-images.githubusercontent.com/27957042/40177865-12b99926-59e0-11e8-8bf1-fd054e7500cb.png)
Author
Owner

@albergoniSivaf commented on GitHub (May 17, 2018):

Try this:

"(&(sAMAccountName=${user}))"

@albergoniSivaf commented on GitHub (May 17, 2018): Try this: "(&(sAMAccountName=${user}))"
Author
Owner

@tesaorif commented on GitHub (May 17, 2018):

@albergoniSivaf Thanks for you answer.

I forgot to add the alternative option that i tried in my first comment. Unfortunatelly, i still get the same ldap_search error, even with your recommandation.

@tesaorif commented on GitHub (May 17, 2018): @albergoniSivaf Thanks for you answer. I forgot to add the alternative option that i tried in my first comment. Unfortunatelly, i still get the same ldap_search error, even with your recommandation.
Author
Owner

@albergoniSivaf commented on GitHub (May 17, 2018):

This is my working configuration:

LDAP_SERVER=:389
LDAP_BASE_DN=CN=Users,DC=,DC=local
LDAP_DN=CN=,CN=Users,DC=,DC=local
LDAP_PASS=<myuserquery_password>
LDAP_USER_FILTER="(&(sAMAccountName=${user})(memberof=CN=,CN=Users,DC=,DC=local))"
LDAP_VERSION=false
LDAP_EMAIL_ATTRIBUTE=mail

My AD is build with Samba v4.
BookStack Version: 0.21.0

@albergoniSivaf commented on GitHub (May 17, 2018): This is my working configuration: LDAP_SERVER=<server>:389 LDAP_BASE_DN=CN=Users,DC=<mydomain>,DC=local LDAP_DN=CN=<myuserquery>,CN=Users,DC=<mydomain>,DC=local LDAP_PASS=<myuserquery_password> LDAP_USER_FILTER="(&(sAMAccountName=${user})(memberof=CN=<BookStack Users Group>,CN=Users,DC=<mydomain>,DC=local))" LDAP_VERSION=false LDAP_EMAIL_ATTRIBUTE=mail My AD is build with Samba v4. BookStack Version: 0.21.0
Author
Owner

@tesaorif commented on GitHub (May 18, 2018):

Finally got it working. Even added the option to login by with the email address.

Here's the syntax that i'm using:

LDAP_USER_FILTER=(|(sAMAccountName=${user})(mail=${user}))

@tesaorif commented on GitHub (May 18, 2018): Finally got it working. Even added the option to login by with the email address. Here's the syntax that i'm using: LDAP_USER_FILTER=(|(sAMAccountName=${user})(mail=${user}))
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#680