Cluster transport security

Authenticate and encrypt traffic between nodes with mutual TLS, rotate certificates, and understand what a cluster node is trusted with.

Cluster transport security

Nodes call each other over the cluster RPC endpoint (backend.endpoints.worker, port 6002 by default). backend.cluster.mode controls how that traffic is secured.

ModeForBehaviour
SingleNode (default)One nodeTLS with a certificate generated at startup and trusted only by the same process. Every other connection is refused. No setup.
MutualTlsMulti-node clustersTLS 1.3 (TLS 1.2 minimum). Both sides present a certificate issued by the cluster CA or pinned by fingerprint.
PlaintextIsolated test networksNo authentication or encryption. Requires plaintextPeerTrust.

A peer that proves a cluster certificate is a cluster node. Any other peer is refused, or, when rejectUntrustedPeers is false, connected but allowed no calls.

Trust between nodes

A cluster node is fully trusted. It can act as the deployment itself and on behalf of any user, in every account. Protect node certificates and private keys as you would the Global administrator's credentials:

  • Keep private keys readable only by the Logship service account, and the CA key offline.
  • Issue cluster certificates only to cluster nodes, or restrict them with allowedNames or pinned fingerprints.
  • When a node or its key may be compromised, remove its trust (see Certificate rotation) before anything else.

A node checks every request it receives against the caller's access, and trusts the calls it then makes to other nodes, with one exception: the database node checks again the calls it serves for a user, such as deleting or reading a dashboard, an incident or a group, against that user's access (Checked cluster calls lists them). Search executors run the query plan a query node sends them without checking it: the query node has already decided which tables and columns the caller may read.

Single node

No configuration is needed. The node refuses to start in SingleNode mode when backend.endpoints.master is not its own worker endpoint, because that makes it part of a multi-node cluster.

Multi-node with mutual TLS

Each node needs a private key, a certificate issued by the cluster CA, and the CA certificate. Every node certificate must allow both server and client authentication.

Create the cluster CA

Run once, on a workstation rather than a cluster node. Keep cluster-ca.key offline; nodes only need cluster-ca.crt.

openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -noenc -days 3650 \
  -subj "/CN=Logship Cluster CA" -keyout cluster-ca.key -out cluster-ca.crt \
  -addext "basicConstraints=critical,CA:TRUE" \
  -addext "keyUsage=critical,keyCertSign,cRLSign"

The PowerShell steps require PowerShell 7.4 or later.

Issue a node certificate

Repeat for every node. Copy <node>.crt, <node>.key and cluster-ca.crt to the node and make the key readable only by the Logship service account.

openssl req -newkey ec -pkeyopt ec_paramgen_curve:P-256 -noenc \
  -subj "/CN=node-1.logship.internal" -keyout node-1.logship.internal.key -out node-1.logship.internal.csr
printf "basicConstraints=critical,CA:FALSE\nkeyUsage=critical,digitalSignature\nextendedKeyUsage=serverAuth,clientAuth\nsubjectAltName=DNS:node-1.logship.internal,IP:10.0.0.11\n" > node-1.logship.internal.ext
openssl x509 -req -in node-1.logship.internal.csr -CA cluster-ca.crt -CAkey cluster-ca.key -CAcreateserial \
  -days 365 -extfile node-1.logship.internal.ext -out node-1.logship.internal.crt
chmod 600 node-1.logship.internal.key

Configure every node

{
  "backend": {
    "cluster": {
      "mode": "MutualTls",
      "tls": {
        "certificatePath": "/etc/logship/node.crt",
        "privateKeyPath": "/etc/logship/node.key",
        "trustedCaPath": "/etc/logship/cluster-ca.crt"
      }
    }
  }
}

Or with environment variables:

LS_backend__cluster__mode=MutualTls
LS_backend__cluster__tls__certificatePath=/etc/logship/node.crt
LS_backend__cluster__tls__privateKeyPath=/etc/logship/node.key
LS_backend__cluster__tls__trustedCaPath=/etc/logship/cluster-ca.crt

Every node also needs the same token signing keys; a node in MutualTls or Plaintext mode refuses to start without them.

At startup the node logs Cluster transport: mutual TLS with certificate .... It refuses to start when the files cannot be read, the key does not match, or its own certificate is not trusted by its own trust settings.

