-
Notifications
You must be signed in to change notification settings - Fork 360
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
fix: match SNI when using TLS listeners with hostname #2942
Changes from all commits
c473dcf
468eea9
a3790cf
992dd33
4d6da72
2fdf048
a01aa2d
911aa09
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -222,6 +222,6 @@ xdsIR: | |
weight: 1 | ||
name: tlsroute/default/tlsroute-1 | ||
tls: | ||
passthrough: | ||
inspector: | ||
snis: | ||
- foo.bar.com |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,6 +109,6 @@ xdsIR: | |
weight: 1 | ||
name: tlsroute/default/tlsroute-1 | ||
tls: | ||
passthrough: | ||
inspector: | ||
snis: | ||
- foo.com |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,6 +110,6 @@ xdsIR: | |
weight: 1 | ||
name: tlsroute/default/tlsroute-1 | ||
tls: | ||
passthrough: | ||
inspector: | ||
snis: | ||
- foo.com |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,6 +108,6 @@ xdsIR: | |
weight: 1 | ||
name: tlsroute/default/tlsroute-1 | ||
tls: | ||
passthrough: | ||
inspector: | ||
snis: | ||
- '*' |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,6 +110,6 @@ xdsIR: | |
weight: 1 | ||
name: tlsroute/default/tlsroute-1 | ||
tls: | ||
passthrough: | ||
inspector: | ||
snis: | ||
- foo.com |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -1215,7 +1215,7 @@ type TCPRoute struct { | |||
type TLS struct { | ||||
// TLS information required for TLS Passthrough, If provided, incoming | ||||
// connections' server names are inspected and routed to backends accordingly. | ||||
Passthrough *TLSInspectorConfig `json:"passthrough,omitempty" yaml:"passthrough,omitempty"` | ||||
TLSInspectorConfig *TLSInspectorConfig `json:"inspector,omitempty" yaml:"inspector,omitempty"` | ||||
// TLS information required for TLS Termination | ||||
Terminate *TLSConfig `json:"terminate,omitempty" yaml:"terminate,omitempty"` | ||||
} | ||||
|
@@ -1246,8 +1246,8 @@ func (t TCPRoute) Validate() error { | |||
errs = errors.Join(errs, ErrRouteNameEmpty) | ||||
} | ||||
|
||||
if t.TLS != nil && t.TLS.Passthrough != nil { | ||||
if err := t.TLS.Passthrough.Validate(); err != nil { | ||||
if t.TLS != nil && t.TLS.TLSInspectorConfig != nil { | ||||
if err := t.TLS.TLSInspectorConfig.Validate(); err != nil { | ||||
errs = errors.Join(errs, err) | ||||
} | ||||
} | ||||
|
@@ -1280,13 +1280,12 @@ func (t TCPRoute) Validate() error { | |||
} | ||||
|
||||
// TLSInspectorConfig holds the configuration required for inspecting TLS | ||||
// passthrough connections. | ||||
// connections. | ||||
// +k8s:deepcopy-gen=true | ||||
type TLSInspectorConfig struct { | ||||
// Server names that are compared against the server names of a new connection. | ||||
// Wildcard hosts are supported in the prefix form. Partial wildcards are not | ||||
// supported, and values like *w.example.com are invalid. | ||||
// SNIs are used only in case of TLS Passthrough. | ||||
SNIs []string `json:"snis,omitempty" yaml:"snis,omitempty"` | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider moving SNIs up to TLSConfig and removing TLSInspectorConfig? TLS Inspector is an implementation detail of Envoy, so we probably don't need to expose it to ir. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's already exposed as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd vote for making Line 1088 in 4d6da72
Passthrough field
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I pushed an update here, it changes a different part of the IR though, |
||||
} | ||||
|
||||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ tcp: | |
port: 10082 | ||
tcpKeepalive: {} | ||
tls: | ||
passthrough: | ||
inspector: | ||
snis: | ||
- bar.com | ||
destination: | ||
|
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.
shouldnt this be executed conditionally ?
e.g.
gateway/internal/gatewayapi/listener.go
Line 53 in 33443f8
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 don't think anything's changed here, previously we set unconditionally:
irTLSConfigs
returnsnil
if there aren't any secrets. The line you linked to is also gated by checking the listener protocol.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.
Cool thanks for the checking!