Skip to content

TLS handshake failed on Debian buster #299

@r313pp

Description

@r313pp

Debian moved to new stable 10 (buster). oldstable is 9 (stretch).
I have trouble connecting to SQL Server on buster. I am getting this error:

(util.c:165):Changed query state from IDLE to DEAD
(util.c:319):tdserror(0x7ffc746a7de0, 0x55f2e26c8b60, 20017, 0)
(util.c:349):tdserror: client library returned TDS_INT_CANCEL(2)
(util.c:372):tdserror: returning TDS_INT_CANCEL(2)
(packet.c:542):Read attempt when state is TDS_DEAD
(tls.c:1028):handshake failed with -1 12 5
(tls.c:1069):handshake failed
(login.c:582):login packet rejected

With oldstable connection works as expected. And if you disable encryption everything works also.
The problem seems to be due OpenSSL update. buster has OpenSSL 1.1.1c 28 May 2019, stretch has OpenSSL 1.1.0k 28 May 2019. May be something to do with addition of TLS1.3 (ciphers list is not equal).
I've tested several versions of SQL Server and on stretch all of them working fine, on buster I have:

Debian Version SQL Server Version Result Log
stretch Microsoft SQL Server 2014 (SP2) (KB3171021) - 12.0.5000.0 (X64) ✅ works stretch_2014SP2.log
stretch Microsoft SQL Server 2017 (RTM-CU6) (KB4101464) - 14.0.3025.34 (X64) ✅ works stretch_2017_RTM-CU6.log
stretch Microsoft SQL Server 2017 (RTM-CU13) (KB4466404) - 14.0.3048.4 (X64) ✅ works stretch_2017_RTM-CU13.log
buster Microsoft SQL Server 2014 (SP2) (KB3171021) - 12.0.5000.0 (X64) ❌ not working buster_2014SP2.log
buster Microsoft SQL Server 2017 (RTM-CU6) (KB4101464) - 14.0.3025.34 (X64) ❌ not working buster_2017_RTM-CU6.log
buster Microsoft SQL Server 2017 (RTM-CU13) (KB4466404) - 14.0.3048.4 (X64) ✅ works buster_2017_RTM-CU13.log

But I could not find what was fixed from CU6 to CU13 https://sqlserverbuilds.blogspot.com/#sql2017x.

To reproduce my problem I've made a repo. It requires docker.

git clone https://github.com/r313pp/freetds_handshake_failed
cd freetds_handshake_failed
./build buster
./build stretch
./run buster ./test -S my-server -U my_user -P my_password > buster.log
./run stretch ./test -S my-server -U my_user -P my_password > stretch.log

You actually don't need to specify user and password since problem occurs before login packets are sent.
Also you can modify .freetds.conf to set different options (openssl ciphers for example).
Then you can inspect *.log files. You can view my logs in table above.

You can get a console inside a container like this ./run buster bash or ./run stretch bash.

I've tried some different openssl ciphers, but haven't managed to find working one.

My problem is coming from that official python:3.7 docker image has moved to buster. I've switched to python:3.7-stretch while we update servers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions