Skip to content

Add TLS encryption#1532

Open
mahdi-orbitalize wants to merge 5 commits into
interuss:masterfrom
Orbitalize:add_tls_encryption
Open

Add TLS encryption#1532
mahdi-orbitalize wants to merge 5 commits into
interuss:masterfrom
Orbitalize:add_tls_encryption

Conversation

@mahdi-orbitalize

Copy link
Copy Markdown

What I did:

  • consensus.go was updated to enable client-side (handled by rafthttp if we provide a transport.TLSInfo when constructing a rafthttp.transport) and server-side (handled by extracting a tls.Config from the transport.TLSInfo and passing it to the server at construction plus using ListenAndServeTLS instead of ListenAndServe)
  • gen-cert.sh was introduced to make certificates (with the number of nodes as a parameter). Note that it's made to work for local setups (i.e. address is localhost or 127.0.0.1). I also provided example certificates to save the trouble of generating them.
  • params.go was updated to support passing the paths to the TLS certificates as a parameter. It also enforces the use of HTTPS instead of HTTP for the peers' URLs. Also, more tests were added to params_test.go to test the new features.
  • start_cluster.sh was created to quickly test a 3-node setup with TLS and easily inspect logs.

How I tested it:

  • Verified that logs where similar when trying with/without encryption (and that it fails when it's supposed to fail)

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 16, 2026

Copy link
Copy Markdown

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

@the-glu the-glu left a comment

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.

Could you squash your changes in one commit, leaving only the one from the base PR and the one from your PR ? That would avoid mixing changes

Comment thread build/test-certs/raft-certs/ca.crt Outdated
Comment thread pkg/raftstore/params/params.go Outdated
Comment thread pkg/raftstore/consensus/consensus.go Outdated

@the-glu the-glu left a comment

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.

Can you make it optional, with a

raft_insecure

flag, default to false?

If set to true, don't require https + log a warning about beeing run in an insecure mode. If there are certificate, don't verify them (no CA check / trust blindly client certificates) . If there is no certificate, don't enable https at all.

It will be useful for local deployments and testing (to validate that test fail if mis configured).

Thanks

Comment thread pkg/raftstore/params/params.go Outdated
@barroco barroco added the dss-raft Relating to the application-layer consensus implemenation based on raft label Jun 17, 2026
@mahdi-orbitalize

Copy link
Copy Markdown
Author

Can you make it optional, with a

raft_insecure

flag, default to false?

If set to true, don't require https + log a warning about beeing run in an insecure mode. If there are certificate, don't verify them (no CA check / trust blindly client certificates) . If there is no certificate, don't enable https at all.

It will be useful for local deployments and testing (to validate that test fail if mis configured).

Thanks

Adressed in 64f3f9a

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

Labels

dss-raft Relating to the application-layer consensus implemenation based on raft

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants