mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-02-05 16:49:47 +03:00
LDAP Setup is nearly impossible #2760
Closed
opened 2026-02-05 05:04:25 +03:00 by OVERLORD
·
15 comments
No Branch/Tag Specified
development
l10n_development
further_theme_development
release
llm_only
vectors
v25-11
docker_env
drawio_rendering
user_permissions
ldap_host_failover
svg_image
prosemirror
captcha_example
fix/video-export
v25.12.3
v25.12.2
v25.12.1
v25.12
v25.11.6
v25.11.5
v25.11.4
v24.11.4
v25.11.3
v25.11.2
v25.11.1
v25.11
v25.07.3
v25.07.2
v25.07.1
v25.07
v25.05.2
v25.05.1
v25.05
v25.02.5
v25.02.4
v25.02.3
v25.02.2
v25.02.1
v25.02
v24.12.1
v24.12
v24.10.3
v24.10.2
v24.10.1
v24.10
v24.05.4
v24.05.3
v24.05.2
v24.05.1
v24.05
v24.02.3
v24.02.2
v24.02.1
v24.02
v23.12.3
v23.12.2
v23.12.1
v23.12
v23.10.4
v23.10.3
v23.10.2
v23.10.1
v23.10
v23.08.3
v23.08.2
v23.08.1
v23.08
v23.06.2
v23.06.1
v23.06
v23.05.2
v23.05.1
v23.05
v23.02.3
v23.02.2
v23.02.1
v23.02
v23.01.1
v23.01
v22.11.1
v22.11
v22.10.2
v22.10.1
v22.10
v22.09.1
v22.09
v22.07.3
v22.07.2
v22.07.1
v22.07
v22.06.2
v22.06.1
v22.06
v22.04.2
v22.04.1
v22.04
v22.03.1
v22.03
v22.02.3
v22.02.2
v22.02.1
v22.02
v21.12.5
v21.12.4
v21.12.3
v21.12.2
v21.12.1
v21.12
v21.11.3
v21.11.2
v21.11.1
v21.11
v21.10.3
v21.10.2
v21.10.1
v21.10
v21.08.6
v21.08.5
v21.08.4
v21.08.3
v21.08.2
v21.08.1
v21.08
v21.05.4
v21.05.3
v21.05.2
v21.05.1
v21.05
v21.04.6
v21.04.5
v21.04.4
v21.04.3
v21.04.2
v21.04.1
v21.04
v0.31.8
v0.31.7
v0.31.6
v0.31.5
v0.31.4
v0.31.3
v0.31.2
v0.31.1
v0.31.0
v0.30.7
v0.30.6
v0.30.5
v0.30.4
v0.30.3
v0.30.2
v0.30.1
v0.30.0
v0.29.3
v0.29.2
v0.29.1
v0.29.0
v0.28.3
v0.28.2
v0.28.1
v0.28.0
v0.27.5
v0.27.4
v0.27.3
v0.27.2
v0.27.1
v0.27
v0.26.4
v0.26.3
v0.26.2
v0.26.1
v0.26.0
v0.25.5
v0.25.4
v0.25.3
v0.25.2
v0.25.1
v0.25.0
v0.24.3
v0.24.2
v0.24.1
v0.24.0
v0.23.2
v0.23.1
v0.23.0
v0.22.0
v0.21.0
v0.20.3
v0.20.2
v0.20.1
v0.20.0
v0.19.0
v0.18.5
v0.18.4
v0.18.3
v0.18.2
v0.18.1
v0.18.0
v0.17.4
v0.17.3
v0.17.2
v0.17.1
v0.17.0
v0.16.3
v0.16.2
v0.16.1
v0.16.0
v0.15.3
v0.15.2
v0.15.1
v0.15.0
v0.14.3
v0.14.2
v0.14.1
v0.14.0
v0.13.1
v0.13.0
v0.12.2
v0.12.1
v0.12.0
v0.11.2
v0.11.1
v0.11.0
v0.10.0
v0.9.3
v0.9.2
v0.9.1
v0.9.0
v0.8.2
v0.8.1
v0.8.0
v0.7.6
v0.7.5
v0.7.4
v0.7.3
0.7.2
v.0.7.1
v0.7.0
v0.6.3
v0.6.2
v0.6.1
v0.6.0
v0.5.0
Labels
Clear labels
🎨 Design
📖 Docs Update
🐛 Bug
🐛 Bug
:cat2:🐈 Possible duplicate
💿 Database
☕ Open to discussion
💻 Front-End
🐕 Support
🚪 Authentication
🌍 Translations
🔌 API Task
🏭 Back-End
⛲ Upstream
🔨 Feature Request
🛠️ Enhancement
🛠️ Enhancement
🛠️ Enhancement
❤️ Happy feedback
🔒 Security
🔍 Pending Validation
💆 UX
📝 WYSIWYG Editor
🌔 Out of scope
🔩 API Request
:octocat: Admin/Meta
🖌️ View Customization
❓ Question
🚀 Priority
🛡️ Blocked
🚚 Export System
♿ A11y
🔧 Maintenance
> Markdown Editor
pull-request
Mirrored from GitHub Pull Request
No Label
🐛 Bug
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/BookStack#2760
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @saschabrockel on GitHub (Apr 24, 2022).
Describe the Bug
Hello there. I have really no idea how the hell this is coded but BookStack is the only app that I can't get working with LDAP for weeks. The documentation if something does not work is horrible. Debugging is simply not possible because it only tells me "malformed utf-8 characters possibly incorrectly encoded" when
LDAP_DUMP_USER_DETAILS=true. It seems like I also need to setAPP_DEBUG=trueto let the message occur. Otherwise, it's just invalid credentials.I mean even with the standard user filter
LDAP_USER_FILTER=(&(uid=${user}))it does not work for me. I got one user filter that works but does not recognize what the user enters and always logs in as the first user in LDAP. Using this default filter just tells me invalid credentials which is not true. I'm using OpenLDAP and the newest Docker Image of BookStack.This user filter does what I told you above:
LDAP_USER_FILTER=(&(|(objectclass=inetOrgPerson))(|(memberof=cn=admin,ou=groups,dc=sascha-brockel,dc=de)(memberof=cn=family,ou=groups,dc=sascha-brockel,dc=de)(memberof=cn=yass,ou=groups,dc=sascha-brockel,dc=de)))MemberOf also seems not to work.
Edit: I tried the following filter now:
LDAP_USER_FILTER=(&(uid=${user})(|(objectclass=inetOrgPerson))(|(memberof=cn=admin,ou=groups,dc=sascha-brockel,dc=de)(memberof=cn=family,ou=groups,dc=sascha-brockel,dc=de)(memberof=cn=yass,ou=groups,dc=sascha-brockel,dc=de)))This now ends up in invalid credentials too.
Steps to Reproduce
Expected Behaviour
Get logged in.
Screenshots or Additional Context
No response
Browser Details
Google Chrome 100.0.4896.88 (64 Bit) on Windows 11
Exact BookStack Version
v22.03.1
PHP Version
No response
Hosting Environment
Docker Container:
lscr.io/linuxserver/bookstack:latest@ssddanbrown commented on GitHub (Apr 24, 2022):
Hi @saschabrockel,
LDAP_USER_FILTERfor your BookStack setup/install?LDAP_USER_FILTERwork when querying the LDAP server manually outside of BookStack, when replacing${user}with a valid uid?@saschabrockel commented on GitHub (Apr 25, 2022):
Hi @ssddanbrown,
I'm setting it as an environment variable in my docker-compose.yml.
What exactly do you mean with outside of BookStack? How to test it? I'm running the same LDAP things with for example NextCloud and Authelia without problems. But the configuration options are clearer.
@ssddanbrown commented on GitHub (Apr 25, 2022):
In that case, could you try using two
$signs instead of one? Like so:And let me know if that works?
I just meant using something like the
ldapsearchcommand to test the same settings from another perspective.Try the change above first though, it's probably that.
@saschabrockel commented on GitHub (Apr 25, 2022):
LDAP_USER_FILTER=(&(uid=$${user}))Nope does not work either sadly. I already tried it.
And that was the strange thing.
@ssddanbrown commented on GitHub (Apr 25, 2022):
Okay,
memberOfwork with OpenLDAP?@saschabrockel commented on GitHub (Apr 25, 2022):
Yes. Like in this manual: https://kifarunix.com/how-to-create-openldap-member-groups/
I've needed to activate it.
The docker image: osixia/openldap:latest
@ssddanbrown commented on GitHub (Apr 25, 2022):
Just to confirm, before I attempt to emulate your environment:
memberofqueries)?docker-compose.ymlconfig?ou=users,dc=sascha-brockel,dc=detree of your LDAP system? Just checking because the admin user in use in your config does not appear to be.@saschabrockel commented on GitHub (Apr 26, 2022):
@ssddanbrown commented on GitHub (Apr 26, 2022):
Okay, just spent a couple of hours on this. I replicated the LDAP side the best I could. I used my local dev bookstack instance though instead of a docker setup, I could attempt using the linuxserver.io image also with a similar config setup (using env_file) but it's late here. Maybe a next step if we don't get further from these findings.
My Setup
My
.envoptions (Not docker-based, BookStack .env file)My OpenLDAP setup
Just a direct use of this compose file, no changes.
My OpenLDAP structure
My Findings
The above functionally works fine for me, including group-sync once I read-up on the classes required in OpenLDAP.
Some notes though:
LDAP_DUMP_USER_DETAILS=falsedoes fail as you reported in some cases, this is likely due to theLDAP_THUMBNAIL_ATTRIBUTE=jpegphotooption. If you remove/comment-out that option then theLDAP_DUMP_USER_DETAILSfunctionality should work again. I've opened #3396 to address this case in the future.osixia/openldap:latestdocker container already hadmemberOfworking, I did not have to do any setup.Next Steps
While doing the above, I came up with the following additional questions and thoughts to diagnose:
uidof the user account? Definitely not the email, CN or some other username? Just want to be sure since by default all of these values would differ by default on OpenLDAP while being similar in some ways.LDAP_THUMBNAIL_ATTRIBUTEand see if the LDAP_DUMP_USER_DETAILS option yields any results.@saschabrockel commented on GitHub (Apr 26, 2022):
Okay sorry to hear that you've spent hours on that. I would have given you everything you need... because I already scripted enough files to exactly recreate the config. We can also have a call if it would help.
So first of all of course I'm using an adjusted
docker-compose-ymlfor OpenLDAP. But interesting that you havememberOfinstantly.The error with

