[server] Print a human readable message if LDAPS cert verify error
If the certificate verification fails while attempting to connect to an
LDAPS server, then the ldap library returns the misleading error type
SERVER_DOWN with unhelpful details:
{'desc': "Can't contact LDAP server", 'info': '(unknown error code)'}
We now print a more relevant message.
@@ -132,6 +132,10 @@ def ldap_error_handler():
except ldap.FILTER_ERROR as ex:
LOG.error("Filter error: %s", str(ex))
+ except ldap.SERVER_DOWN:
+ LOG.error("Can't connect to LDAP server,"
+ " or LDAPS certificate verification failed")
+
except ldap.LDAPError as err:
LOG.error("Exception ldap.%s (%s)",
type(err).__name__, str(err))
