[python-ldap] LDAPS with self-signed certificates

Dave Peticolas dave at krondo.com
Sat Feb 22 12:21:01 EST 2020


I think you want to use one of the TLS options:

https://www.python-ldap.org/en/latest/reference/ldap.html#tls-options

You could either turn off verification (insecure) or pass the location
to the certificate you expect to validate against.

On Thu, Feb 20, 2020 at 2:03 AM Daniel Corbe <daniel at corbe.net> wrote:
>
> Hi,
>
> I'm trying to connect python-ldap to an LDAP server with a self-signed
> SSL certificate and I'm getting the following error.  How do I tell
> python-ldap to either ignore or accept a self-signed certificate?
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/Users/dcorbe/Library/Python/3.7/lib/python/site-packages/ldap/ldapobject.py",
> line 445, in simple_bind_s
>     msgid = self.simple_bind(who,cred,serverctrls,clientctrls)
>   File "/Users/dcorbe/Library/Python/3.7/lib/python/site-packages/ldap/ldapobject.py",
> line 439, in simple_bind
>     return self._ldap_call(self._l.simple_bind,who,cred,RequestControlTuples(serverctrls),RequestControlTuples(clientctrls))
>   File "/Users/dcorbe/Library/Python/3.7/lib/python/site-packages/ldap/ldapobject.py",
> line 331, in _ldap_call
>     reraise(exc_type, exc_value, exc_traceback)
>   File "/Users/dcorbe/Library/Python/3.7/lib/python/site-packages/ldap/compat.py",
> line 44, in reraise
>     raise exc_value
>   File "/Users/dcorbe/Library/Python/3.7/lib/python/site-packages/ldap/ldapobject.py",
> line 315, in _ldap_call
>     result = func(*args,**kwargs)
> ldap.SERVER_DOWN: {'desc': "Can't contact LDAP server", 'errno': 2,
> 'info': 'SSLHandshake() failed: misc. bad certificate (-9825)'}
> _______________________________________________
> python-ldap mailing list
> python-ldap at python.org
> https://mail.python.org/mailman/listinfo/python-ldap



-- 
--Dave Peticolas


More information about the python-ldap mailing list