ashb commented on a change in pull request #4006: [AIRFLOW-3164] Verify server 
certificate when connecting to LDAP
URL: https://github.com/apache/incubator-airflow/pull/4006#discussion_r230875122
 
 

 ##########
 File path: airflow/contrib/auth/backends/ldap_auth.py
 ##########
 @@ -55,16 +55,20 @@ class LdapException(Exception):
 
 
 def get_ldap_connection(dn=None, password=None):
-    tls_configuration = None
-    use_ssl = False
+    cacert = None
     try:
         cacert = configuration.conf.get("ldap", "cacert")
-        tls_configuration = Tls(validate=ssl.CERT_REQUIRED, 
ca_certs_file=cacert)
-        use_ssl = True
-    except Exception:
+    except AirflowConfigException:
         pass
 
-    server = Server(configuration.conf.get("ldap", "uri"), use_ssl, 
tls_configuration)
+    tls_configuration = Tls(validate=ssl.CERT_REQUIRED,
+                            version=ssl.PROTOCOL_SSLv23,
 
 Review comment:
   Elsewhere in that doc:
   
   > PROTOCOL_SSLv23
   >
   >  Alias for PROTOCOL_TLS
   
   The wording I quoted above is from 
https://docs.python.org/2/library/ssl.html#ssl.create_default_context and is 
called here 
https://github.com/cannatag/ldap3/blob/master/ldap3/core/tls.py#L172-L187 - it 
still sets the validate flag.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to