Skip to content

Commit c4206bd

Browse files
authored
Merge pull request #89 from Criena/master
Verify certificates when using SSL or TLS
2 parents 490b2bf + a96d3ea commit c4206bd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ldap_auth_provider.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import ldap3
2020
import ldap3.core.exceptions
2121

22+
import ssl
23+
2224
import logging
2325
import synapse
2426

@@ -88,8 +90,9 @@ def check_password(self, user_id, password):
8890
localpart = user_id.split(":", 1)[0][1:]
8991

9092
try:
93+
tls = ldap3.Tls(validate=ssl.CERT_REQUIRED)
9194
server = ldap3.ServerPool(
92-
[ldap3.Server(uri, get_info=None) for uri in self.ldap_uris],
95+
[ldap3.Server(uri, get_info=None, tls=tls) for uri in self.ldap_uris],
9396
)
9497
logger.debug(
9598
"Attempting LDAP connection with %s",

0 commit comments

Comments
 (0)