Wiki Operations
TLS and certificates
Encrypting Mirexa's connections — data-plane TLS with live certificate reload, inter-node mutual TLS with mirexa-cli certs, and TLS from the dashboard to the node.
Mirexa has three kinds of encrypted connection, each configured separately: clients to a node's data plane (optional TLS, any certificate you provide), nodes to each other on the replication listener (mandatory mutual TLS, certificates from Mirexa's own offline CA), and the dashboard to its node (optional TLS on the dashboard's side). TLS is off by default for the first and third. Session tokens are bearer credentials that anyone who sees a handshake can replay until they expire, so TLS belongs on every hop that crosses a network you do not control.
Data-plane TLS
security:
tls_enabled: true
cert_file: /etc/mirexa/tls/node.crt
key_file: /etc/mirexa/tls/node.key
min_version: "1.3" # or "1.2"
client_auth: none # see below
# ca_file: /etc/mirexa/tls/clients-ca.pem
# cipher_suites: [...] # only with min_version "1.2"
- Certificates are PEM files from any CA you choose (public or internal); the node does
not issue them. With
tls_enabledon,cert_fileandkey_fileare required. - Version. TLS 1.3 by default. With
min_version: "1.2",cipher_suitesmay restrict the TLS 1.2 suites by Go name; names Go classes as insecure are refused at startup (insecure cipher suite not permitted) even though config validation accepts them. TLS 1.3 suites are chosen by Go and cannot be configured. - Client certificates (
client_auth):none(default),request,require_any,verify_if_given,require_and_verify, the Gotls.ClientAuthTypevalues. The three that verify needca_file, a PEM bundle of the CAs client certificates must chain to. Client certificates authenticate the connection only; what a session may do is still decided by its token. - One configuration, three uses. The same TLS configuration serves the data plane, the
control listener when
control.use_tls: true(which requirestls_enabled), and a joining cluster node's calls to its seeds.
Rotating the certificate
Replace the files and send the process SIGHUP:
kill -HUP "$(pidof mirexa-server)"
The certificate and key are reloaded and new handshakes use them; established connections
are not interrupted. A reload that fails (unreadable file, mismatched pair) keeps the
previous certificate and prints [tls error] certificate reload failed: ... to stderr.
mirexa_tls_cert_reloads_total{result="success|error"} counts both.[1] Changing
ca_file, client_auth or min_version needs a restart.
Metrics
| Metric | Labels |
|---|---|
mirexa_ |
listener, version |
mirexa_ |
listener |
mirexa_ |
listener |
mirexa_ |
result |
Inter-node mutual TLS
A clustered node that serves copies of its partitions runs a replication listener
(cluster.replication_addr). Copies dial their primary there to pull data, and a primary
dials a copy to fetch a chunk for repair. This listener has no plaintext mode: setting
the address requires all three certificate files, and setting the files without the
address is a configuration error.
cluster:
replication_addr: 10.0.0.5:7300
replication_cert_file: /etc/mirexa/certs/node-1.crt
replication_key_file: /etc/mirexa/certs/node-1.key # must be mode 0600
replication_ca_file: /etc/mirexa/certs/ca.crt
Both directions use TLS 1.3 only and require a certificate from the other side that chains
to the cluster CA. The node's identity is in its certificate: the subject's common name is
mirexa-node-<node_id>, and the server side maps every verified peer to that node id
before any request is handled. A certificate the CA really signed whose common name is not a
node name is refused.[2]
Issuing certificates with mirexa-cli certs
mirexa-cli certs is an offline CA with three verbs and no daemon:
mirexa-cli certs ca -dir ./certs
Writes ca.key (mode 0600 — it mints node identities; guard it like the token signing
key) and ca.crt (copy to every node). The CA is Ed25519, valid 10 years by default
(-validity), and constrained to sign only leaf certificates; it refuses to overwrite an
existing CA, because replacing it strands every certificate it issued.
mirexa-cli certs issue -dir ./certs -node-id 1 -hosts 10.0.0.5,node1.internal
Writes node-1.key (0600) and node-1.crt, with common name mirexa-node-1, the given
addresses as subject alternative names (the addresses peers dial this node at), usable for
both client and server authentication, valid 90 days by default.
mirexa-cli certs inspect -cert ./certs/node-1.crt
Describes a certificate. See the mirexa-cli certs reference.
Give each node only its own key and certificate plus ca.crt. The node refuses to start if
its key file is readable by group or others.
Rotation and expiry
- Node certificates rotate without a restart: write the new pair over the configured
paths and send
SIGHUP. New handshakes use the new certificate; live replication streams continue.[3] mirexa_replication_cert_expiry_timestamp_secondsis the expiry (Unix time) of the certificate the listener presents now, and follows a rotation. Alert well before it: an expired certificate stops replication, which takes the node's copies out of the in-sync set.- The CA bundle is pinned at load. Trusting a new CA requires a restart of every node.
No revocation lists
There is no CRL or OCSP, by decision: a revocation list needs a distribution channel more available than the certificates it revokes. Instead:
- To stop a node being used, fence or drain it through the control plane; that stops routing to it immediately, which no certificate mechanism can.
- A leaked node key keeps authenticating until its certificate expires (90 days by default). If that is too long, issue a new CA and reissue every node's certificate, restarting nodes to pin the new CA.
Dashboard to node
The dashboard is a client of the node's data plane. With the node's data-plane TLS on:
dashboard:
upstream_addr: node1.internal:8080
upstream_tls: true
upstream_ca_file: /etc/mirexa/tls/ca.pem # empty: the system roots
The dashboard dials with TLS 1.3 minimum and verifies the node's certificate against
upstream_ca_file (or the system roots). With upstream_tls off it logs a warning at
startup that its token is replayable by anything on the path. TLS on this hop is supported
but not forced: the shipped deployment keeps it on one private Docker network. Turn it on
whenever the dashboard and node do not share one.
The browser-facing side of the dashboard is plain HTTP; terminate TLS in front of the reverse proxy (see deployment).
References
Source
CertReloader,NewTLSConfig— data-plane TLS and SIGHUP reload.buildTLS,startControlPlane— one TLS config for data, control and join.startReplicationListener.LoadNodeTLS,NodeTLS— mutual TLS policy and key-mode check.NewCA,Issue,NodeName,NodeIDFromCert.- /cmd/cli/certs.go.
upstreamTLS.
Tests
TestCertReloaderSIGHUP,TestCertReloaderReloadFailureKeepsPrevious(/internal/network/tls_test.go).TestTLS_RecordsHandshakeAndReloadMetrics(/internal/network/metrics_record_test.go).TestNodeTLS_MutualHandshakeDeliversTheClientIdentity,TestNodeTLS_AForeignCAIsRefusedInBothDirections,TestNodeTLS_RotationRearmsNewHandshakesWithoutDroppingOldStreams,TestLoadNodeTLS_RefusesALooseKeyMode,TestNodeTLS_NotAfterIsTheCertificateItServesNow(/internal/replication/tls_test.go).TestCA_AGrandchildCertificateNeverVerifies(/internal/nodecert/nodecert_test.go).
Further reading
External
- RFC 8446, The Transport Layer Security (TLS) Protocol Version 1.3 — https://www.rfc-editor.org/rfc/rfc8446
- Go
crypto/tls— https://pkg.go.dev/crypto/tls
CertReloader.ReloadandWatchSIGHUPin /internal/network/tls.go;TestCertReloaderSIGHUP,TestCertReloaderReloadFailureKeepsPrevious. ↩︎NodeIDFromCertin /internal/nodecert/nodecert.go; the replication listener's authentication interceptor in /internal/replication. ↩︎TestNodeTLS_RotationRearmsNewHandshakesWithoutDroppingOldStreams. ↩︎