databricks-sql-python icon indicating copy to clipboard operation
databricks-sql-python copied to clipboard

TLS version handshake issue

Open waynetheron opened this issue 3 years ago • 2 comments

I am facing with this connector. It works 100% of the time from my desktop but when i try from an Azure VM it only randomly succeeds. I did a Wireshark trace and can see when it fails, the client tries to do a TLSv1 handshake and the Databricks Service detects this and sends back a reset. Randomly it will try with v1.3 and then the connection works. I have tried setting the http_header to tls-version : TLSv1.3 but it doesn't seem to have any effect

in this screen shot you can see a success and failure side-by-side

image

waynetheron avatar Jul 15 '22 09:07 waynetheron

Hi, could you please check the openssl version on the VM? E.g.: python -c "import ssl; print(ssl.OPENSSL_VERSION)". The TLS version used by the handshake is determined by the openssl library. The client should use the highest version it supports in the Client Hello message, so it is odd that it is trying with TLSv1 while clearly it also has TLSv1.3 available.

sander-goos avatar Jul 18 '22 09:07 sander-goos

Hi, could you please check the openssl version on the VM? E.g.: python -c "import ssl; print(ssl.OPENSSL_VERSION)". The TLS version used by the handshake is determined by the openssl library. The client should use the highest version it supports in the Client Hello message, so it is odd that it is trying with TLSv1 while clearly it also has TLSv1.3 available.

HI

It prints

OpenSSL 1.1.1n 15 Mar 2022

What is interesting is this is the same python modules that run perfectly fine on another system (copied the entire python folder to this Azure VM) so it does seem to be an underlying OS-related issue but the weird thing is why does it sometimes try 1.3 (this bit has me stumped as it is not consistent). I have counted the intervals between success and failure and there is no pattern there either. It can fail 11 times in a row before using 1.3 and working, other times it can fail 16 times before working. When it works it tends to work the next run again but then starts to fail after that.

waynetheron avatar Jul 18 '22 09:07 waynetheron