Bookstack ldap long login times #4833

Closed
opened 2026-02-05 09:19:23 +03:00 by OVERLORD · 10 comments
Owner

Originally created by @Jeffrey-FB on GitHub (Jun 24, 2024).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

Hi there

I have Bookstack running in AWS. Using the script to build it.
My AD is place on pre in our office. We have loads of other services running this way with out issues.
Using windows server Active Directory for Auth

I'm using

AUTH_METHOD=ldap
LDAP_SERVER=my.domain.com:389
LDAP_USER_FILTER=(&(sAMAccountName={user}))
LDAP_VERSION=3
LDAP_ID_ATTRIBUTE=BIN;objectGUID
LDAP_EMAIL_ATTRIBUTE=mail
LDAP_DISPLAY_NAME_ATTRIBUTE=cn
LDAP_START_TLS=false

Users can login, they take about an min to login if first time.
After that it varies how long the login process with take.
Sometimes is milli seconds other times it back to 1 min to login.
Currently there are only a handful of us using it, this should be a performance issues.

This has only started happening since setting up ldap.
Before the default/local accounts was milli seconds.

I don't see anything in any of the logs with APP_DEBUG=true

Help, thoughts on troubleshooting?

Exact BookStack Version

v24.05.2

Log Content

No response

Hosting Environment

Ubuntu Install script
Ubuntu 22.04
PHP8.3
Apache2.4.58

Originally created by @Jeffrey-FB on GitHub (Jun 24, 2024). ### Attempted Debugging - [X] I have read the debugging page ### Searched GitHub Issues - [X] I have searched GitHub for the issue. ### Describe the Scenario Hi there I have Bookstack running in AWS. Using the script to build it. My AD is place on pre in our office. We have loads of other services running this way with out issues. Using windows server Active Directory for Auth I'm using ``` AUTH_METHOD=ldap LDAP_SERVER=my.domain.com:389 LDAP_USER_FILTER=(&(sAMAccountName={user})) LDAP_VERSION=3 LDAP_ID_ATTRIBUTE=BIN;objectGUID LDAP_EMAIL_ATTRIBUTE=mail LDAP_DISPLAY_NAME_ATTRIBUTE=cn LDAP_START_TLS=false ``` Users can login, they take about an min to login if first time. After that it varies how long the login process with take. Sometimes is milli seconds other times it back to 1 min to login. Currently there are only a handful of us using it, this should be a performance issues. This has only started happening since setting up ldap. Before the default/local accounts was milli seconds. I don't see anything in any of the logs with APP_DEBUG=true Help, thoughts on troubleshooting? ### Exact BookStack Version v24.05.2 ### Log Content _No response_ ### Hosting Environment Ubuntu Install script Ubuntu 22.04 PHP8.3 Apache2.4.58
OVERLORD added the 🐕 Support label 2026-02-05 09:19:23 +03:00
Author
Owner

@Jeffrey-FB commented on GitHub (Jun 25, 2024):

Hi All

I really need to get this working, took me 3 mins last time to log.
I cannot find anything in the logs or it's not logging correctly.
How can i troubleshoot this?

Any help would be appreciated

@Jeffrey-FB commented on GitHub (Jun 25, 2024): Hi All I really need to get this working, took me 3 mins last time to log. I cannot find anything in the logs or it's not logging correctly. How can i troubleshoot this? Any help would be appreciated
Author
Owner

@Jeffrey-FB commented on GitHub (Jun 25, 2024):

Changed a few setting which helped a little bit but still can take up to 2 mins to login for a returning user.
now using
LDAP_SERVER=ldaps://my.domain.com:636
And removed tls
#LDAP_START_TLS=false

What else could i try?

@Jeffrey-FB commented on GitHub (Jun 25, 2024): Changed a few setting which helped a little bit but still can take up to 2 mins to login for a returning user. now using `LDAP_SERVER=ldaps://my.domain.com:636` And removed tls `#LDAP_START_TLS=false` What else could i try?
Author
Owner

@ssddanbrown commented on GitHub (Jun 25, 2024):

If you repeatedly log in and out, does the login time continue to vary? If so, what does that pattern roughly look like?
Or is it just the first login that's slow?

@ssddanbrown commented on GitHub (Jun 25, 2024): If you repeatedly log in and out, does the login time continue to vary? If so, what does that pattern roughly look like? Or is it just the first login that's slow?
Author
Owner

@Jeffrey-FB commented on GitHub (Jun 26, 2024):

Hey @ssddanbrown

There doesn't seem to be a pattern.
In google if i log out and then back in, most times it's pretty quick.
If I've been using bookstack a while then sign out, it'll take a while to log back in.
If i close the browser down it's a long login every time.

Firefox seems to take long every time.
As does Microsoft edge.

This is all with the same user account.

Thoughts, more troubleshooting options?

