Wiki Reference
mirexa-cli certs
The offline certificate authority for inter-node mutual TLS — ca, issue and inspect, every flag, the identity convention, validity and rotation.
mirexa-cli certs is a small offline certificate authority for the connections Mirexa nodes make
to each other for replication. Those connections use mutual TLS: each node presents a
certificate naming its node id, and each verifies the other's against a cluster CA. The tool
creates that CA, issues one certificate per node, and describes a certificate. Like
mirexa-cli token, it has no daemon and no network; it only reads and writes
files. Client connections to a node's data port use a different certificate, configured under
security.* — see TLS and certificates.
Usage
mirexa-cli certs ca -dir ./certs
mirexa-cli certs issue -dir ./certs -node-id 1 -hosts 10.0.0.1,node1.internal
mirexa-cli certs inspect -cert ./certs/node-1.crt
With no arguments it prints a usage summary and exits 1; help, -h, -help or --help
print it and exit 0.
ca
| Flag | Default | Meaning |
|---|---|---|
- |
required | Directory to write ca. and ca. into; created if missing. |
- |
mirexa cluster CA |
The CA certificate's common name. |
- |
87600h (10 years) |
How long the CA certificate lives. |
Writes ca.key (the CA's private key, PEM, mode 0600) and ca.crt (PEM, 0644; copy it to
every node). The CA is a self-signed Ed25519 certificate that may sign certificates only
(KeyUsage: CertSign) and only leaf certificates (path length zero), so a stolen node
certificate cannot be used to mint further identities: a chain through one never verifies
(TestCA_AGrandchildCertificateNeverVerifies).[1]
ca refuses to overwrite an existing CA. If ca.crt or ca.key already exists in the
directory it stops with an error. Replacing the CA silently would strand every certificate it
signed, and the symptom would arrive later as replication handshakes failing across the fleet.
To replace a CA, delete its files deliberately first.
issue
| Flag | Default | Meaning |
|---|---|---|
- |
required | Directory holding ca. and ca.; the node's files are written beside them. |
- |
required | The node's cluster id (cluster.), non-zero. |
- |
required | Comma-separated addresses peers dial this node at. IP literals become IP subject alternative names, anything else DNS names. |
- |
2160h (90 days) |
How long the certificate lives. |
Writes node-<id>.key (PEM, 0600) and node-<id>.crt (PEM, 0644) and prints the
certificate's expiry. An existing pair for the same id is overwritten without warning.
The certificate:
- has common name
mirexa-node-<id>— the identity convention: a node reads its peer's id from this name, and refuses a certificate the cluster CA signed whose name is not of that form; - is valid for both client and server authentication, because a node both dials (as a copy tailing its primary) and serves (as a primary for other partitions);
- starts five minutes in the past, to tolerate clock skew;
- is an Ed25519 certificate signed by the CA.
issue refuses a CA key file whose mode grants anything to group or others, as the node
does when it loads a node key (TestLoadNodeTLS_RefusesALooseKeyMode).[2]
inspect
| Flag | Default | Meaning |
|---|---|---|
- |
required | A PEM certificate file. |
subject: mirexa-node-1
node id: 1
issuer: mirexa cluster CA
not before: 2026-10-30T09:43:00Z
not after: 2027-01-28T09:48:00Z
dns sans: node1.internal
ip sans: 10.0.0.1
is ca: false
(Field layout from the source; the values above are illustrative.) The node id line reads
(none — this is a CA certificate) for a CA, and INVALID — <reason> for a leaf whose name
breaks the convention. not after is followed by (EXPIRED) once it has passed, or by
(expires in <hours> — rotate now) within 14 days of it.
Using the files on a node
Give each node its own key and certificate plus ca.crt:
cluster:
enabled: true
node_id: 1
replication_addr: 10.0.0.1:9300
replication_cert_file: /etc/mirexa/certs/node-1.crt
replication_key_file: /etc/mirexa/certs/node-1.key
replication_ca_file: /etc/mirexa/certs/ca.crt
The replication listener speaks TLS 1.3 only. See the configuration reference and Replication.
Validity, rotation and revocation
- Rotation needs no restart. Issue a new certificate, replace the node's files, and send
the node
SIGHUP: new handshakes use the new certificate, and replication streams already open keep running (TestNodeTLS_RotationRearmsNewHandshakesWithoutDroppingOldStreams). The gaugemirexa_replication_cert_expiry_timestamp_secondsshows the expiry of the certificate the node presents now, so it can be alerted on. - Trusting a new CA needs a restart. The CA bundle is read once, at startup.
- There is no revocation list. Expiry is the revocation mechanism, which is why node certificates default to 90 days. To stop a node being used, fence or drain and decommission it through the control plane, which stops it being routed to at once; see Joining, draining and decommissioning nodes. If a node's key leaked, its certificate keeps authenticating until it expires; if that is too long, create a fresh CA, reissue every node and roll the fleet.
- Guard
ca.keylike the token signing key: whoever holds it can mint any node identity.
Exit status
0 on success; 1 on any error, printed as mirexa-cli certs: <reason>, including -h on a
sub-command.
References
Source
- /cmd/cli/certs.go — the three commands, the overwrite refusal,
inspect's output. - /internal/nodecert/nodecert.go —
NewCA,Issue, the identity convention (NodeName,NodeIDFromCert), key-file I/O and the mode check, default validities. - /internal/replication/tls.go —
LoadNodeTLS: TLS 1.3, mutual verification, SIGHUP reload. - /internal/config/config.go — the
cluster.replication_*settings.
Tests
TestCLI_SetupFromZero,TestCLI_CARefusesToOverwriteItself,TestCLI_IssueRequiresItsInputs,TestCLI_UnknownSubcommandFails— /cmd/cli/certs_test.go.TestCA_AGrandchildCertificateNeverVerifies,TestIssue_ChainVerifiesForBothUsages,TestIssue_SANsSplitHostsFromIPs,TestIssue_Refusals,TestPEM_RoundTripAndKeyModeRefusal,TestLoadCA_RefusesALeafCertificate,TestNodeIdentity_IssuerAndVerifierAreOneConvention— /internal/nodecert/nodecert_test.go.TestNodeTLS_RotationRearmsNewHandshakesWithoutDroppingOldStreams,TestNodeTLS_AForeignCAIsRefusedInBothDirections,TestNodeTLS_AnExpiredClientCertificateIsRefused,TestLoadNodeTLS_RefusesALooseKeyMode,TestNodeTLS_NotAfterIsTheCertificateItServesNow— /internal/replication/tls_test.go.
Further reading
- TLS and certificates, Replication
- mirexa-server — what
SIGHUPdoes. - mirexa-cli token
External
- RFC 5280: Internet X.509 Public Key Infrastructure Certificate and CRL Profile, D. Cooper et al. — https://www.rfc-editor.org/rfc/rfc5280
- RFC 8410: Algorithm Identifiers for Ed25519, Ed448, X25519, and X448 for Use in the Internet X.509 PKI, S. Josefsson and J. Schaad — https://www.rfc-editor.org/rfc/rfc8410
- RFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3, E. Rescorla — https://www.rfc-editor.org/rfc/rfc8446
NewCAin /internal/nodecert/nodecert.go;runCAin /cmd/cli/certs.go. ↩︎Issue,LoadKeyPEMandclockSkewGracein /internal/nodecert/nodecert.go;runIssuein /cmd/cli/certs.go. ↩︎