Windows AD Authentication #752

Closed
opened 2026-02-04 22:10:13 +03:00 by OVERLORD · 8 comments
Owner

Originally created by @FelisWei on GitHub (Jul 19, 2018).

For Bug Reports

Windows AD:Server 2012
BookStack Version:v0.22.0
PHP Version: 7.2.7 ubuntu 18.04.2
MySQL Version:5.7.22

Expected Behavior

Logging in with windows AD credentials

Current Behavior

ErrorException (E_WARNING)
ldap_bind(): Unable to bind to server: Invalid credentials

LDAP settings
AUTH_METHOD=ldap
LDAP_SERVER=ip:389
LDAP_BASE_DN=DC=xxx-xxx,DC=com
LDAP_DN=cn=1234,DC=xxx-xxx,DC=com
LDAP_PASS=xxxxxx
LDAP_USER_FILTER=(&(sAMAccountName=${user}))
LDAP_VERSION=3
LDAP_EMAIL_ATTRIBUTE=mail

bookstack_20180719_095749

Originally created by @FelisWei on GitHub (Jul 19, 2018). ##### For Bug Reports Windows AD:Server 2012 BookStack Version:v0.22.0 PHP Version: 7.2.7 ubuntu 18.04.2 MySQL Version:5.7.22 ##### Expected Behavior Logging in with windows AD credentials ##### Current Behavior ErrorException (E_WARNING) ldap_bind(): Unable to bind to server: Invalid credentials ##### LDAP settings ``` AUTH_METHOD=ldap LDAP_SERVER=ip:389 LDAP_BASE_DN=DC=xxx-xxx,DC=com LDAP_DN=cn=1234,DC=xxx-xxx,DC=com LDAP_PASS=xxxxxx LDAP_USER_FILTER=(&(sAMAccountName=${user})) LDAP_VERSION=3 LDAP_EMAIL_ATTRIBUTE=mail ``` ![bookstack_20180719_095749](https://user-images.githubusercontent.com/22385478/42917073-90653188-8b3a-11e8-9644-7d59a7be2848.jpg)
OVERLORD added the 🐕 Support label 2026-02-04 22:10:13 +03:00
Author
Owner

@vparmeland commented on GitHub (Jul 24, 2018):

Hi !

Have you try your user password first ?
ldapsearch -xLL -b DC=yourdomain,DC=local -h dc1.yourdomain.local -D username@yourdomain.local -W

@vparmeland commented on GitHub (Jul 24, 2018): Hi ! Have you try your user password first ? `ldapsearch -xLL -b DC=yourdomain,DC=local -h dc1.yourdomain.local -D username@yourdomain.local -W`
Author
Owner

@FelisWei commented on GitHub (Jul 31, 2018):

Hi:
after I enter LDAP password,

Enter LDAP Password:
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
@FelisWei commented on GitHub (Jul 31, 2018): Hi: after I enter LDAP password, ``` Enter LDAP Password: ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1) ```
Author
Owner

@vparmeland commented on GitHub (Aug 2, 2018):

Hi Felis,

You have your reason here....

First, can you ping your ldap IP ?

  • No, your ldap isn't available

  • Yes, Retry to fix your credentials

In my last reply, this command prompt is to try if you can connect to your LDAP

Have you try your user password first ?
ldapsearch -xLL -b DC=yourdomain,DC=local -h dc1.yourdomain.local-D username@yourdomain.local -W

@vparmeland commented on GitHub (Aug 2, 2018): Hi Felis, You have your reason here.... First, can you ping your ldap IP ? - No, your ldap isn't available - Yes, Retry to fix your credentials In my last reply, this command prompt is to try if you can connect to your LDAP > Have you try your user password first ? ldapsearch -xLL -b DC=yourdomain,DC=local -h dc1.yourdomain.local-D username@yourdomain.local -W
Author
Owner

@FelisWei commented on GitHub (Aug 3, 2018):

Hi,
Yes, the ping has respond.
Does any php component I don't install?
If OU name have chinese character, does it work?
Thanks.

@FelisWei commented on GitHub (Aug 3, 2018): Hi, Yes, the ping has respond. Does any php component I don't install? If OU name have chinese character, does it work? Thanks.
Author
Owner

