Improve ldap certificate ignoring#17723
Merged
snipe merged 6 commits intogrokability:developfrom Aug 27, 2025
Merged
Conversation
Member
|
This looks good so far! Looks like this breaks the LDAP unit tests tho. |
Member
|
I'm getting an error when I manually try the LDAP sync on the user's page, but I can't quite tell if that's from something I added in my last PR or if it's something here. The |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've never liked the way that we ignore certificate validity for LDAP in Snipe-IT. We have historically used the
putenv("LDAPTLS_REQCERT=never");mechanism, which just feels a little gross. But more importantly, I think it has been either flaky or just completely non-functional for a lot of Windows users. So this is an attempt to try and switch us over to using the "new-style" way of doing it (it's not actually that new, it dates back to PHP 7.0).I debated which way to make this change, and ended up going with what I'm calling the "double-barreled" strategy - I set the env var and also use the new-style setting to force the certificate ignoring. This worked fine in my testing - I had been worried that the two methods might interfere with each other, but I didn't see any evidence of that.
In the process of doing all of that, I leaned on the LDAP troubleshooter pretty heavily to make sure the new certificate-validity-ignoring code was working right. And, in the process, I fixed a lot of stuff that was partially done or not-done-at-all in the LDAP troubleshooter:
->line()way of doing output, so the more important results would 'pop' out a little better.STARTTLSenabled but certificate checks disabled - we missed that before.Additionally, for when we use the "Test LDAP Synchronization" button, I made it so that all errors return as a 400 instead of a 500, so we can actually get some useful troubleshooting information. (One example I saw very quickly - if you try to use
STARTTLSon an already encrypted connection - now you get a better error message).So this change is a little scary - we have been doing the validity-ignoring the "old" way for quite a few years now, and changing it definitely makes me a little nervous. But I think this fix lines up with some of the problems I've seen our users having with ignoring certificate validity checks (specifically on Windows), and I think it's going to be a net improvement for us going forward.