Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions integration/helpers/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -1317,9 +1317,15 @@ func (i *TeleInstance) NewUnauthenticatedClient(cfg ClientConfig) (tc *client.Te
sshProxyAddr = cfg.Proxy.SSHAddr
kubeProxyAddr = cfg.Proxy.KubeAddr
case cfg.ALBAddr != "":
webProxyAddr = cfg.ALBAddr
sshProxyAddr = cfg.ALBAddr
kubeProxyAddr = cfg.ALBAddr
if i.IsSinglePortSetup {
webProxyAddr = cfg.ALBAddr
sshProxyAddr = cfg.ALBAddr
kubeProxyAddr = cfg.ALBAddr
} else {
webProxyAddr = cfg.ALBAddr
sshProxyAddr = i.SSHProxy
kubeProxyAddr = i.Config.Proxy.Kube.ListenAddr.Addr
}
default:
webProxyAddr = i.Web
sshProxyAddr = i.SSHProxy
Expand Down
48 changes: 21 additions & 27 deletions integration/proxy/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ func TestALPNSNIProxyMultiCluster(t *testing.T) {
secondClusterPortSetup helpers.InstanceListenerSetupFunc
disableALPNListenerOnRoot bool
disableALPNListenerOnLeaf bool
testALPNConnUpgrade bool
}{
{
name: "StandardAndOnePortSetupMasterALPNDisabled",
Expand All @@ -89,20 +88,17 @@ func TestALPNSNIProxyMultiCluster(t *testing.T) {
name: "TwoClusterOnePortSetup",
mainClusterPortSetup: helpers.SingleProxyPortSetup,
secondClusterPortSetup: helpers.SingleProxyPortSetup,
testALPNConnUpgrade: true,
},
{
name: "OnePortAndStandardListenerSetupLeafALPNDisabled",
mainClusterPortSetup: helpers.SingleProxyPortSetup,
secondClusterPortSetup: helpers.StandardListenerSetup,
disableALPNListenerOnLeaf: true,
testALPNConnUpgrade: true,
},
{
name: "OnePortAndStandardListenerSetup",
mainClusterPortSetup: helpers.SingleProxyPortSetup,
secondClusterPortSetup: helpers.StandardListenerSetup,
testALPNConnUpgrade: true,
},
}

Expand Down Expand Up @@ -140,30 +136,28 @@ func TestALPNSNIProxyMultiCluster(t *testing.T) {
Port: helpers.Port(t, suite.leaf.SSH),
})

if tc.testALPNConnUpgrade {
t.Run("ALPN conn upgrade", func(t *testing.T) {
// Make a mock ALB which points to the Teleport Proxy Service.
albProxy := helpers.MustStartMockALBProxy(t, suite.root.Config.Proxy.WebAddr.Addr)

// Run command in root through ALB address.
suite.mustConnectToClusterAndRunSSHCommand(t, helpers.ClientConfig{
Login: username,
Cluster: suite.root.Secrets.SiteName,
Host: helpers.Loopback,
Port: helpers.Port(t, suite.root.SSH),
ALBAddr: albProxy.Addr().String(),
})

// Run command in leaf through ALB address.
suite.mustConnectToClusterAndRunSSHCommand(t, helpers.ClientConfig{
Login: username,
Cluster: suite.leaf.Secrets.SiteName,
Host: helpers.Loopback,
Port: helpers.Port(t, suite.leaf.SSH),
ALBAddr: albProxy.Addr().String(),
})
t.Run("WebProxyAddr behind ALB", func(t *testing.T) {
// Make a mock ALB which points to the Teleport Proxy Service.
albProxy := helpers.MustStartMockALBProxy(t, suite.root.Config.Proxy.WebAddr.Addr)

// Run command in root through ALB address.
suite.mustConnectToClusterAndRunSSHCommand(t, helpers.ClientConfig{
Login: username,
Cluster: suite.root.Secrets.SiteName,
Host: helpers.Loopback,
Port: helpers.Port(t, suite.root.SSH),
ALBAddr: albProxy.Addr().String(),
})
}

// Run command in leaf through ALB address.
suite.mustConnectToClusterAndRunSSHCommand(t, helpers.ClientConfig{
Login: username,
Cluster: suite.leaf.Secrets.SiteName,
Host: helpers.Loopback,
Port: helpers.Port(t, suite.leaf.SSH),
ALBAddr: albProxy.Addr().String(),
})
})
})
}
}
Expand Down
24 changes: 13 additions & 11 deletions lib/client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2823,17 +2823,19 @@ func (tc *TeleportClient) ConnectToCluster(ctx context.Context) (*ClusterClient,
}

pclt, err := proxyclient.NewClient(ctx, proxyclient.ClientConfig{
ProxyAddress: cfg.proxyAddress,
TLSRoutingEnabled: tc.TLSRoutingEnabled,
TLSConfig: tlsConfig,
DialOpts: tc.Config.DialOpts,
UnaryInterceptors: []grpc.UnaryClientInterceptor{interceptors.GRPCClientUnaryErrorInterceptor},
StreamInterceptors: []grpc.StreamClientInterceptor{interceptors.GRPCClientStreamErrorInterceptor},
SSHConfig: cfg.ClientConfig,
ALPNConnUpgradeRequired: tc.TLSRoutingConnUpgradeRequired,
InsecureSkipVerify: tc.InsecureSkipVerify,
ViaJumpHost: len(tc.JumpHosts) > 0,
PROXYHeaderGetter: CreatePROXYHeaderGetter(ctx, tc.PROXYSigner),
ProxyAddress: cfg.proxyAddress,
TLSRoutingEnabled: tc.TLSRoutingEnabled,
TLSConfig: tlsConfig,
DialOpts: tc.Config.DialOpts,
UnaryInterceptors: []grpc.UnaryClientInterceptor{interceptors.GRPCClientUnaryErrorInterceptor},
StreamInterceptors: []grpc.StreamClientInterceptor{interceptors.GRPCClientStreamErrorInterceptor},
SSHConfig: cfg.ClientConfig,
InsecureSkipVerify: tc.InsecureSkipVerify,
ViaJumpHost: len(tc.JumpHosts) > 0,
PROXYHeaderGetter: CreatePROXYHeaderGetter(ctx, tc.PROXYSigner),
// Connections are only upgraded through web port. Do not upgrade when
// using SSHProxyAddr in separate port mode.
ALPNConnUpgradeRequired: tc.TLSRoutingEnabled && tc.TLSRoutingConnUpgradeRequired,
})
if err != nil {
return nil, trace.Wrap(err)
Expand Down