-
Notifications
You must be signed in to change notification settings - Fork 581
GEP-91: Address connection coalescing security issue - API updates #3960
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
base: main
Are you sure you want to change the base?
Conversation
Hi @kl52752. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/assign @robscott @arkodg @youngnick @shaneutt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small clarification about pointer-to-string, but aside from that, LGTM.
4c15adf
to
1cde002
Compare
/ok-to-test |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kl52752, youngnick The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
52f2fd5
to
6a5f47f
Compare
/retest |
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @kl52752!
apis/v1/gateway_types.go
Outdated
// +optional | ||
// | ||
// <gateway:experimental> | ||
TLSConfigs []TLSConfig `json:"tlsConfigs,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 This field name feels a little funny to me. Something about configs
as a plural word doesn't seem quite right. Some alternatives that may not be better:
tlsByPort
tlsPerPort
tls
frontendTLS
Since even from the outset port
is optional, 1 or 2 probably aren't great. Since there's at least a theoretical world where we add something TLS related here that isn't tied to frontend TLS, we could regret 4 in the future. So maybe 3 is the least bad, although even that adds some confusion as that tls
field would have no overlap with listener.tls. Open to other ideas here.
/cc @arkodg @youngnick
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if there is no strict rule for pluralizing / s
slice fields, then +1 for tls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do like the idea of tlsByPort
or tlsPerPort
, but I think that might also be confusing with the defaulting behavior?
I think that tls
is an acceptable alternative though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find the tls name for an array a bit confusing (specially the case when you iterate over tls). If we want "default" configuration to be explicit (see comment) we could consider creating a struct with default configuration (no port at all) and array with per ports override. This way it will be explicit, readable and not at all confusing :)
type GatewayTLSConfig struct {
defaultTLS *FrontendTLSValidation
tlsPerPort []TLSConfig
}
and in GatewaySpec we can name this field as tls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a different proposal above, but this could also work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally prefer mine solution than Nicks. I like it that default configuration is extracted from per ports override and now when default configuration is required it makes much sense.
I need to add more validations for per port overrides like uniquest etc but port = 0 will be forbidden.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After some reflection, I think that @kl52752's option here is better, agreed. Separating the default config into its own section lets us say "the default config applies to all listeners with matching ports that terminate TLS, unless there is a matching config in the tlsPerPort
section. In that case only the config in the tlsPerPort
section applies."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with that approach as well, thanks @kl52752!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
/retest |
@kl52752 I am looking for a solution where the same certificate is on two distinct listeners on a gateway. This is necessary because the Gateway API allows a single listener per gateway and the hostname for a listener can be either an FQDN or a wildcard FQDN. The behavior of wildcard certificates in TLS is that they match the apex (FQDN) or one label deep of wildcarded names. Will this GEP address coalescing connections to prevent HTTP/2 connection reuse issues when mutual TLS (client certificates) are not involved and two listeners attached to a gateway share the same server certificate? [Perhaps there should be a test for this, if there isn't one]? See also https://istio.io/latest/docs/ops/common-problems/network-issues/#404-errors-occur-when-multiple-gateways-configured-with-same-tls-certificate for how this impact users of the Istio controller for the Gateway API. |
I think we have consensus now on the approach, so removing my block.
hi @PT-GD in this GEP it is possible to attach the same FrontendValidation config (referencing the same ConfigMap) to 2 distinct Listeners in apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: client-validation-basic
spec:
gatewayClassName: acme-lb
tls:
defaultTLS:
caCertificateRefs:
- kind: ConfigMap
group: ""
name: default-cert
mode: AllowInsecureFallback
tlsPerPort:
- port: 443 // this configuration will apply to all Listeners matching this port
frontendValidation:
caCertificateRefs:
- kind: ConfigMap
group: ""
name: foo-example-com-ca-cert
- port: 8443 // If needed you can create second entry referencing the same ConfigMap for another port
frontendValidation:
caCertificateRefs:
- kind: ConfigMap
group: ""
name: foo-example-com-ca-cert
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @kl52752!
// | ||
// +required | ||
// <gateway:experimental> | ||
DefaultTLS FrontendTLSValidation `json:"defaultTLS"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Want to avoid names that stutter (tls.defaultTLS
-> tls.default
)
DefaultTLS FrontendTLSValidation `json:"defaultTLS"` | |
Default FrontendTLSValidation `json:"default"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also recommend an intermediate struct here so we leave room for other forms of TLS config at this default level. So tls.default.frontendValidation.mode
instead of tls.default.mode
.
// | ||
// +optional | ||
// <gateway:experimental> | ||
TLSPerPort []TLSConfig `json:"tlsPerPort,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar comment to above.
TLSPerPort []TLSConfig `json:"tlsPerPort,omitempty"` | |
PerPort []TLSConfig `json:"perPort,omitempty"` |
@@ -624,6 +644,31 @@ const ( | |||
TLSModePassthrough TLSModeType = "Passthrough" | |||
) | |||
|
|||
// TLSConfig describes a TLS configuration defined per port. | |||
type TLSConfig struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend something like this to make it clear that this is per-port.
type TLSConfig struct { | |
type TLSPortConfig struct { |
What type of PR is this?
/kind gep
What this PR does / why we need it:
Implements API changes for GEP-91
Which issue(s) this PR fixes:
Fixes 3567
Relates to: #3760 (comment)
Does this PR introduce a user-facing change?: