I recently ran into this issue when connecting to a micro service on a server. All seemed well and it should have worked but didn't. The error code was:
curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to ...
Found the root cause.
It is almost certainly the same issue as others have had. A little background... The server is a custom server that uses SSL SNI information to deduce which micro service it should route the TLS connection to. The sequence of events is:
- TCP connects.
- SSL handshake starts.
- SNI is inspected and TLS session is not initiated.
- New socket is opened to listening micro service.
- Original handshake packet is forwarded as a TCP/TLS connection to micro service.
In my case the proxy server was not able to find the correct endpoint due to a combination error of wrong SNI info and incorrectly configured back-end. Hence the proxy closes the socket, in the middle of the handshake and you get error 35.
I suspect this happens with HAProxy non-terminated connections when, for example; the front end picks up, inspects SNI and the TCP backend is either not configured, can't be found, or the backend service is not running and can't be connected to.
For those having this issue, make sure that all of the above are correctly setup. In my case it was a single character typo causing the grief. Presumably other issues such as a bad certificate could also cause similar errors. I've gotten 28, 35, and a few others. All are related and resolved once the config is correct.
Hope this helps.