Skip to content

Commit 1eee337

Browse files
committed
Implementation of GEP-3567 - TLS Updates for Connection Coalescing
1 parent db7c408 commit 1eee337

File tree

6 files changed

+165
-24
lines changed

6 files changed

+165
-24
lines changed

apis/openapi/zz_generated.openapi.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1/gateway_types.go

Lines changed: 74 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,27 @@ type Listener struct {
300300
//
301301
// * TLS: The Listener Hostname MUST match the SNI.
302302
// * HTTP: The Listener Hostname MUST match the Host header of the request.
303-
// * HTTPS: The Listener Hostname SHOULD match at both the TLS and HTTP
304-
// protocol layers as described above. If an implementation does not
305-
// ensure that both the SNI and Host header match the Listener hostname,
306-
// it MUST clearly document that.
303+
// * HTTPS: The Listener Hostname SHOULD match both the SNI and Host header.
304+
// Note that this does not require the SNI and Host header to be the same.
305+
// The semantics of this are described in more detail below.
306+
//
307+
// To ensure security, Section 11.1 of RFC-6066 emphasizes that server
308+
// implementations that rely on SNI hostnames matching must also verify
309+
// hostnames within the application protocol.
310+
//
311+
// Section 9.1.2 of RFC-7540 provides a mechanism for servers to reject the
312+
// reuse of a connection by responding with the HTTP 421 Misdirected Request
313+
// status code. This indicates that the origin server has rejected the
314+
// request because it appears to have been misdirected.
315+
//
316+
// To detect misdirected requests, Gateways SHOULD match the authority of
317+
// the requests with all the SNI hostname(s) configured across all the
318+
// Gateway Listeners on the same port:
319+
//
320+
// * If another Listener has an exact match or more specific wildcard entry,
321+
// the Gateway should return a 421.
322+
// * If the current Listener doesn’t match the SNI or Host, the reverse
323+
// proxy should return a 421.
307324
//
308325
// For HTTPRoute and TLSRoute resources, there is an interaction with the
309326
// `spec.hostnames` array. When both listener and route specify hostnames,
@@ -1230,6 +1247,59 @@ const (
12301247
ListenerReasonPending ListenerConditionReason = "Pending"
12311248
)
12321249

1250+
const (
1251+
// This condition indicates that TLS configuration within this Listener
1252+
// conflicts with TLS configuration in another Listener on the same port.
1253+
// This could happen for two reasons:
1254+
//
1255+
// 1) Overlapping Hostnames: Listener A matches *.example.com while Listener
1256+
// B matches foo.example.com.
1257+
// B) Overlapping Certificates: Listener A contains a certificate with a
1258+
// SAN for *.example.com, while Listener B contains a certificate with a
1259+
// SAN for foo.example.com.
1260+
//
1261+
// This overlapping TLS configuration can be particularly problematic when
1262+
// combined with connection coalescing. When client reuse connections using
1263+
// this technique, it can have confusing interactions with Gateway API, such
1264+
// as TLS configuration for one Listener getting used for a request reusing
1265+
// an existing connection that would not be used for the request using a new
1266+
// connection.
1267+
//
1268+
// Controllers MUST detect the presence of overlapping hostnames and MAY
1269+
// detect the presence of overlapping certificates.
1270+
//
1271+
// This condition MUST be set on all Listeners with overlapping TLS config.
1272+
// For example, consider the following listener - hostname mapping:
1273+
//
1274+
// A: foo.example.com
1275+
// B: foo.example.org
1276+
// C: *.example.com
1277+
//
1278+
// In the above example, Listeners A and C would have overlapping hostnames
1279+
// and therefore this condition should be set for Listeners A and C, but not
1280+
// B.
1281+
//
1282+
// Possible reasons for this condition to be True are:
1283+
//
1284+
// * "OverlappingHostnames"
1285+
// * "OverlappingCertificates"
1286+
//
1287+
// This is a negative polarity condition and MUST NOT be set when it is
1288+
// True.
1289+
//
1290+
// Controllers may raise this condition with other reasons, but should
1291+
// prefer to use the reasons listed above to improve interoperability.
1292+
ListenerConditionOverlappingTLSConfig ListenerConditionType = "OverlappingTLSConfig"
1293+
1294+
// This reason is used with the "OverlappingTLSConfig" condition when the
1295+
// condition is true.
1296+
ListenerReasonOverlappingHostnames ListenerConditionReason = "OverlappingHostnames"
1297+
1298+
// This reason is used with the "OverlappingTLSConfig" condition when the
1299+
// condition is true.
1300+
ListenerReasonOverlappingCertificates ListenerConditionReason = "OverlappingCertificates"
1301+
)
1302+
12331303
const (
12341304
// "Ready" is a condition type reserved for future use. It should not be used by implementations.
12351305
// Note: This condition is not really "deprecated", but rather "reserved"; however, deprecated triggers Go linters

config/crd/experimental/gateway.networking.k8s.io_gateways.yaml

Lines changed: 42 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/standard/gateway.networking.k8s.io_gateways.yaml

Lines changed: 42 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

geps/gep-3567/index.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# GEP-3567: Gateway TLS Updates for HTTP/2 Connection Coalescing
22

33
* Issue: [#3567](https://github.com/kubernetes-sigs/gateway-api/issues/3567)
4-
* Status: Implementable
4+
* Status: Experimental
55

66
## TLDR
77

@@ -40,7 +40,9 @@ the client sends.
4040

4141
Gateway API deals with this situation imprecisely, stating:
4242

43-
The Listener Hostname SHOULD match at both the TLS and HTTP protocol layers as described above. If an implementation does not ensure that both the SNI and Host header match the Listener hostname, it MUST clearly document that.
43+
The Listener Hostname SHOULD match at both the TLS and HTTP protocol layers
44+
as described above. If an implementation does not ensure that both the SNI
45+
and Host header match the Listener hostname, it MUST clearly document that.
4446

4547
In practice we can end up with an implementation that misroutes requests when a
4648
Gateway is configured using certificates that use multiple or wildcard SANs.
@@ -119,7 +121,7 @@ A new condition will be added to Gateways: `OverlappingTLSConfig`.
119121
Implementations MUST add this condition to status when a Gateway is configured
120122
with TLS configuration across multiple Listeners. Implementations MAY add this
121123
condition to status when a Gateway is configured with overlapping TLS
122-
certifications. Note that since this is a negative polarity condition, it would
124+
certificates. Note that since this is a negative polarity condition, it would
123125
only be populated when it is true.
124126

125127
### B) Modify API Spec to recommend sending 421s

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ nav:
141141
- geps/gep-2162/index.md
142142
- geps/gep-3155/index.md
143143
- geps/gep-3171/index.md
144+
- geps/gep-3567/index.md
144145
- Standard:
145146
- geps/gep-709/index.md
146147
- geps/gep-718/index.md

0 commit comments

Comments
 (0)