##// END OF EJS Templates
ldap: ensure the proper cert files and dirs are set....
marcink -
r3227:75c71c31 default
parent child Browse files
Show More
@@ -22,6 +22,7 b''
22 RhodeCode authentication plugin for LDAP
22 RhodeCode authentication plugin for LDAP
23 """
23 """
24
24
25 import os
25 import logging
26 import logging
26 import traceback
27 import traceback
27
28
@@ -240,8 +241,14 b' class AuthLdap(AuthLdapBase):'
240 if self.debug:
241 if self.debug:
241 ldap.set_option(ldap.OPT_DEBUG_LEVEL, 255)
242 ldap.set_option(ldap.OPT_DEBUG_LEVEL, 255)
242
243
243 if hasattr(ldap, 'OPT_X_TLS_CACERTDIR'):
244 default_cert_path = os.environ.get('SSL_CERT_FILE')
244 ldap.set_option(ldap.OPT_X_TLS_CACERTDIR, '/etc/openldap/cacerts')
245 default_cert_dir = os.environ.get('SSL_CERT_DIR', '/etc/openldap/cacerts')
246 if default_cert_path and hasattr(ldap, 'OPT_X_TLS_CACERTFILE'):
247 ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, default_cert_path)
248
249 elif hasattr(ldap, 'OPT_X_TLS_CACERTDIR'):
250 ldap.set_option(ldap.OPT_X_TLS_CACERTDIR, default_cert_dir)
251
245 if self.TLS_KIND != 'PLAIN':
252 if self.TLS_KIND != 'PLAIN':
246 ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, self.TLS_REQCERT)
253 ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, self.TLS_REQCERT)
247
254
General Comments 0
You need to be logged in to leave comments. Login now