-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] LDAPS with multiple certificates. #740
Comments
Hi @lazosweb, If you run
|
Hi @stevebauman |
Thanks for the update @lazosweb. If you add the debug 7 into your connection options, are you able to see the TLS error? For example: // config/ldap.php
return [
// ...
'connections' => [
'default' => [
// ...
'options' => [
LDAP_OPT_DEBUG_LEVEL => 7,
],
],
],
// ...
]; Then run: php artisan ldap:test If you're still having this issue with or without the option, would you be able to share your script you used so that I could resolve this for you and others who encounter this in the future? |
@stevebauman But still in your previous comments the SSL error messages should appear inside the diagnostic message but they do not. ldap_bind_ext(): Unable to bind to server: Can't contact LDAP server (-1). Error Code: [-1] Diagnostic Message: NULL See the outputs. Without DEBUG LEVEL 7
With DEBUG LEVEL 7
The above is an example. The issue we had with our customer is that we have been careless with the LDAP host(s). Customer provided us with 5 Domain Controllers like this: In the LDAP_HOST environment variable we only entered headoffice.example.com and ldap:test was failing all the time and we had no clue why for 3 days when the unencrypted version was working just fine with that host. When we run our custom script we saw the TLS error that the host does not match the common name "DC01.headoffice.example.com" of the certificate and we realized immediately our mistake that instead of the just headoffice.example.com we had to enter dc01.headoffice.example.com instead... I hope this will help somebody else one day :) |
Thanks so much for the detailed reply here @lazosweb! ❤️ This will definitely help others out in the future, and help me improve the debug documentation. I'm not sure if I'll be able to change the location of the logs that are printed from the LDAP debugging (as they are printed from the LDAP PHP extension directly into stdout), but I'll give it a shot. I'll close this issue once I've update the LdapRecord documentation with all this information to assist others in the future. Thanks again! 🙏 |
Hi @stevebauman. Definitely update the documentation. I do not think you need to try and catch the SSL/TLS errors. I think your artisan ldap:test command should always include DEBUG LEVEL 7 or add an argument/option in the command if the user would like to output the full debug log like the "with DEBUG LEVEL 7" example I posted. Regarding LDAP_OPT_X_TLS_CACERTDIR but this take it with a pinch of salt. The CACERTDIR might not work on Windows but it works on Linux. Also if your customer provides you with more than one certificate you might be able to stack them up into one certificate file and use LDAP_OPT_X_TLS_CACERTFILE. Also this one take it with a pinch of salt. It worked for us but we are not certificate experts. Thanks for all the hard work you have put to this amazing package. We have been using your packages since Adldap2-Laravel :D |
Environment:
Hello, we are looking for guidance.
We are deploying a Web App as a container in Azure and we will be using the customer's LDAP (LDAPS, port 636) to authenticate the users.
Customer has provided us with 2 PEM CA Certificates (chain certificates they call them).
According to PHP https://www.php.net/manual/en/function.ldap-set-option.php
You can use LDAP_OPT_X_TLS_CACERTFILE for a single certificate or LDAP_OPT_X_TLS_CACERTDIR to load multiple certificates.
Have anyone ever tried LDAP_OPT_X_TLS_CACERTDIR and worked with more than one certificate?
Unecrypted LDAP works fine but LDAPS with the provided certificates from the customer all we get is "Cannot contact LDAP server".
We suspect there is an issue with the provided certificates but how can we debug this to identify that the issue is indeed with the provided certificates?
In-house LDAPS with one certificate and LDAP_OPT_X_TLS_CACERTFILE success and we had another customer that provided only one certificate and we did not have an issue...
The text was updated successfully, but these errors were encountered: