1
0
mirror of https://github.com/linkedin/oncall.git synced 2025-12-01 23:51:36 +02:00

don't use ldaps if there's no cert file in the config

This commit is contained in:
John Jensen
2018-06-26 11:29:07 -04:00
committed by Daniel Wang
parent db6cfaa8fb
commit c78890cb1a
2 changed files with 8 additions and 2 deletions

View File

@@ -19,6 +19,8 @@ class Authenticator:
if not os.access(self.cert_path, os.R_OK):
logger.error("Failed to read ldap_cert_path certificate")
raise IOError
else:
self.cert_path = None
self.bind_user = config.get('ldap_bind_user')
self.bind_password = config.get('ldap_bind_password')
@@ -30,7 +32,8 @@ class Authenticator:
self.user_suffix = config.get('ldap_user_suffix')
def ldap_auth(self, username, password):
ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, self.cert_path)
if self.cert_path:
ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, self.cert_path)
connection = ldap.initialize(self.ldap_url)
connection.set_option(ldap.OPT_REFERRALS, 0)

View File

@@ -21,6 +21,8 @@ class Authenticator:
if not os.access(self.cert_path, os.R_OK):
logger.error("Failed to read ldap_cert_path certificate")
raise IOError
else:
self.cert_path = None
self.bind_user = config.get('ldap_bind_user')
self.bind_password = config.get('ldap_bind_password')
@@ -34,7 +36,8 @@ class Authenticator:
self.attrs = config.get('attrs')
def ldap_auth(self, username, password):
ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, self.cert_path)
if self.cert_path:
ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, self.cert_path)
connection = ldap.initialize(self.ldap_url)
connection.set_option(ldap.OPT_REFERRALS, 0)