Skip to content

feat(restatectl): add TLS client flags for connecting to mTLS-secured clusters#6

Open
rushabhvaria wants to merge 1 commit into
mainfrom
feature/restatectl-tls-support
Open

feat(restatectl): add TLS client flags for connecting to mTLS-secured clusters#6
rushabhvaria wants to merge 1 commit into
mainfrom
feature/restatectl-tls-support

Conversation

@rushabhvaria
Copy link
Copy Markdown
Owner

Summary

Add --tls-ca, --tls-cert, and --tls-key flags to restatectl so operators can connect to Restate clusters running with strict mTLS on the fabric port. This makes strict mode fully usable without requiring optional mode as a workaround for admin operations.

Motivation

With strict mTLS enabled on port 5122, restatectl (which connects to NodeCtlSvc/ClusterCtrlSvc on 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

# With flags
restatectl --tls-ca /certs/ca.pem \
           --tls-cert /certs/admin.pem \
           --tls-key /certs/admin-key.pem \
           --address https://node:5122 \
           cluster-status

# With environment variables
export RESTATECTL_TLS_CA=/certs/ca.pem
export RESTATECTL_TLS_CERT=/certs/admin.pem
export RESTATECTL_TLS_KEY=/certs/admin-key.pem
restatectl --address https://node:5122 cluster-status

When TLS flags are omitted, behavior is unchanged (plaintext connection, same as today).

Changes

File Change
crates/cli-util/src/opts.rs Add tls_ca, tls_cert, tls_key to NetworkOpts with env var support
crates/cli-util/src/lib.rs Re-export NetworkOpts for downstream crates
tools/restatectl/src/util.rs grpc_channel_with_tls() — custom TLS connector using tokio-rustls
tools/restatectl/Cargo.toml Add http, tokio-rustls, hyper-util, tower deps

Design

  • Reuses TlsCertResolver from restate-core::network::tls to build the rustls ClientConfig
  • Custom tower::service_fn connector wraps TCP with TLS per-connection (same pattern as inter-node outbound)
  • --tls-cert requires --tls-key (enforced by clap)
  • --tls-ca alone enables server cert verification without client auth (one-way TLS)

Verification

  • cargo check -p restate-cli-util -p restatectl — compiles
  • cargo clippy -D warnings — zero warnings
  • cargo fmt --check — clean

… 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant