Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TLS Passthrough does not work #2662

Closed
3 tasks
rainest opened this issue Jul 7, 2022 · 6 comments · Fixed by #2990
Closed
3 tasks

TLS Passthrough does not work #2662

rainest opened this issue Jul 7, 2022 · 6 comments · Fixed by #2990
Assignees
Labels
area/feature New feature or request area/gateway-api Relating to upstream Kubernetes SIG Networking Gateway API priority/medium
Milestone

Comments

@rainest
Copy link
Contributor

rainest commented Jul 7, 2022

Problem Statement

The desired state of TLS support for TLSRoutes is:

  1. a TLSRoute configured on a Gateway with listeners[].tls.mode = passthrough to result in Kong not terminating the TLS connection and forwarding the stream
  2. a TLSRoute configured on a Gateway with listeners[].tls.mode = terminate to result in Kong terminating the TLS connection and forwarding the (unencrypted TCP) stream

The scope of this issue is to:

  • implement (1) - as (2) works in KIC today
  • implement tests for both (1) and (2)

Additional context

Broken out of #2475.

IIRC we don't do much anything with Gateway TLS mode (whether it terminates or passes through) yet, but should. We should review how, if at all, we handle it currently and add implementation for it if none exists or if the current implementation doesn't work well.

Acceptance criteria

  • TLSRoute passthrough works and is documented
  • an integration test for TLSRoute passthrough exists
  • an integration test for TLSRoute terminated exists
@mflendrich
Copy link
Contributor

Milestone 3 inclusion is conditional on this being either no-op or a low effort change.
If substantial engineering work is required to make this happen, this shall be punted to Milestone 4.

@rainest rainest self-assigned this Aug 3, 2022
@rainest
Copy link
Contributor Author

rainest commented Aug 3, 2022

This does not appear to be trivial. Our architecture does not easily allow feeding a property (the TLS mode) of a Listener into Route configuration. Certificates don't have this problem because they're not directly linked to individual Routes in either the spec or Kong configuration. There may also be some open questions about handling this properly on both our end and in the spec.

Currently, Routes' only interactions with Listeners is part of determining whether they can bind to the Gateways in the Route's parentRefs. We check that there is at least some Listener of the appropriate type with allowedRoutes rules that permit that Route, but do not otherwise associate them with a specific Listener. Further logic is required to find that match:

So I think we need to do a fair amount of work to have getSupportedGatewayForRoute() also return the specific Listener that the Route will bind to, and from there the TLSRoute controller set some field on the store object that tells the parser translate function which protocol it should set.

Moving to milestone 4 as such.

@rainest rainest removed their assignment Aug 3, 2022
@mflendrich
Copy link
Contributor

Okay. I'm moving this to "needs AC & prioritization" because it seems that the current AC don't capture the real work to be done.

@rainest
Copy link
Contributor Author

rainest commented Aug 30, 2022

Nevermind, this is fine, I was confusing this with #2474, supporting certificates at all; this is about handling passthrough or terminate. It should be ready for work with the current criteria and milestone: we initially looked at it for 2.6 but since it wasn't a simple change it didn't make the cut.

@rainest rainest removed their assignment Aug 30, 2022
@mflendrich mflendrich changed the title Review and handle Gateway TLS mode Gateway API TLS Passthrough does not work Sep 6, 2022
@mflendrich mflendrich changed the title Gateway API TLS Passthrough does not work TLSRoute TLS Passthrough does not work Sep 6, 2022
@mflendrich mflendrich changed the title TLSRoute TLS Passthrough does not work TLS Passthrough does not work Sep 6, 2022
@randmonkey randmonkey self-assigned this Sep 21, 2022
@randmonkey
Copy link
Contributor

Kong supports configuring TLS passthrough in routes: https://docs.konghq.com/gateway/latest/how-kong-works/routing-traffic/#proxy-tls-passthrough-traffic. So we need to tell the parser whether a TLSRoute resource needs to configure TLS passthrough. But the settings is in listeners[].tls.mode of Gateway in its Spec.ParentRouteSpec. The possible ways to know whether we need to use TLS passthough in the kong route for TLSRoute:

  • (1) run the process of finding the kong listener again from spec.parentRouteSpec
  • (2) pass TLSRoute object to the cache inside KIC after updating its status with supported gateways.
    I prefer (2), because this method carries supported gateways of TLSRoute to cache, so we do not need to find out supported gateways again the parser.

@randmonkey
Copy link
Contributor

For running integrated tests, we need a simple TLS server: Kong/go-echo#12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/feature New feature or request area/gateway-api Relating to upstream Kubernetes SIG Networking Gateway API priority/medium
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants