alexio215 commented on issue #46023:
URL: https://github.com/apache/airflow/issues/46023#issuecomment-2632079316

   > > So I'm currently looking at using two capabilities. The first, is to 
connect to an NGINX proxy that requires SSL certs and expects mTLS to serve 
HIVE commands locally through our cluster, into the HIVE2SERVER running right 
behind it. The second, down the line that I am hoping for, is to find or create 
support for direct connection with pyHIVE to HIVE2SERVER running with SSL, and 
to perform mTLS. The problem with this however is that I notice that python 
does not natively support the .jks format that HIVE2SERVER expects, hence the 
use of an NGINX proxy. However, looking at pyHIVE, and its most recent issues, 
to me it seems that pyHIVE as well does not support SSL connection:
   > > [dropbox/PyHive#257](https://github.com/dropbox/PyHive/issues/257)
   > > Forgive me for any misunderstanding as well, this is all a learning 
process to me at the same time. Thank you for the patience and help 
[@nevcohen](https://github.com/nevcohen)
   > 
   > So today how do you connect to hive using a code?
   
   Thank you for the patience, this has taken some digging on my end, getting 
accustomed to what is currently practiced in my org. Currently our pyHive 
queries are written a more manual script and sent to a NGINX server that 
redirects appropriate traffic to a Hive2Server proxy. The Thrift communication 
is wrapped in HTTPS using the THTTPClient module from the Thrift library. I 
have found this to exist within pyHive as well.
   
   This lives and is made accessible within the Connection method of pyHive
   `if scheme in ("https", "http") and thrift_transport is None:
               port = port or 1000
               ssl_context = None
               if scheme == "https":
                   ssl_context = create_default_context()
                   ssl_context.check_hostname = check_hostname == "true"
                   ssl_cert = ssl_cert or "none"
                   ssl_context.verify_mode = 
ssl_cert_parameter_map.get(ssl_cert, CERT_NONE)
               thrift_transport = thrift.transport.THttpClient.THttpClient(
                   uri_or_host="{scheme}://{host}:{port}/cliservice/".format(
                       scheme=scheme, host=host, port=port
                   ),
                   ssl_context=ssl_context,
               )`
   
   My goal is to add a method using the ssl library that creates ssl context 
using the extras provided and appends them to the connection being created if a 
"use_https_proxy" boolean is specified within the proxy. Further, a 
"enable_mtls" boolean option will be included to allow for cases where someone 
needs to use mTLS.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to