-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
ALPN SNI Proxy #7524
ALPN SNI Proxy #7524
Conversation
cf67e96
to
28131a2
Compare
00ceaf0
to
ac9e265
Compare
7196bcd
to
598573c
Compare
32f5e70
to
8953dec
Compare
adfeeaa
to
8c8ffa7
Compare
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.
@smallinsky Don't have a lot of other feedback, just a few remaining cleanups/questions.
integration/integration_test.go
Outdated
// add proxy as a backend second time to prevent situations where there are only 2 backend and internal | ||
// reverse tunnel dialer makes 2 calls to connect to the tunnel (ProxyPing, factual Dial call). In that | ||
// situations the second lb backend reverse tunnel address is actually never dialed. | ||
lb.AddBackend(*utils.MustParseAddr(net.JoinHostPort(Loopback, strconv.Itoa(proxyReverseTunnelPort)))) |
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.
Sorry I somehow missed this during previous passes. @smallinsky I'm not sure I fully understand why we're adding a second B backend here. How does it help with the test and the proxy?
return nil, nil, trace.Wrap(err) | ||
} | ||
|
||
// Following TLS handshake fails on the server side with error: "no certificates configured" after server |
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.
Ohh I see now, it's cause you're using that fake tlsConn above. A couple of thoughts:
- Can this failed fake handshake somehow affect the client and/or the future "real" handshake?
- Can your fake tlsConn return a proper tls.Config so this handshake succeeds also? We have
p.cfg.TLSConfig
here?
@@ -2587,6 +2588,14 @@ func (process *TeleportProcess) setupProxyListeners() (*proxyListeners, error) { | |||
listeners.web = listener | |||
} | |||
} | |||
|
|||
// Even if web service API was disabled create a web listener used for ALPN/SNI service as the master port | |||
if cfg.Proxy.DisableWebService && !cfg.Proxy.DisableTLS && listeners.web == nil { |
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.
Nit: Isn't cfg.Proxy.DisableWebService
basically a redundant condition here?
@@ -3030,6 +2948,24 @@ func (process *TeleportProcess) initProxyEndpoint(conn *Connector) error { | |||
if err != nil { | |||
return trace.Wrap(err) | |||
} | |||
|
|||
if alpnRouter != nil && !cfg.Proxy.DisableDatabaseProxy { |
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 we'll ever be able drop other listeners since we'll still need to have support for separate listeners, right? But ok, that's fair.
26f5b59
to
f69576b
Compare
f69576b
to
3ccddeb
Compare
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.
lgtm once we address the issue with the hacky integration test
@awly / @nklaassen: since you guys looked at this before, could you give this another look so we can get a second approval? Thanks.
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.
Looks alright to me overall, my remaining question is related to the issue with multiple proxies behind a load balancer and clients choosing the port based on the wrong ping response. Would this be a serious problem for people turning on this feature or is there a workaround? Update all proxies at once?
The proxy update should work the proxy behind LB should have same config the issue is rated to proxy stagnation when even number of proxies are configured behind reverse tunnel LB. I have create a separate PR with fix for this case: |
ALPN SNI proxy service listener
ALPN SNI proxy service allows to handle incoming TLS connections and route received connections base on ServerName (SNI) NextProtos (ALPN) values to proper Teleport Proxy service.
CLI UX changes
tsh proxy ssh
command that can be used as openSSH ProxyCommand in order to wrap ssh protocol into TLS connection and connect to a remote proxy.tsh proxy db [-p port] example
starts local db proxy and wraps db protocol into TLS connection and establishes the connection to remote proxy.Other Changes:
tsh db connect example
(introduce in #7213) will detect if the remote proxy supports ALPN SNI listener and under the hood will spawn on demand local db proxy that will wrap db protocol into TLS connection and connect to remote proxy.KUBECONFIG
file generated bytsh kube login
command bycluster.server
field use to set SNI value bykubectrl
tool.alpn_sni_listener_enabled
filed.alpn_sni_listener_enabled
field in the tsh user profile to distinguish if proxy support ALPN SNI listener.Backward compatibility
Client:
tsh proxy client uses
proxy.alpn_sni_listener_enabled
proxy response ping field to distinguish if remote Teleport Proxy supports TLS SNI ALPN listener. If ALPN SNI Proxy support is detected by the proxy client the traffic is wrapped into TLS and send to Web port where ALPN SNI Teleport Proxy service listen on.If former version of a client is used to establish a connection to the remote Teleport Proxy service
Server
In order to support former proxy clients Teleport Proxy by default exposed Teleport Proxy Services in an unchanged way. Additional TLS SNI Teleport Proxy service is exposed on Web port.
Load Test IoT (connection through teleport proxy reverse tunnel)
Load Test 1K nodes teleport 7.0.0-beta.5 (For reference)
Soak 1K nodes teleport 7.0.0-beta.5 (For reference)
Load Test 1K nodes SNI proxy:
Soak 1K nodes teleport SNI Proxy