If you’ve tried to use SSL in Percona XtraDB Cluster and saw an error in the logs like SSL3_CHECK_CERT_AND_ALGORITHM:dh key too small, we’ve implemented some changes in Percona XtraDB Cluster 5.6.34 and 5.7.16 that get rid of these errors.
dh key too small refers to the Diffie-Hellman parameters used by the SSL code that are shorter than recommended.
Due to the Logjam vulnerability (https://weakdh.org/), the required key-lengths for the Diffie-Hellman parameters were changed from 512 bits to 2048 bits. Unfortunately, older versions of OpenSSL/socat still use 512 bits (and thus caused the error to appear).
Changes made to Percona XtraDB Cluster
Since versions of socat greater than 1.7.3 now use 2048 bits for the Diffie-Hellman parameters, we only do extra work for the older versions of socat (less than 1.7.3). The SST code now:
- Looks for a file with the DH params
- Uses the “ssl_dhparams” option in the [sst] section if it exists
- Looks for a “dhparams.pem” file in the datadir
- If the file is specified and exists, uses that file as a source for the DH parameters
- If the file does not exist, creates a dhparams.pem file in the datadir
Generating the dhparams yourself
Unfortunately, the time it can take several minutes to create the dhparams file. We recommend that the dhparams.pem be created prior to starting the SST.
openssl dhparam -out path/to/datadir/dhparams.pem 2048