@vparmeland commented on GitHub (Aug 3, 2018):

Felis,

Maybe OU Name yes ... Can you send a dummy example of your command prompt

@vparmeland commented on GitHub (Aug 3, 2018): Felis, Maybe OU Name yes ... Can you send a dummy example of your command prompt
Author
Owner

@FelisWei commented on GitHub (Aug 7, 2018):

Hi I fix the ldapsearch command probleum, it's about OU name, lost a space.
Here is my command prompt

ldapsearch -xLL -b OU=行政,OU=興興科技,DC=sss,DC=com -h sss-dc7.sss.com-D 67671@sss.com -W

But how to set up .env file?

# The base DN from where users will be searched within.
LDAP_BASE_DN=DC=sss,DC=com

# The full DN and password of the user used to search the server
# Can both be left as false to bind anonymously
LDAP_DN=cn=張家祝,OU=行政,OU=興興科技,DC=sss,DC=com
LDAP_PASS=123456

# A filter to use when searching for users
# The user-provided user-name used to replace any occurrences of '${user}'
LDAP_USER_FILTER=(&(sAMAccountName=${user}))
@FelisWei commented on GitHub (Aug 7, 2018): Hi I fix the ldapsearch command probleum, it's about OU name, lost a space. Here is my command prompt ldapsearch -xLL -b OU=行政,OU=興興科技,DC=sss,DC=com -h sss-dc7.sss.com-D 67671@sss.com -W But how to set up .env file? ``` # The base DN from where users will be searched within. LDAP_BASE_DN=DC=sss,DC=com # The full DN and password of the user used to search the server # Can both be left as false to bind anonymously LDAP_DN=cn=張家祝,OU=行政,OU=興興科技,DC=sss,DC=com LDAP_PASS=123456 # A filter to use when searching for users # The user-provided user-name used to replace any occurrences of '${user}' LDAP_USER_FILTER=(&(sAMAccountName=${user})) ```
Author
Owner

@vparmeland commented on GitHub (Aug 26, 2018):

Hey Felis,

In .env file take care of this line

# General auth
AUTH_METHOD=ldap

# LDAP Settings
LDAP_SERVER=false
LDAP_BASE_DN=false
LDAP_DN=false
LDAP_PASS=false
LDAP_USER_FILTER=false
LDAP_VERSION=false
# Do you want to sync LDAP groups to BookStack roles for a user
LDAP_USER_TO_GROUPS=false
# What is the LDAP attribute for group memberships
LDAP_GROUP_ATTRIBUTE="memberOf"
# Would you like to remove users from roles on BookStack if they do not match on LDAP
# If false, the ldap groups-roles sync will only add users to roles
LDAP_REMOVE_FROM_GROUPS=false

You can find on github the
.env.example

And use APP_DEBUG=true to find error quickly

@vparmeland commented on GitHub (Aug 26, 2018): Hey Felis, In .env file take care of this line `# General auth` `AUTH_METHOD=ldap` `# LDAP Settings` `LDAP_SERVER=false` `LDAP_BASE_DN=false` `LDAP_DN=false` `LDAP_PASS=false` `LDAP_USER_FILTER=false` `LDAP_VERSION=false` `# Do you want to sync LDAP groups to BookStack roles for a user` `LDAP_USER_TO_GROUPS=false` `# What is the LDAP attribute for group memberships` `LDAP_GROUP_ATTRIBUTE="memberOf"` `# Would you like to remove users from roles on BookStack if they do not match on LDAP` `# If false, the ldap groups-roles sync will only add users to roles` `LDAP_REMOVE_FROM_GROUPS=false` You can find on github the [**.env.example**](https://github.com/BookStackApp/BookStack/blob/master/.env.example) And use APP_DEBUG=true to find error quickly
Author
Owner

@ssddanbrown commented on GitHub (Nov 24, 2018):

Since the last comment on this issue is relatively old I'm going to close this. If the issue remains and is something you still require to be fixed please comment and this can be reopened if required.

@ssddanbrown commented on GitHub (Nov 24, 2018): Since the last comment on this issue is relatively old I'm going to close this. If the issue remains and is something you still require to be fixed please comment and this can be reopened if required.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#752