[MDEV-30587] TLS/SSL error when executing tests Created: 2023-02-07  Updated: 2023-07-21

Status: Stalled
Project: MariaDB Server
Component/s: SSL, Tests
Affects Version/s: 10.6.12
Fix Version/s: 10.4

Type: Bug Priority: Minor
Reporter: Funda Wang Assignee: Daniel Black
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Anolis OS 23, OpenSSL-3.0.7


Issue Links:
Duplicate
is duplicated by MDEV-31384 TLS/SSL errors after MariaDB-10.5.20 ... Closed

 Description   

When compiling mariadb 10.6.12 under Anolis OS (Fedora rawhide based), nine tests failed with "TLS/SSL error: unexpected eof while reading".

Build/test log of 10.6.12:
https://build.openanolis.cn/taskinfo?taskID=527534



 Comments   
Comment by Daniel Black [ 2023-02-07 ]

From openssl issue 18866:

Has the OpenSSL version been updated? OpenSSL 3 (a major release) changed some behaviour compared to 1.1.1 with respect to peers that fail to shutdown a TLS connection cleanly.

Previously, if a peer unexpectedly shutdown a connection an OpenSSL IO function (such as SSL_read()) would report an error and SSL_get_error() would report SSL_ERROR_SYSCALL and errno would be 0. This was considered a bug in 1.1.1 (you should never get SSL_ERROR_SYSCALL but with errno as 0). However fixing it in 1.1.1 broke some apps. We delayed the fix until the next major version (OpenSSL 3.0).

In OpenSSL 3.0 this error is now reported from SSL_get_error() as SSL_ERROR_SSL and the unexpeced eof while reading error is put on the OpenSSL error stack. We also added a new option SSL_OP_IGNORE_UNEXPECTED_EOF which treats an unexpected EOF from the peer as if they had performed an orderly shutdown. See:

https://www.openssl.org/docs/man3.0/man3/SSL_set_options.html

Comment by Daniel Black [ 2023-02-07 ]

9EOR9, this appears as the Connector/C set SSL_set_quiet_shutdown(ssl, 1); in ma_tls_close (libmariadb/secure/openssl.c) as well as the server (vio/viossl.c).

vio/viossl.c describes us a immune to truncation attacks, so maybe we just need to add the option to both client and server.

Comment by Daniel Black [ 2023-02-07 ]

Odd that our Debian sid builders use openssl-3.0.7 and run the same tests without error. Default security level maybe as I cautiously look at Debian patches.

Comment by Funda Wang [ 2023-05-13 ]

No, I don't think the problem comes from openssl side. Because mariadb 10.6.8 w/openssl3 patch tests pased without any problems.

Comment by Daniel Black [ 2023-06-05 ]

Its only when --ssl is added to the mtr options that this shows up.

https://github.com/mariadb-corporation/mariadb-connector-c/pull/222

https://github.com/MariaDB/server/pull/2662

Generated at Thu Feb 08 10:17:22 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.