[MXS-3665] Provide more feedback on TLS cipher mismatch Created: 2021-07-10  Updated: 2022-04-12  Resolved: 2022-03-08

Status: Closed
Project: MariaDB MaxScale
Component/s: Core
Affects Version/s: None
Fix Version/s: 2.5.20, 6.2.4, 22.08.0

Type: New Feature Priority: Minor
Reporter: Hartmut Holzgraefe Assignee: markus makela
Resolution: Cannot Reproduce Votes: 0
Labels: None

Sprint: MXS-SPRINT-152

 Description   

When getting a TLS "no matching cipher" error it would be nice to get log information about the set of ciphers offered by the clients and those supported by the maxscale instance, to make it more easy to figure out the problem on the Maxscale side.

This would help in case of TLS connection problems without revealing any sensitive information to a potential client side attacker, as such an attacker could just try out ciphers one by one anyway, while a legitimate client running into this problem may have a harder time figuring out what to do (e.g. may only be able to figure out what ciphers the client application / connector actually offered by capturing TCP traffic ...)



 Comments   
Comment by markus makela [ 2022-03-02 ]

I'll see if we can provide some extra information in the REST API output about the TLS certificates themselves.

Comment by markus makela [ 2022-03-04 ]

Wouldn't it be possible to see what the server (or MaxScale) offers using openssl s_client with the -starttls mysql option? This seems to provide the set of shared ciphers between the client and the host:

CONNECTED(00000003)
---
Certificate chain
 0 s:C = FI, L = Default City, O = MariaDB, CN = localhost
   i:C = FI, L = Default City, O = Default Company Ltd, CN = localhost
 1 s:C = FI, L = Default City, O = Default Company Ltd, CN = localhost
   i:C = FI, L = Default City, O = Default Company Ltd, CN = localhost
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIFSzCCBDOgAwIBAgIBBDANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJGSTEV
MBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQQKDBNEZWZhdWx0IENvbXBhbnkg
THRkMRIwEAYDVQQDDAlsb2NhbGhvc3QwHhcNMjIwMzAyMDc0NDE4WhcNMzAwNTE5
MDc0NDE4WjBKMQswCQYDVQQGEwJGSTEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRAw
DgYDVQQKDAdNYXJpYURCMRIwEAYDVQQD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JbG9jYWxob3N0ghRW6igW
Yy+h+eMfgyMTlhlEi+GpiDAOBgNVHQ8BAf8EBAMCBaAwEwYDVR0lBAwwCgYIKwYB
BQUHAwEwFAYDVR0RBA0wC4IJbG9jYWxob3N0MA0GCSqGSIb3DQEBCwUAA4IBAQCe
FkNGM6ZnRMWHo7ahbYc7d2bjS0as0o11cX3VJS53uXV+8XhIqr4JVVe1nANybQPr
BJEVgswqDwOoV4+y0C2TcQYlqqKUvmX/cgusS0bfSCi9TROWCJQovvQB/VfylRnn
TzhVK0XO2oVP/9NWUZcEfnxtFG96G/dXRTIxmYt9bfFmzWIaB5TcEqnWV+6D1CfE
OL3vYBwmc/cMdIH/B1ajVqfiaPEGcyNyMSVbIQ0PRqYxwu7m3Rc57xRStOukE0zR
GDWQV45Fi62m5OCwmY0+nZG2o328ZioSiqqQuxiVj82gaAXkiYqT3Pv4dUX48Aq3
SLxUE2uWlW3O5Kyy/bFA
-----END CERTIFICATE-----
subject=C = FI, L = Default City, O = MariaDB, CN = localhost
 
issuer=C = FI, L = Default City, O = Default Company Ltd, CN = localhost
 
---
No client certificate CA names sent
Requested Signature Algorithms: ECDSA+SHA256:ECDSA+SHA384:ECDSA+SHA512:Ed25519:Ed448:RSA-PSS+SHA256:RSA-PSS+SHA384:RSA-PSS+SHA512:RSA-PSS+SHA256:RSA-PSS+SHA384:RSA-PSS+SHA512:RSA+SHA256:RSA+SHA384:RSA+SHA512:ECDSA+SHA224:RSA+SHA224
Shared Requested Signature Algorithms: ECDSA+SHA256:ECDSA+SHA384:ECDSA+SHA512:Ed25519:Ed448:RSA-PSS+SHA256:RSA-PSS+SHA384:RSA-PSS+SHA512:RSA-PSS+SHA256:RSA-PSS+SHA384:RSA-PSS+SHA512:RSA+SHA256:RSA+SHA384:RSA+SHA512
Peer signing digest: SHA256
Peer signature type: RSA-PSS
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 3183 bytes and written 431 bytes
Verification: OK
---
New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384
Server public key is 4096 bit
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)

Comment by markus makela [ 2022-03-07 ]

After taking a second look at the APIs, I think there's one function in 1.0.2 that we can use: SSL_get_cipher_list. This should be enough to report an error on the info level whenever OpenSSL reports an error. However, this only displays the certificates MaxScale was using, not the ones the client offered. Using SSL_get_client_ciphers we can get the client ciphers but this also seems to only be present in OpenSSL 1.1.1.

Comment by markus makela [ 2022-03-07 ]

Here's an example of what will be logged in 2.5.20 when there are no shared ciphers:

2022-03-07 16:53:13   error  : (34) SSL operation failed for Client DCB at '::1': error:1417A0C1:SSL routines:tls_post_process_client_hello:no shared cipher (Client ciphers: TLS_AES_128_CCM_SHA256:TLS_AES_128_CCM_8_SHA256:GOST2012-GOST8912-GOST8912:GOST2012-NULL-GOST12) (Our ciphers: TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:TLS_AES_128_CCM_SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-CCM:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-CCM:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:AES256-GCM-SHA384:AES256-CCM:AES128-GCM-SHA256:AES128-CCM:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES256-CCM:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-CCM:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:PSK-AES256-GCM-SHA384:PSK-CHACHA20-POLY1305:PSK-AES256-CCM:PSK-AES128-GCM-SHA256:PSK-AES128-CCM:PSK-AES256-CBC-SHA:PSK-AES128-CBC-SHA256:PSK-AES128-CBC-SHA:DHE-PSK-AES256-GCM-SHA384:DHE-PSK-CHACHA20-POLY1305:DHE-PSK-AES256-CCM:DHE-PSK-AES128-GCM-SHA256:DHE-PSK-AES128-CCM:DHE-PSK-AES256-CBC-SHA:DHE-PSK-AES128-CBC-SHA256:DHE-PSK-AES128-CBC-SHA:ECDHE-PSK-CHACHA20-POLY1305:ECDHE-PSK-AES256-CBC-SHA:ECDHE-PSK-AES128-CBC-SHA256:ECDHE-PSK-AES128-CBC-SHA:RSA-PSK-AES256-GCM-SHA384:RSA-PSK-CHACHA20-POLY1305:RSA-PSK-AES128-GCM-SHA256:RSA-PSK-AES256-CBC-SHA:RSA-PSK-AES128-CBC-SHA256:RSA-PSK-AES128-CBC-SHA)

It's not that easy to read but it'll show you why it failed. The Client ciphers section is only logged for systems that use OpenSSL 1.1.1 or newer and only when MaxScale is acting as the server (i.e. TLS is used in listeners). For MaxScale <-> MariaDB communication this is not possible as the client always sends the cipher list and the server chooses which one to use. In this case the Client ciphers list is actually the Our ciphers list.

Generated at Thu Feb 08 04:23:04 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.