Settings

backend.cluster:

NameTypeDefaultDescription
modeStringSingleNodeSingleNode, MutualTls or Plaintext.
plaintextPeerTrustString—Plaintext mode only, and required there: Untrusted or ClusterNode.
tlsObject—MutualTls mode only. Setting it in another mode is a configuration error.

backend.cluster.tls:

NameTypeDefaultDescription
certificatePathString—Node certificate. PEM, optionally followed by intermediates, or PKCS#12 (.pfx, .p12).
privateKeyPathString—PEM private key. Required with a PEM certificate; not used with PKCS#12.
certificatePasswordString—Password of an encrypted PEM key or a PKCS#12 file.
trustedCaPathString—PEM bundle of CA certificates that issue node certificates.
trustedThumbprintsString[][]SHA-256 fingerprints of individually trusted certificates. Colons are allowed.
allowedNamesString[][]When set, a peer certificate must carry one of these DNS names.
rejectUntrustedPeersBooleantruefalse accepts peers that fail validation as untrusted instead of closing the connection.
reloadIntervalTimeSpan00:01:00How often certificate files are checked for changes.

Set trustedCaPath, trustedThumbprints, or both. Peers are accepted when their certificate is within its validity period, chains to a trusted CA or matches a fingerprint, carries an allowed name when allowedNames is set, and allows server authentication (when the peer is a server) or client authentication (when it is a client). A pinned certificate with no extended key usage extension is allowed both. Revocation lists are not checked.

⚠️ Warning

With trustedCaPath and no allowedNames, every certificate the CA issues for server and client authentication is trusted as a cluster node, with full access to every account. The node logs a warning at startup in that case. Use a CA that issues certificates only for this cluster's nodes, or list the node names in allowedNames.

Use pinned fingerprints instead of a CA for small, fixed clusters. Print a fingerprint with openssl x509 -in node.crt -noout -fingerprint -sha256.

Certificate rotation

Certificate, key and CA files are reloaded without a restart. A node checks the files at most once per reloadInterval when it opens or accepts a connection. New connections use the new files; established connections keep their session. Files that cannot be used are logged as an error and the previous certificate stays in use until they are fixed. A warning is logged when the node certificate expires within 30 days.

Changes to mode, file paths, trustedThumbprints or allowedNames require a restart. Restart nodes one at a time.

To replace a node certificate, write the new key and certificate over the old files. Peers accept it as long as it chains to a trusted CA or is pinned.

To replace the CA:

  1. Append the new CA certificate to trustedCaPath on every node.
  2. Issue new node certificates from the new CA and install them.
  3. Remove the old CA certificate from trustedCaPath on every node.

Wait at least reloadInterval between steps. To remove a node from the cluster, remove its fingerprint from trustedThumbprints, or replace the CA without issuing that node a certificate.

Changing the mode

Nodes in different modes cannot connect, so change the mode on every node, then restart them together.

Plaintext mode

🚫 Danger

In Plaintext mode anyone who can reach the cluster port can read cluster traffic. With plaintextPeerTrust set to ClusterNode, they can also act as a cluster node with full access to every account.

plaintextPeerTrust applies to every TCP peer, because none can be authenticated:

  • ClusterNode: every peer is trusted. Restrict the port with a firewall.
  • Untrusted: no peer is trusted, so every call is refused, including calls between nodes and a node's calls to itself. The cluster cannot run in this setting. It does not make Plaintext mode safe: it only refuses every call.

The node logs a warning at startup and, at most once a minute, when it accepts plaintext connections.

Troubleshooting

Refused connections are logged at most once a minute per listener with the latest reason.

Log messageCause
the peer sent plaintextThe peer runs in Plaintext mode.
does not chain to a trusted cluster authorityThe peer certificate was issued by another CA, or its intermediates are missing.
is not pinnedPinned trust only, and the fingerprint is not in trustedThumbprints.
is outside its validity periodThe certificate expired or is not yet valid. Check the node clocks.
the peer presented no certificateThe peer has no client certificate configured.
carries none of the allowed namesThe certificate has no DNS name listed in allowedNames.
The TLS handshake with ... failed: no TLS responseThe remote node runs in Plaintext mode.