Bug 2081414

Summary: [MariaDB 10.3.32] socat: E Failed to set SNI host "" (SST failure)
Product: Red Hat Enterprise Linux 8 Reporter: Imre Jonk <imre>
Component: mariadbAssignee: Anton Bobrov <abobrov>
Status: CLOSED CURRENTRELEASE QA Contact: Jakub Heger <jheger>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.5CC: abobrov, daniel, databases-maint, drehak, gerhard, hhorak, ljavorsk, martijn, mschorm
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2223961 (view as bug list) Environment:
Last Closed: 2023-10-05 15:18:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2217001    
Bug Blocks: 2223961    
Attachments:
Description Flags
Contains MariaDB configuration and patch for wsrep_sst_mariabackup.sh none

Description Imre Jonk 2022-05-03 15:46:47 UTC
Created attachment 1876783 [details]
Contains MariaDB configuration and patch for wsrep_sst_mariabackup.sh

Description of problem:
The recent mariadb-server package update in RHEL 8.5 breaks State Snapshot Transfers (SST) when using the 'mariabackup' SST method with socat.

Version-Release number of selected component (if applicable):
3:10.3.32-2.module+el8.5.0+14124+14ced695

How reproducible:
Always.

Steps to Reproduce:
1. Configure Galera multi-master replication between three nodes using the 'mariabackup' SST method, and further configure the use of socat's TLS implementation for these SSTs (e.g. encrypt=2 under the [sst] section). See the attached configuration files.
2. Bootstrap the cluster from one of the nodes.
3. Attempt to join one of the other nodes to the cluster.

Actual results:
The joining node will correctly start the socat service, listening on TCP port 4444, in order to receive the SST. The donor node however will refuse to connect to the joining node with this error in /var/log/mariadb/mariadb.log:

WSREP_SST: [INFO] Evaluating '/usr//bin/mbstream' -c 'xtrabackup_galera_info' | socat -u stdio openssl-connect:webmail6.ciphermail.com:4444,cert='/etc/pki/tls/private/ciphermail.pem',cafile='/etc/pki/tls/certs/ciphermail-ca.crt',commonname='',pf=ip6; RC=( ${PIPESTATUS[@]} ) (20220502 11:30:49.172)
2022/05/02 11:30:49 socat[393629] E Failed to set SNI host ""

Expected results:
The donor node should connect to the joining node's socat service on TCP port 4444, verify that the CA certificate matches the trusted CA certificate, and verify that the Common Name matches the node's name as listed in wsrep_cluster_address. It should not attempt to use an empty string as the Common Name or SNI host.

Additional info:
The fix we currently use ourselves and plan to provide to our customers is to apply the same logic to the CN_option variable when using encrypt=2 as is done in case encrypt=3 or encrypt=4 is used. See the attached patch.

Comment 1 Imre Jonk 2022-08-19 08:44:05 UTC
Any update on this issue?

Comment 2 martijn 2022-09-09 13:10:52 UTC
Since this is a serious breaking issue, i.e., cluster is no longer functional, it would be nice if there is some update on this issue.

Comment 4 Gerhard 2023-01-13 21:35:50 UTC
You set commonname to '', for whatever reason. For the users convenience Socat tries to set the SNI name to commonname, but OpenSSL lib apparently does not allow explicit empty SNI name.

Try option nosni to prevent Socat from setting the SNI name!

Comment 5 Daniel Black 2023-01-17 03:23:28 UTC
Note: upstream bug https://jira.mariadb.org/browse/MDEV-30402

Comment 6 Michal Schorm 2023-05-15 09:44:22 UTC
The fix has been added to the upstream code base:
  https://github.com/MariaDB/server/commit/d1a4315f4cb096c2fd81c96bc4afc6bb618bae49