Skip to content

feat: wire tls.peer into the listener — mtls for inbound - #441

Merged
kacy merged 1 commit into
mainfrom
feat/mtls-listener-wiring
Jun 18, 2026
Merged

feat: wire tls.peer into the listener — mtls for inbound#441
kacy merged 1 commit into
mainfrom
feat/mtls-listener-wiring

Conversation

@kacy

@kacy kacy commented Jun 16, 2026

Copy link
Copy Markdown
Owner

summary

second PR-5 chunk (after #440). wires the manifest's tls.peer setting
through to the L7 listener so an accepted TLS connection actually
becomes mTLS when the matching service has tls.peer = "warn" or
"require".

what's in here

  • tls/backend.zig: Backend gains a peer_mode: TlsConfig.PeerMode
    field (default .off). BackendRegistry.register takes it as a
    parameter; lookup / lookupOwned carry it through.
  • manifest/orchestrator/startup_runtime.zig: both register call
    sites now pass tls.peer from the service spec.
  • tls/proxy/session_runtime.zig: handleTlsSession takes an
    optional MtlsOpts parameter. when present, it's threaded into
    acceptServerHandshake exactly the same way the mTLS round-trip
    tests already exercise.
  • tls/proxy.zig: the listener dispatch builds MtlsOpts from
    backend.peer_mode and the cluster CA loaded via store.getClusterCa.
    a missing CA on an mTLS-enabled service logs and downgrades to plain
    TLS rather than reject — this is a startup-ordering edge that should
    self-heal once the CA bootstrap thread (feat: cluster mtls trust root (raft-distributed ca) #432) seeds the row.
  • two new tests on BackendRegistry confirm peer_mode survives
    register/lookup and overwrite.

verification

what's next

  • upstream dial wiring (outgoing client mTLS to mtls-enabled upstreams)
  • handshake metrics
  • yoq cert service <name> CLI

still no auto-merge — security-sensitive wiring.

threads the manifest's tls.peer setting through the backend registry
to the L7 listener:
- Backend gains a peer_mode field (default .off)
- BackendRegistry.register takes a peer_mode parameter
- startup_runtime passes svc.tls.peer when registering each domain
- handleTlsSession takes an optional MtlsOpts; the listener builds
  one from cluster CA + backend.peer_mode and passes it through
- listener loads the cluster CA on demand; missing CA on a tls.peer
  service is a misconfiguration — logs and downgrades to plain TLS

two new tests on BackendRegistry confirm peer_mode round-trips through
register/lookup and is overwritten correctly. the end-to-end mTLS
protocol is already covered by the socketpair tests in
session_runtime (PR #439); this PR's contract is just "the listener
picks up tls.peer and reaches acceptServerHandshake with the right
MtlsOpts", which the type-level wiring proves.
@kacy
kacy merged commit d8c4955 into main Jun 18, 2026
10 checks passed
@kacy
kacy deleted the feat/mtls-listener-wiring branch June 18, 2026 20:30
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