Matthew
Matthew

Reputation: 587

GET request ssl_choose_client_version:unsupported protocol

I have a problem dealing with an upgrade of an application doing GET request to a remote server.

First thing first : a functional example of a GET done by the old version, and as expected it works

curl -k -vvvvv https://mywebsite.com/mywonderfulwebsite/mypage.php

*   Trying 192.168.0.70...
* TCP_NODELAY set
* Connected to mywebsite.com (192.168.0.70) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.0 (IN), TLS handshake, Certificate (11):
* TLSv1.0 (IN), TLS handshake, Server finished (14):
* TLSv1.0 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.0 (OUT), TLS change cipher, Client hello (1):
* TLSv1.0 (OUT), TLS handshake, Finished (20):
* TLSv1.0 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.0 / AES128-SHA
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: CN=MYWEBSITE.COM
*  start date: Mar 24 10:20:51 2020 GMT
*  expire date: Mar 24 00:00:00 2021 GMT
*  issuer: CN=MYWEBSITE.COM
*  SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
> GET /mywonderfulwebsite/mypage.php HTTP/1.1
> Host: mywebsite.com
> User-Agent: curl/7.58.0
> Accept: */*
....... and here the content of the page.....

And now from the new version, it doesn't work

curl -vvvvv https://mywebsite.com/mywonderfulwebsite/mypage.php
*   Trying 192.168.0.70:443...
* TCP_NODELAY set
* Connected to mywebsite.com (192.168.0.70) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (OUT), TLS alert, protocol version (582):
* error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol
* Closing connection 0
curl: (35) error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol

So I think it was from the TLS version, no problem let's force it :

curl --tlsv1.0 -vvvvv https://mywebsite.com/mywonderfulwebsite/mypage.php

*   Trying 192.168.0.70:443...
* TCP_NODELAY set
* Connected to mywebsite.com (192.168.0.70) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (OUT), TLS alert, protocol version (582):
* error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol
* Closing connection 0
curl: (35) error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol

and it's a fail.

I've tried adding the certificates from the remote website, and I have the same answer.

I've looked at a request using openssl client :

# openssl s_client -connect mywebsite.com:443 -tls1
CONNECTED(00000003)
139820362433856:error:141E70BF:SSL routines:tls_construct_client_hello:no protocols available:../ssl/statem/statem_clnt.c:1112:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 7 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
---

And now I'm playing with versions and requests and I have no clue where I should check. Do you know how I could troubleshoot my problem ?

Upvotes: 8

Views: 32722

Answers (3)

Jimmy Gabriel Meza
Jimmy Gabriel Meza

Reputation: 1

For Docker users

Matthew's solution assisted me within my Docker container to achieve this during the container build process. Below, I detail the steps I followed:

I share my Dockerfile in case it is useful for anyone:

# Utiliza la imagen base php:8.2.17-apache
FROM php:8.2.17-apache

# Instalar los controladores de SQL Server para PHP
ENV ACCEPT_EULA=Y
RUN apt-get update && apt-get install -y gnupg2
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add 
- 
RUN curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > 
/etc/apt/sources.list.d/mssql-release.list 
RUN apt-get update 
RUN ACCEPT_EULA=Y apt-get -y --no-install-recommends install msodbcsql17 
unixodbc-dev 
RUN pecl install sqlsrv
RUN pecl install pdo_sqlsrv

RUN echo "extension=sqlsrv.so" > /etc/php/8.3/mods-available/sqlsrv.ini
RUN echo "extension=pdo_sqlsrv.so" > /etc/php/8.3/mods- 
available/pdo_sqlsrv.ini

# Crea los enlaces simbólicos en la carpeta conf.d para activar las 
extensiones
RUN ln -s /etc/php/8.3/mods-available/sqlsrv.ini 
/etc/php/8.3/apache2/conf.d/20-sqlsrv.ini && \
    ln -s /etc/php/8.3/mods-available/pdo_sqlsrv.ini 
/etc/php/8.3/apache2/conf.d/20-pdo_sqlsrv.ini && \
    ln -s /etc/php/8.3/mods-available/sqlsrv.ini 
/etc/php/8.3/cli/conf.d/20-sqlsrv.ini && \
    ln -s /etc/php/8.3/mods-available/pdo_sqlsrv.ini 
/etc/php/8.3/cli/conf.d/20-pdo_sqlsrv.ini

# Edita el archivo openssl.cnf para agregar las configuraciones 
necesarias
RUN sed -i '1s/^/openssl_conf = default_conf\n/' /etc/ssl/openssl.cnf && 
\
    echo "" >> /etc/ssl/openssl.cnf && \
    echo "[ default_conf ]" >> /etc/ssl/openssl.cnf && \
    echo "ssl_conf = ssl_sect" >> /etc/ssl/openssl.cnf && \
    echo "" >> /etc/ssl/openssl.cnf && \
    echo "[ssl_sect]" >> /etc/ssl/openssl.cnf && \
    echo "system_default = system_default_sect" >> /etc/ssl/openssl.cnf 
&& \
    echo "" >> /etc/ssl/openssl.cnf && \
    echo "[system_default_sect]" >> /etc/ssl/openssl.cnf && \
    echo "MinProtocol = TLSv1" >> /etc/ssl/openssl.cnf && \
    echo "CipherString = DEFAULT:@SECLEVEL=1" >> /etc/ssl/openssl.cnf    

# Iniciar servicios
ENTRYPOINT ["/bin/sh", "-c", "service supervisor start && service 
apache2 restart && bash"]

Upvotes: 0

Angelo Uztariz
Angelo Uztariz

Reputation: 11

For centOS users.

My solution is to lower the protocol to be used to the minimum level.

/etc/crypto-policies/back-ends/opensslcnf.config

MinProtocol = TLSv1.0

It worked, I hope it helps you. Greetings.

Upvotes: 1

Matthew
Matthew

Reputation: 587

Here is the solution : https://askubuntu.com/questions/1233186/ubuntu-20-04-how-to-set-lower-ssl-security-level

Late openssl package is configured to forbid the usage of TLS < 1.2 however, the first curl request shows a communication using TLS 1.0

So in debian Buster openssl package was too new

dpkg -l | grep openssl
ii  openssl                       1.1.1d-0+deb10u7

I didn't have to downgrade Openssl

Edit /etc/ssl/openssl.cnf

add in the beginning of the file

openssl_conf = default_conf

And this to the end of the file

[ default_conf ]

ssl_conf = ssl_sect

[ssl_sect]

system_default = system_default_sect

[system_default_sect]
MinProtocol = TLSv1
CipherString = DEFAULT:@SECLEVEL=1

Changing the configuration allow the usage of minimal version of TSL starting TSL 1.0 and more, so from now I can request my legacy partner.

Upvotes: 27

Related Questions