Skip to content

[raft] mTLS implementation - #1810

Open
ahmadelrouby wants to merge 1 commit into
interuss:masterfrom
Orbitalize:node-authentication-optional-mtls
Open

ahmadelrouby wants to merge 1 commit into
interuss:masterfrom
Orbitalize:node-authentication-optional-mtls

Conversation

@ahmadelrouby

@ahmadelrouby ahmadelrouby commented Oct 22, 2026 •

Copy link
Copy Markdown

Part of #1734. This is the base implementation: mTLS between Raft nodes is optional for now. A stack of follow-up PRs will make it required and run the end-to-end tests (CI raft and raft-cluster jobs) with mTLS.

  • without the three flags, Raft traffic stays plain HTTP and a warning is logged
  • the same etcd TLSInfo is used for the transport and the listener, as etcd does for its own peers
  • a peer is accepted when its certificate is signed by a trusted CA, without matching its source IP (SkipClientSANVerify)
  • peer URLs must use https with mTLS and http without
  • logging rejected handshakes comes in a follow-up PR

Tested with unit tests for the flags and peer URLs.

Signed-off-by: Ahmad ElRouby <18573669+ahmadelrouby@users.noreply.github.com>
@linux-foundation-easycla

linux-foundation-easycla Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: ahmadelrouby / name: Ahmad ElRouby (40ee77c)

func (c *Consensus) initTransport(ctx context.Context, nodeID uint64, clusterID uint64, peers map[uint64]*url.URL, tlsInfo etcdtransport.TLSInfo) error {
nodeIDStr := fmt.Sprintf("%d", nodeID)
if tlsInfo.Empty() {
c.logger.Warn("Raft nodes do not authenticate each other: set --raft_cert_file, --raft_key_file and --raft_trusted_ca_file to enable mutual TLS")

@the-glu the-glu Oct 22, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to prevent insecure operation unless user specify something like --insecure explicitly.


// newTLSInfo returns the mutual TLS settings between Raft nodes, empty when mutual TLS is disabled.
// A peer must present a certificate signed by a CA of the trusted CA file. The certificate is not matched against the
// peer's source IP, which differs from the addresses in the certificate behind NAT or a load balancer.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's the peer target address no? not the source ip ?


flag.StringVar(&connectParameters.CertFile, "raft_cert_file", "", "PEM certificate of this node, presented to the other Raft nodes. Setting it alongside --raft_key_file and --raft_trusted_ca_file enables mutual TLS between Raft nodes. Peer URLs must then use https.")
flag.StringVar(&connectParameters.KeyFile, "raft_key_file", "", "PEM private key of --raft_cert_file.")
flag.StringVar(&connectParameters.TrustedCAFile, "raft_trusted_ca_file", "", "PEM bundle of the CA certificates trusted to sign the certificates of the other Raft nodes, usually one CA per participant.")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have parameters in a raft_tls_* to group them + remove 'trusted' (it's a CA so it's trusted).

Comment thread pkg/raftstore/README.md
- A connecting peer is accepted when its certificate is signed by a trusted CA. The certificate is not matched against the peer's source IP, which differs from the addresses in the certificate behind NAT or a load balancer. Other connections are dropped during the TLS handshake, before any Raft message is read.
- With mutual TLS enabled every peer URL must use `https`, otherwise `http`. A node with a peer URL of the other scheme, or with only some of the three flags set, does not start.
- Restart the node after replacing its certificate or the trusted CA bundle.
- Without the flags, Raft traffic is unauthenticated plain HTTP and a warning is logged. Mutual TLS will become mandatory (see [#1734](https://github.com/interuss/dss/issues/1734)).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would left the option to be in insecure mode for development purpose (with the explicit flag, like CRDB).

@barroco

barroco commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

/easycla

@the-glu the-glu mentioned this pull request Oct 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants