webapp/directory: add LDAP_CA_PATH handling

This commit is contained in:
informatic 2024-07-06 23:04:07 +02:00
parent cf82ed5ac4
commit 81e67d28b9
No known key found for this signature in database

View file

@ -34,6 +34,8 @@ from webapp import mc, cache_enabled, app
def connect():
c = ldap.initialize(app.config['LDAP_URI'])
c.set_option(ldap.OPT_X_TLS_CACERTFILE, app.config['LDAP_CA_PATH'])
c.set_option(ldap.OPT_X_TLS_NEWCTX, 0)
c.start_tls_s()
c.simple_bind_s(app.config['LDAP_BIND_DN'],
app.config['LDAP_BIND_PASSWORD'])