feat(restatectl): add TLS client flags for connecting to mTLS-secured clusters#6
Open
rushabhvaria wants to merge 1 commit into
Open
feat(restatectl): add TLS client flags for connecting to mTLS-secured clusters#6rushabhvaria wants to merge 1 commit into
rushabhvaria wants to merge 1 commit into
Conversation
… clusters
Add --tls-ca, --tls-cert, and --tls-key flags to restatectl so it can
connect to Restate clusters running with strict mTLS on the fabric port.
Usage:
restatectl --tls-ca /certs/ca.pem --tls-cert /certs/client.pem \
--tls-key /certs/client-key.pem --address https://node:5122 cluster-status
Environment variables also supported:
RESTATECTL_TLS_CA, RESTATECTL_TLS_CERT, RESTATECTL_TLS_KEY
When TLS flags are provided, restatectl establishes a TLS connection using
the same tokio-rustls connector as inter-node fabric communication. When
omitted, behavior is unchanged (plaintext connection).
Changes:
- Add tls_ca, tls_cert, tls_key fields to NetworkOpts (cli-util)
- Re-export NetworkOpts from cli-util for downstream use
- Add grpc_channel_with_tls() that builds a custom TLS connector
- Add http, tokio-rustls, hyper-util, tower deps to restatectl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
--tls-ca,--tls-cert, and--tls-keyflags torestatectlso operators can connect to Restate clusters running with strict mTLS on the fabric port. This makesstrictmode fully usable without requiringoptionalmode as a workaround for admin operations.Motivation
With strict mTLS enabled on port 5122,
restatectl(which connects toNodeCtlSvc/ClusterCtrlSvcon the same port) would be unable to provision or manage the cluster without presenting a valid client certificate. This PR adds the necessary TLS client flags.Usage
When TLS flags are omitted, behavior is unchanged (plaintext connection, same as today).
Changes
crates/cli-util/src/opts.rstls_ca,tls_cert,tls_keytoNetworkOptswith env var supportcrates/cli-util/src/lib.rsNetworkOptsfor downstream cratestools/restatectl/src/util.rsgrpc_channel_with_tls()— custom TLS connector usingtokio-rustlstools/restatectl/Cargo.tomlhttp,tokio-rustls,hyper-util,towerdepsDesign
TlsCertResolverfromrestate-core::network::tlsto build the rustlsClientConfigtower::service_fnconnector wraps TCP with TLS per-connection (same pattern as inter-node outbound)--tls-certrequires--tls-key(enforced by clap)--tls-caalone enables server cert verification without client auth (one-way TLS)Verification
cargo check -p restate-cli-util -p restatectl— compilescargo clippy -D warnings— zero warningscargo fmt --check— clean