Я нажимаю LDAP без SSL, и все работает нормально.
from ldap3 import Server, Connection, ALL
server = Server(host='prod.prod.com', port=636, use_ssl=True, get_info=ALL)
conn = Connection(server, user='cn=prod,ou=ApplicationUsers,o=prod', password='123456')
conn.start_tls()
conn.bind()
conn.result
print(conn.result)
{'result': 0, 'description': 'success', 'dn': '', 'message': '', 'referrals': None, 'saslCreds': None, 'type': 'bindResponse'}
Когда я пытаюсь использовать ssl
from ldap3 import Server, Connection, ALL,Tls
tls = Tls(local_certificate_file='prodldap.crt', \
ca_certs_file = 'DigiCertCA.crt', \
validate=ssl.CERT_REQUIRED, version=ssl.PROTOCOL_TLSv1_2)
server = Server(host='prod.prod.com', port=636, use_ssl=True, get_info=ALL, tls=tls)
conn = Connection(server, user='cn=prod,ou=ApplicationUsers,o=prod', password='123456', tls=tls)
conn.bind()
conn.result
print(conn)
----> 7 conn.bind()
8 conn.result
9 print(conn)
c:\python\python38\lib\site-packages\ldap3\core\connection.py in bind(self, read_server_info, controls)
559 self._bind_controls = None
560 if self.closed: # try to open connection if closed
--> 561 self.open(read_server_info=False)
562 if self.authentication == ANONYMOUS:
563 if log_enabled(PROTOCOL):
c:\python\python38\lib\site-packages\ldap3\strategy\sync.py in open(self, reset_usage, read_server_info)
54
55 def open(self, reset_usage=True, read_server_info=True):
---> 56 BaseStrategy.open(self, reset_usage, read_server_info)
57 if read_server_info:
58 try:
c:\python\python38\lib\site-packages\ldap3\strategy\base.py in open(self, reset_usage, read_server_info)
137 if log_enabled(ERROR):
138 log(ERROR, '<%s> for <%s>', str(exception_history[0][0]) + ' ' + str((exception_history[0][1])), self.connection)
--> 139 raise exception_history[0][0]
140 else:
141 if log_enabled(ERROR):
И я попал в это ужасное error
LDAPSocketOpenError: ("('ошибка упаковки ssl сокета: [SSL] PEM lib (_ssl. c: 4012)',)»,)
Есть идеи, что я делаю не так?