diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php index 71a7a7838182f..9f6ee5721e2d3 100644 --- a/apps/user_ldap/lib/Connection.php +++ b/apps/user_ldap/lib/Connection.php @@ -686,6 +686,21 @@ private function doConnect($host, $port): bool { $this->ldap->setOption(null, LDAP_OPT_X_TLS_REQUIRE_CERT, LDAP_OPT_X_TLS_DEMAND); } + $defaultCertificatePath = $this->configuration->getSystemValue('default_certificates_bundle_path'); + if ($defaultCertificatePath) { + if ($this->ldap->setOption(null, LDAP_OPT_X_TLS_CACERTFILE, $defaultCertificatePath)) { + $this->logger->debug( + 'Adjusted the tls certificate file path to ' . $defaultCertificatePath, + ['app' => 'user_ldap'] + ); + } else { + $this->logger->warning( + 'Could not change the tls certificate file path.', + ['app' => 'user_ldap'] + ); + } + } + $this->ldapConnectionRes = $this->ldap->connect($host, $port) ?: null; if ($this->ldapConnectionRes === null) {