LDAP_THUMBNAIL_ATTRIBUTEcommented andLDAP_DUMP_USER_DETAILS=true:The user I'll try to log in (you can see it is his

uid):I've used the exact same
.envfile now and I do not see any user information that is getting dumped. But of course it is Docker.I really have no idea why. I mean at least something should happen.
LDAP Env Stuff:
Or do I need
APP_DEBUG=trueto be set?@ssddanbrown commented on GitHub (Apr 26, 2022):
No, the data dump should show either way. Are you at least seeing JSON dumped to the screen (With lack of details) or does the option not seem to do anything?
I'll try and find some time later to spin up a linuxserver container to connect with the ldap setup to see if anything else shows up.
@saschabrockel commented on GitHub (Apr 26, 2022):
That's the exact problem. I have never seen anything from it with the exception of the malformed UTF-8 error. Tell me if I can help you in any way.
@ssddanbrown commented on GitHub (Apr 26, 2022):
Okay, Done some more testing, this time using docker for BookStack (via linuxserver.io container).
First of all, My recollection of
LDAP_DUMP_USER_DETAILSwas a bit off above, It will only dump when a user is found (Used more to check the values of a found user), sorry about that.From my testing, I think this may be down to differences in how environment variables are handled between the docker composer
environmentand theenv_fileoptions. I found this by a fair amount of debugging by accessing the bookstack container while it was running and printing vars.I could not get a way to get the user filter working in the
env_filebut if you move this option (Only need to do this single option due to its syntax) to theenvironmentpart of your docker-compose then things should work. Still need double-$here though. Here's a snippet from mydocker-comose.ymlas an example:I think this different in handling has already been reported to docker under these issues:
Can you give that config change a try and let me know how it goes?
@saschabrockel commented on GitHub (Apr 27, 2022):
Oh, my goooood... I remember this bullshit... I'm sorry for wasting your time. This bug exists for years. On my work, I had the same problem with Spring Boot variables years ago with Docker and now I remember... it works now... so it is not your fault. Neither mine but yea...
Even my own complicated filter above works now. Maybe you should give a hint in the documentation for that problem and also link the issue of docker-compose... thank you very much for your effort! I can also tell that dump user worked instantly.
So the solution is: just put in the
docker-compose.ymlenvironment part and not in theenv_file:Even this works:
@ssddanbrown commented on GitHub (Apr 27, 2022):
@saschabrockel No worries, I'm just happy we found the issue and got things going!
We already had a note on that option for docker-compose regarding the double-dollar, but I've now updated the docs with an extra line just to say it cannot be used with the
env_fileoption.