skip to content

After setting port 0 and tls-port on a Redis node, which hops can still be plaintext or unauthenticated, and how do you close each one?

level: seniorimportance: should knowfreq 33%

answer

  1. port 0 closes one listener
  2. the replica dials out on its own terms
  3. the bus has no authentication of its own
  4. chaining to a CA is not identity

basics

~20 s

Replicas dial out in plaintext until tls-replication yes; the cluster bus and MIGRATE stay plain, and the bus unauthenticated, until tls-cluster yes. Under a shared CA add tls-expected-peer-name, since by default any certificate chaining to that CA passes.

solid answer

~50 s

`port 0` and `tls-port` only change which client listeners a node offers. A replica's outgoing link is governed by `tls-replication`, on the replica, and without it the replica dials plain TCP; set it on every node, because any node can become a replica. The cluster bus and `MIGRATE` connections follow `tls-cluster`. Without it the bus is plaintext and has no authentication at all: any host reaching the port can send `MEET` and be added as a node. With it, every peer must present a certificate verifying against the CA, in both directions, whatever `tls-auth-clients` says. Since 8.10.2 a node without `tls-cluster` warns at startup, and `cluster-bus-port-protected-mode yes` turns that into a refusal; the default is `no`. Last, chain validation only proves a certificate came from your CA, so under a shared CA set `tls-expected-peer-name` as well.

code

conf · 11 lines
conf
port 0
tls-port 6379
tls-cert-file /etc/redis/tls/node.crt
tls-key-file /etc/redis/tls/node.key
tls-ca-cert-file /etc/redis/tls/ca.crt
tls-replication yes

cluster-enabled yes
tls-cluster yes
cluster-bus-port-protected-mode yes
tls-expected-peer-name node.my-redis-cluster.example.com

go deeper

for a junior

Recall that clients, replicas and the cluster bus each have their own setting: tls-port for clients, tls-replication for replicas, and tls-cluster for the bus.

for a middle

Explain that the replica chooses TLS because it dials out, that tls-replication belongs on every node, and that tls-cluster also makes a CA mandatory and covers MIGRATE.

for a senior

Lead with the bus being unauthenticated, not merely unencrypted. Set cluster-bus-port-protected-mode deliberately, know its default is no, and add tls-expected-peer-name when the CA is shared.

for a principal

Decide the CA model first: a dedicated per-cluster CA makes chain validation sufficient, while a shared one adds SAN issuance and a peer-name setting on every node. Own that choice for the whole estate.

