Enabling TLS on MariaDB Server
MariaDB Enterprise Server and MariaDB Community Server support data-in-transit encryption, which secures data transmitted over the network. The server and the clients encrypt data using the Transport Layer Security (TLS) protocol, which is a newer version of the Secure Socket Layer (SSL) protocol.
TLS must be manually enabled on the server.
Acquire an X509 certificate and a private key for the server.
If it is a test or development server, then self-signed certificates and keys might be sufficient.
Mandatory system variables and options for TLS include:
X509 key in PEM format
X509 cert in PEM format
CA file in PEM format
Useful system variables and options for TLS include:
When this option is enabled, connections attempted using insecure transport will be rejected. Secure transports are SSL/TLS, Unix sockets, or named pipes.
SSL cipher to use
CRL file in PEM format
TLS protocol version for secure connections.
Choose a configuration file in which to configure your system variables and options.
It is not recommended to make custom changes to one of the bundled configuration files. Instead, it is recommended to create a custom configuration file in one of the included directories. Configuration files in included directories are read in alphabetical order. If you want your custom configuration file to override the bundled configuration files, then it is a good idea to prefix the custom configuration file's name with a string that will be sorted last, such as
On RHEL, CentOS, and SLES, a good custom configuration file would be:
On Debian and Ubuntu, a good custom configuration file would be:
Set your system variables and options in the configuration file.
They need to be set in a group that will be read by MariaDB Server, such as
[mariadb] ... ssl_cert = /certs/server-cert.pem ssl_key = /certs/server-key.pem ssl_ca = /certs/ca-cert.pem
Restart the server.
$ sudo systemctl restart mariadb
Connect to the server using MariaDB Client:
$ sudo mariadb
SHOW GLOBAL VARIABLES LIKE 'have_ssl';
+---------------+-------+ | Variable_name | Value | +---------------+-------+ | have_ssl | YES | +---------------+-------+