I want to use ldap3 with python 3.9 to connect and update my password from MS AD.
server = Server('my_server')
conn = Connection(server, USER, PASS, authentication=NTLM)
conn.bind()
conn.start_tls()
The conn.bind()
is True, but when I do the conn.start_tls()
I got this error:
Nico/Documents/env/lib/python3.9/site-packages/ldap3/core/connection.py in start_tls(self, read_server_info)
1312 if self.closed:
1313 self.open()
-> 1314 if self.server.tls.start_tls(self) and self.strategy.sync: # for asynchronous connections _start_tls is run by the strategy
1315 if read_server_info:
1316 self.refresh_server_info() # refresh server info as per RFC4515 (3.1.5)
Nico/Documents/env/lib/python3.9/site-packages/ldap3/core/tls.py in start_tls(self, connection)
275 if log_enabled(ERROR):
276 log(ERROR, '%s for <%s>', connection.last_error, connection)
--> 277 raise LDAPStartTLSError(connection.last_error)
278 if log_enabled(BASIC):
279 log(BASIC, 'tls started for <%s>', connection)
LDAPStartTLSError: startTLS failed - unavailable
My conn.result
:
{'result': 52,
'description': 'unavailable',
'dn': '',
'message': '00000000: LdapErr: DSID-0C0912C4, comment: Error initializing SSL/TLS, data 0, v3839\x00',
'referrals': None,
'responseName': '1.3.6.1.4.1.1466.20037',
'responseValue': b'',
'type': 'extendedResp'}
If I try to do server = Server('my_server', use_ssl=True)
then, I'm not able to do conn.bind()
LDAPSocketOpenError: socket ssl wrapping error: [Errno 54] Connection reset by peer
Any help?
Thanks in advance!