Skip to content

feat(relay): native TLS + CLI identity polish - #20

Merged
rldyourmnd merged 2 commits into
mainfrom
feat/relay-tls-cli-polish
Sep 22, 2026
Merged

rldyourmnd merged 2 commits into
mainfrom
feat/relay-tls-cli-polish

Conversation

@rldyourmnd

Copy link
Copy Markdown
Contributor

Summary

Implements the TLS recommendation from the deployment doc (was listed as future work):

  • Native relay TLS on rds-server/rds-relay: --tls-cert/--tls-key for PEM files (rustls ring provider — no new C deps) or in-process Let's Encrypt (--tls-acme-*, TLS-ALPN-01). HTTPS binds --tls-https-addr (default 3443; unit can't bind 443 unprivileged). HTTP port keeps only the captive-portal probe; /healthz documented for monitoring.
  • rds id is now key-only: instant (13ms), offline, and refuses clearly when no key resolves — previously it bound a full endpoint and could print a fresh ephemeral id per run.
  • rds ticket bounds online() at 15s — a dead relay no longer hangs it forever.

Test plan

  • build --locked --workspace --all-targets, fmt, clippy ×4 lanes
  • full workspace tests green (incl. relay e2e)
  • cargo-machete clean, cargo-deny all lanes ok
  • Live TLS smoke: rds-relay --tls-cert/--tls-key serves /healthz 200 over real TLS
  • rds id stable across runs, no socket bind; clap validation (--tls-cert without --tls-key, ACME without cache) verified

Generated with Devin

The documented recommendation was a TLS terminator in front of 3340;
wiring iroh-relay's TlsConfig through serve() was listed as future
work. This implements it:

- RelayTls::Manual — PEM cert chain + key via rustls ring provider.
- RelayTls::LetsEncrypt — in-process ACME (TLS-ALPN-01) with a
  certificate cache dir so restarts do not re-issue and hit LE
  rate limits.
- Both rds-server and rds-relay gain --tls-cert/--tls-key,
  --tls-acme-*, --tls-https-addr (default 3443 — the unprivileged
  systemd unit cannot bind 443).
- tls_from_flags() shares flag validation between the two binaries.
- HTTP port keeps serving only the captive-portal probe; /healthz
  (built into iroh-relay) is documented for monitoring.
- Deployment doc + unit comments updated; smoke-verified: HTTPS
  listener serves /healthz 200 over real TLS.

Also changelog entry covering this and the merged lifecycle fixes.
- rds id is a pure function of the secret key — it no longer binds a
  socket or contacts a relay (13ms, offline). With no resolvable key
  file it now refuses clearly instead of printing a fresh ephemeral
  endpoint id on every run.
- rds ticket bounds its online() wait at 15s: an unreachable relay
  previously hung the command forever; now it warns and still prints
  the ticket with whatever addresses resolved.
@rldyourmnd
rldyourmnd merged commit 377852b into main Sep 22, 2026
12 checks passed
@rldyourmnd
rldyourmnd deleted the feat/relay-tls-cli-polish branch September 22, 2026 17:36
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