## What port 0 actually closes `port 0` removes the plain TCP listener for clients, and `tls-port` adds the TLS one. Everything else a Redis node does on the network has its own switch. A node can pass a port scan of its client port and still replicate and gossip in clear text. ## Replication: tls-replication A replica opens the connection to its primary, so the choice is made on the replica's side. By default it does not attempt TLS. That matters for three reasons: - The stream carries the data set: the RDB transfer on a full sync and every write afterwards. - The `AUTH <masteruser> <masterauth>` credentials travel on it. - A primary treats a replica like any client, so `tls-port` and `tls-auth-clients` apply to it too. With the default, the replica must present a certificate. If the primary has `port 0`, a replica missing the directive cannot sync at all, which at least fails loudly. If the primary kept its plain port, replication quietly stays plaintext. Set `tls-replication yes` on every node, because a primary becomes a replica after a failover. The same switch selects the connection type for Redis Cluster's replication and atomic slot migration channels, and Sentinel reads it too: to choose how it connects to instances, and to decide whether its own port takes TLS. ## Cluster bus: tls-cluster The bus is the node-to-node protocol. Redis's own documentation is blunt about it: it has no authentication of its own. Any host able to reach the port can speak the protocol, and a `MEET` from an unknown host is enough to have it added as a node with its gossip trusted. `tls-cluster yes` is what changes that, and it does more than encrypt: - Every peer must present a certificate that verifies against the CA, in both the accepting and the connecting direction. - Configuring a CA becomes mandatory. - `tls-auth-clients` has no say, so relaxing the client port cannot weaken the bus. - `MIGRATE` connections between nodes use the same connection type. The default bus port is the client port plus 10000, and `tls-cluster` picks which client port: `tls-port` when on, `port` when off. So a node with `port 0` and no `tls-cluster` computes its bus port from 0 and listens in plaintext on 10000, unless `cluster-port` says otherwise. ## cluster-bus-port-protected-mode Release 8.10.2 added two things for a node with `cluster-enabled yes` and no `tls-cluster`: a startup warning that the bus is unauthenticated, and this option. | Setting | Node without `tls-cluster` | |---|---| | `no` (default) | Starts and logs the warning | | `yes` | Refuses to start | The name suggests a default-on safeguard like `protected-mode`, and that is the trap: it defaults to `no`. `redis.conf` advises enabling it unless untrusted hosts cannot reach the bus port, for instance because a firewall blocks it. Choosing `yes` means an unauthenticated bus can no longer happen by accident. Keeping `no` should mean that something really does keep untrusted hosts away from the port. ## Who is the peer? CA chain versus tls-expected-peer-name By default Redis validates only that a peer certificate chains to the trusted CA and has not expired. It does not check that the certificate belongs to the peer being contacted. Under a dedicated per-cluster CA, which is the recommended model, those amount to the same thing. Under a shared or organisational CA they do not. A machine in the middle holding any certificate from it can impersonate a primary and capture the `AUTH` a replica sends, and such a certificate can also open a bus connection and forge a `FAIL` message about a healthy node. `tls-expected-peer-name` closes this: 1. Issue every node a certificate carrying one cluster-identity name in its SAN. 2. Set that name on every node, for outgoing connections and for the inbound bus. 3. If you use `tls-client-cert-file`, put the SAN there too, or peers reject this node and the cluster does not form. It does not apply to ordinary clients on the data port. ## The checklist | Hop | Default | Close it with | |---|---|---| | Client to server | Plain on 6379 | `tls-port`, `port 0` | | Replica to primary | Plain | `tls-replication yes` on every node | | Cluster bus, `MIGRATE` | Plain, bus unauthenticated | `tls-cluster yes` | | Peer identity under a shared CA | Not checked | `tls-expected-peer-name` |

  • A cluster has tls-cluster yes but not tls-replication. What is still exposed?
    The bus is protected, but replicas keep dialling their primaries in plaintext, on the plain port the node advertises, if there is one. The data set and the `masterauth` credentials cross the network unencrypted. The two directives are independent because they govern different connections. If the nodes also have `port 0`, replication has nowhere to connect and fails instead, so the mistake shows up during the rollout.
  • Does tls-expected-peer-name protect the client port as well?
    No. It applies to server-to-server TLS: outgoing connections to a primary, cluster peer or `MIGRATE` target, and inbound cluster bus connections. Ordinary clients on the data port are identified by `AUTH` and ACLs, and optionally by `tls-auth-clients-user`. It is also opt-in, with no peer-name check when unset.
  • Why is a dedicated per-cluster CA the recommended model?
    Because that CA signs certificates only for your own nodes, chaining to it really does mean being a legitimate peer, and no name check is needed. A shared CA also signs machines outside the deployment, so the chain alone proves little. Then you need `tls-expected-peer-name`, and SANs on every certificate the node presents.

  • With port 0 set, nothing on the node can be plaintext any more
  • tls-replication belongs on the primary, which offers TLS to its replicas
  • AUTH or requirepass protects the cluster bus from unknown hosts
  • cluster-bus-port-protected-mode defaults to yes, like protected-mode
  • tls-auth-clients no weakens certificate checks on the cluster bus
  • A certificate that chains to the CA proves it belongs to that specific peer

Assumes Redis 8.10.3; cluster-bus-port-protected-mode and the startup warning for an unauthenticated bus arrived in 8.10.2, so earlier releases do not warn.