I have an application that I wrote in PHP using the docker container php:7.4-apache, however recently the php docker containers have been updated to use Debian Bullseye as the base image.
Ever since this update, I am no longer able to perform LDAP Binds. No matter what I try it fails and gives me the following error when turning on ldap debugging:
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
TLS: can't connect: (unknown error code).
ldap_err2string
There is an issue on Github on the php docker image however it was closed and we were suggested to use the php:7.4-apache-buster image directly. This does work however it would be nice to figure out what is going on so we can upgrade to the future Bullseye release.
https://github.com/docker-library/php/issues/1194
However, just as I was writing this I turned off TLS for ldap and went to the unencrypted 389 port of my LDAP server and it works, so something is wrong with the TLS connection for sure.
I figured it out. On Debian Bullseye the libldap-common package is not installed when installing libldap2-dev as a dependency. Adding libldap-common as a package to install during the build process fixed the issue.