@Jeffrey-FB commented on GitHub (Jun 26, 2024): Hey @ssddanbrown There doesn't seem to be a pattern. In google if i log out and then back in, most times it's pretty quick. If I've been using bookstack a while then sign out, it'll take a while to log back in. If i close the browser down it's a long login every time. Firefox seems to take long every time. As does Microsoft edge. This is all with the same user account. Thoughts, more troubleshooting options?
Author
Owner

@ssddanbrown commented on GitHub (Jun 26, 2024):

  • What AWS service(s) are you using to host BookStack?
  • How does BookStack reach your AD system in office (tunnels, vpn, proxies)?

If possible, you could test the connection directly on the host system using the ldapsearch command, just to check a non-bookstack method from the same host.

@ssddanbrown commented on GitHub (Jun 26, 2024): - What AWS service(s) are you using to host BookStack? - How does BookStack reach your AD system in office (tunnels, vpn, proxies)? If possible, you could test the connection directly on the host system using the `ldapsearch` command, just to check a non-bookstack method from the same host.
Author
Owner

@Jeffrey-FB commented on GitHub (Jun 27, 2024):

Hey @ssddanbrown

  • Bookstack is an EC2 instance
  • It's connected via our VPC

We have other services in AWS that all communicate with our AD servers on perm.
i.e I can ping my AD server
I have configured realm with `realm discover' I can connect to my bookstack server with sshd using my AD credentials.

I've not really used ldapsearch before. I might need a little help with this one?
I've tried one of these examples
ldapsearch -H ldap://<server_name>:389 -D "<distinguished_name>" -w <password> -b "<search_base>" -s <scope> <filter>
This is what i get in return
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)

I'll endeavor to get this working while i wait for a reply from you.
Will post my progress, let me know if there is anything else you want me to try?

@Jeffrey-FB commented on GitHub (Jun 27, 2024): Hey @ssddanbrown - Bookstack is an EC2 instance - It's connected via our VPC We have other services in AWS that all communicate with our AD servers on perm. i.e I can ping my AD server I have configured realm with `realm discover' I can connect to my bookstack server with sshd using my AD credentials. I've not really used ldapsearch before. I might need a little help with this one? I've tried one of these examples `ldapsearch -H ldap://<server_name>:389 -D "<distinguished_name>" -w <password> -b "<search_base>" -s <scope> <filter>` This is what i get in return `ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)` I'll endeavor to get this working while i wait for a reply from you. Will post my progress, let me know if there is anything else you want me to try?
Author
Owner

@Jeffrey-FB commented on GitHub (Jun 27, 2024):

Okay so i followed this guide

So now I have ldap and ldaps working with ldapsearch
Both return instantly on the terminal.

FYI ping results icmp_seq=1 ttl=124 time=1.73 ms

No change to login times on Bookstack.
What do we try next?

@Jeffrey-FB commented on GitHub (Jun 27, 2024): Okay so i followed this guide [](https://medium.com/@pedrodev/connect-your-linux-server-with-active-directory-e707410d1e59) So now I have ldap and ldaps working with ldapsearch Both return instantly on the terminal. FYI ping results `icmp_seq=1 ttl=124 time=1.73 ms` No change to login times on Bookstack. What do we try next?
Author
Owner

@Jeffrey-FB commented on GitHub (Jun 27, 2024):

Okay i figured out what the problem was.
I was pointing to our domain for ldap my.domain.com
But we have multiple serving other regions
I've change it to hostname.my.domain.com and this has resolved the delay in login.

Now how do i add a 2nd ldap server in my .env for redundancy?

@Jeffrey-FB commented on GitHub (Jun 27, 2024): Okay i figured out what the problem was. I was pointing to our domain for ldap my.domain.com But we have multiple serving other regions I've change it to hostname.my.domain.com and this has resolved the delay in login. Now how do i add a 2nd ldap server in my .env for redundancy?
Author
Owner

@ssddanbrown commented on GitHub (Jun 27, 2024):

@Jeffrey-FB Good to hear you found the cause! Will therefore close this off.

Now how do i add a 2nd ldap server in my .env for redundancy?

We don't specifically support/handle/test redundancy. PHP has some level of support built in (but I'm not sure on the full extent or handling of this) which I think you might be able to use via something like this:

LDAP_SERVER="ldaps://my.domain.com:636 ldaps://my.other.domain.com:636"

But again that's not something I've tested.

@ssddanbrown commented on GitHub (Jun 27, 2024): @Jeffrey-FB Good to hear you found the cause! Will therefore close this off. > Now how do i add a 2nd ldap server in my .env for redundancy? We don't specifically support/handle/test redundancy. PHP has some level of support built in (but I'm not sure on the full extent or handling of this) which I think you might be able to use via something like this: ```bash LDAP_SERVER="ldaps://my.domain.com:636 ldaps://my.other.domain.com:636" ``` But again that's not something I've tested.
Author
Owner

@Jeffrey-FB commented on GitHub (Jun 28, 2024):

That looks to be working, i can still login with adding that.
That's for all the help.

@Jeffrey-FB commented on GitHub (Jun 28, 2024): That looks to be working, i can still login with adding that. That's for all the help.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#4833