A CA for One Raft Cluster
Set up a private certificate authority for one MariaDB Raft Cluster: node certificates, revocation lists, certificate replacement, and CA rotation
This page sets up a private certificate authority (CA) for one Raft cluster. It covers node certificates, revocation, and rotation. The commands use OpenSSL 3.
A Trust Anchor for Each Cluster
Under raft_tls_mode=VERIFY_CA, a node accepts a peer when the peer certificate chains to a CA certificate in raft_ssl_ca. The node does not check a host name or a subject. Thus each certificate that chains to the trust anchor, and has the necessary extended key usage, is accepted as a node of the cluster.
The trust anchor must be a self-signed root CA. A node does not accept a chain that ends at an intermediate CA in raft_ssl_ca.
Use a root CA that signs only the node certificates of this cluster:
A new key pair. The key identifies the CA, not the name. Do not use the key of a CA again, for another cluster or for a new CA of the same cluster.
A unique subject. A node finds the issuer of a certificate, and the revocation list of the issuer, by the subject name. Two CAs with the same subject break these lookups. Put the cluster name and a CA generation in the subject, for example
/O=Example/OU=MariaDB Raft/CN=cluster1 CA 1. If cluster names can be the same in different environments, add the environment name.No other use. Do not use the CA for other clusters, for SQL clients, for the server certificate of SQL connections, or for state transfer data.
The key off the nodes. Keep the CA key on a host that is not a node, or in an HSM. Keep it offline when you do not issue certificates or revocation lists.
Organization Root CAs
Do not use the root CA of your organization as the trust anchor of a cluster. Also do not use a root CA that more than one cluster shares.
An issuing CA for each cluster under a shared root does not isolate the clusters. raft_ssl_ca must contain the shared root. Then a node accepts each certificate under that root that has serverAuth or clientAuth: the nodes of other clusters, and often other hosts of the organization.
If your organization operates the PKI, ask for a separate root CA for each cluster.
Create the CA
On the CA host, make a directory for the CA:
Write ca.cnf:
The policy keeps only O and CN in a node certificate subject. Add other fields to policy_node if you use them.
Create the CA certificate and key. Give each CA a subject of its own. A new CA for a rotation needs a different subject, see Rotate the CA.
Lifetimes
The example values are:
CA certificate
20 years
-days 7300
Node certificate
3 years
default_days = 1095
Revocation list
180 days
default_crl_days = 180
Use the values of your organization policy. Keep these rules:
The CA outlives the node certificates. When the CA expires, each node certificate that it signed fails validation, and the cluster stops.
openssl caissues a certificate that expires after the CA. Rotate the CA at least one node certificate lifetime before it expires.A longer node certificate lifetime needs revocation. A stolen key is valid until you revoke the certificate or it expires. Without revocation lists, use a shorter lifetime.
An expired revocation list stops the cluster. New connections fail, a node does not start, and
FLUSH SSLfails. A revocation takes effect when you put a new list in force, not when the old list expires. Thus a long list lifetime does not delay a revocation. Renew the list at half of its lifetime, see Renew the Revocation List.
Create the first revocation list. It is empty:
Configure a revocation list from the start. raft_ssl_crl is read-only, so adding it later needs a restart of each node.
Issue a Node Certificate
Do these steps for each node. The example is for node1:
The v3_node certificate has serverAuth and clientAuth. The node uses it for the connections it accepts and for the connections it initiates.
If your policy gives one TLS role to each certificate, issue the node certificate with -extensions v3_server instead. Then issue a clientAuth certificate for the connections that the node initiates:
Check the certificates:
Install the Files on a Node
Copy ca.crt, ca.crl, and the certificate and key of the node to the node. Only the account that runs the server must have access to a key file. The node does not start if all accounts can write a key file. It logs a warning if the group or other accounts have any access.
Add to the server configuration of the node:
For a separate client certificate, add:
At startup, the node validates its own certificates against the CA and the revocation list. If a check fails, the node does not start, and the error log gives the reason. See TLS Configuration Checks.
To see the TLS in force, and when each peer certificate expires:
This query shows only the connections that the local plugin opens. See Monitoring Cluster Connections.
Put Files in Force: FLUSH SSL
A node reads its TLS files when it builds a TLS context. After you replace a file, run FLUSH SSL on each node that has the new file:
Keep the same paths. The paths are read-only.
FLUSH SSL applies to the connections that start after it. Established connections continue with the old material.
If the new files fail the checks, FLUSH SSL fails and the node keeps the old material. Correct the files and run it again.
On a node that is not ready, for example a node without quorum, set wsrep_dirty_reads=ON in the session before FLUSH SSL.
Renew the Revocation List
A revocation list has a Next Update time. With default_crl_days = 180, this time is 180 days after you create the list. After this time, the list is expired. Then each new connection fails validation, a node does not start, and FLUSH SSL fails.
Create a new list at half of its lifetime, and put it in force on each node:
Copy ca.crl to each node, then run FLUSH SSL on each node.
INFORMATION_SCHEMA.WSREP_CONNECTIONS does not show the revocation list. Monitor the Next Update time of the list on each node, and the expiry of the CA certificate:
Revoke a Node Certificate
On the CA host, revoke the certificate and create a new list:
If the node has a separate client certificate, revoke it too.
Copy ca.crl to each node, then run FLUSH SSL on each node.
Established connections of the revoked node are not closed. The other nodes refuse the revoked node when it connects again, for example after a restart or a network failure. To remove the node at once, stop it.
Replace a Node Certificate
Replace a certificate before it expires, or when its key is compromised:
Issue a new certificate and key, as in Issue a Node Certificate.
On the node, write the new files over the old files. Keep the paths and the permissions.
Run
FLUSH SSLon the node.
If the key is compromised, also revoke the old certificate.
Rotate the CA
To replace the CA, trust both CAs for a period:
Create a new CA in a new directory, as in Create the CA. Give it a new key and a different subject, for example
"/O=Example/OU=MariaDB Raft/CN=cluster1 CA 2". Create its empty revocation list.Put both CA certificates in one file for
raft_ssl_ca, and both revocation lists in one file forraft_ssl_crl. On the CA host, in/etc/mysql:Copy the two files to each node, then run
FLUSH SSLon each node. Each CA needs a current list, because revocation is checked for each certificate in the chain.Issue a new certificate for each node from the new CA. Include the separate client certificate, if the node has one. On each node, replace the files and run
FLUSH SSL.When each node has a certificate from the new CA, put only the new CA in the
raft_ssl_cafile and only its list in theraft_ssl_crlfile. Then runFLUSH SSLon each node.
In step 4, FLUSH SSL fails on a node that still has a certificate from the old CA. The node keeps the old material. Replace the certificate, then run FLUSH SSL again.
Renew the list of each CA during the period, as in Renew the Revocation List.
If you use raft_ssl_capath and raft_ssl_crlpath instead of files, put the certificates and lists of both CAs in the directories, and run openssl rehash on each directory.
State Transfer and SQL Connections
The cluster CA applies to the cluster connections and to the state transfer request. It does not apply to the state transfer data or to SQL connections. See State Transfer and SQL Connections.
This page is: Copyright © 2026 MariaDB. All rights reserved.
Last updated
Was this helpful?

