Browse Source

HUE-5026 [core] Warn in logs on startup if ldap_url contains "ldaps://" and use_start_tls = true

krish 9 years ago
parent
commit
58edfc7
1 changed files with 5 additions and 1 deletions
  1. 5 1
      desktop/core/src/desktop/auth/backend.py

+ 5 - 1
desktop/core/src/desktop/auth/backend.py

@@ -368,12 +368,16 @@ class LdapBackend(object):
     self._backend = _LDAPBackend()
 
   def add_ldap_config(self, ldap_config):
-    if ldap_config.LDAP_URL.get() is None:
+    ldap_url = ldap_config.LDAP_URL.get()
+    if ldap_url is None:
       LOG.warn("Could not find LDAP URL required for authentication.")
       return None
     else:
       setattr(self._backend.settings, 'SERVER_URI', ldap_config.LDAP_URL.get())
 
+    if ldap_url.lower().startswith('ldaps') and ldap_config.USE_START_TLS.get():
+      LOG.warn("Cannot configure LDAP with SSL and enable STARTTLS.")
+
     if ldap_config.SEARCH_BIND_AUTHENTICATION.get():
       # New Search/Bind Auth
       base_dn = ldap_config.BASE_DN.get()