Skip to content

feat: Add TLS connection options - #19

Merged
jopemachine merged 4 commits into
mainfrom
feat/tls-connect-options
Nov 6, 2026
Merged

jopemachine merged 4 commits into
mainfrom
feat/tls-connect-options

Conversation

@jopemachine

@jopemachine jopemachine commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

📚 Stacked PRs

Part of the etcd TLS work (BA-8980). Merge in order (bottom-up):

  1. ✅ chore: Update dependencies (etcd-client, tonic, tokio) #20 — chore: update dependencies
  2. 👉 feat: Add TLS connection options #19 — feat(BA-8980): TLS connection options ← you are here

Part of lablup/backend.ai#16640 (BA-8980). Backend.AI cannot connect to etcd over TLS until this is released.

Summary

  • Enable the tls feature of etcd-client (rustls) and add TlsOptions with with_ca_certificate() and with_identity(), plus ConnectOptions.with_tls(). Certificates are passed as PEM bytes, and endpoints use https://.
  • Add TlsOptions.with_handshake_timeout(). ConnectOptions.with_timeout() and with_connect_timeout() do not end a stalled TLS handshake, so without it a server that stops responding during the handshake blocks the connection indefinitely.
  • Client.__repr__ printed the Debug output of ConnectOptions, which includes the password and would include the TLS private key. It now prints ConnectOptions { .. }.
  • trustme is added to the test extra to issue the test certificates.

Test plan

  • tests/test_tls.py: read and write on an etcd started with --client-cert-auth; a stalled handshake ends with an error; repr() hides the password and the private key
  • Full test suite, cargo clippy, ruff check, mypy
  • Wheel builds. The release jobs run on tags only, and the new ring dependency compiles C code

🤖 Generated with Claude Code

@jopemachine
jopemachine marked this pull request as ready for review November 6, 2026 06:51
@jopemachine
jopemachine changed the base branch from main to chore/update-crates-with-advisories November 6, 2026 07:26
@jopemachine
jopemachine force-pushed the feat/tls-connect-options branch from 58f8ace to 3d7cb14 Compare November 6, 2026 07:26
Base automatically changed from chore/update-crates-with-advisories to main November 6, 2026 07:27
jopemachine and others added 2 commits November 6, 2026 16:28
Enable the `tls` feature of `etcd-client` and expose it as `TlsOptions`
with `ConnectOptions.with_tls()`, so that clients can connect to `https://`
endpoints with a CA certificate and a client identity.

`ConnectOptions` prints the password and the TLS private key in its Debug
output, which `Client.__repr__` uses. Print a fixed text instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow the existing tests: container fixtures live in `conftest.py`, async
tests carry `pytest.mark.asyncio`, and no test imports from `conftest.py`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jopemachine
jopemachine force-pushed the feat/tls-connect-options branch from 3d7cb14 to 31a3753 Compare November 6, 2026 07:28
jopemachine and others added 2 commits November 6, 2026 16:36
`ConnectOptions.with_timeout()` and `with_connect_timeout()` do not end a
stalled TLS handshake, so a server that stops responding during it blocks the
connection indefinitely. Expose the handshake timeout of `etcd-client` as
`TlsOptions.with_handshake_timeout()`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jopemachine
jopemachine merged commit 91f2d6a into main Nov 6, 2026
17 checks passed
@jopemachine
jopemachine deleted the feat/tls-connect-options branch November 6, 2026 07:41
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.

2 participants