Skip to content
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 tunnel address for TLS routing if public tunnel address is present #8961

Merged
merged 4 commits into from
Nov 15, 2021

Conversation

smallinsky
Copy link
Contributor

@smallinsky smallinsky commented Nov 12, 2021

Issue: #8952

What

Fix destination reverse tunnel address in case if proxy support TLS Routing.

This PR change the tunnelAddr logic and only public_proxy_addr and webProxy addresses are used as tunnel address if proxy support TLS Routing.

@smallinsky smallinsky force-pushed the smallinsky/fix_tls_routing_reverse_tunnel_address branch 6 times, most recently from 474e5de to 48c1b9a Compare November 15, 2021 10:29
@smallinsky smallinsky marked this pull request as ready for review November 15, 2021 13:19
@smallinsky smallinsky force-pushed the smallinsky/fix_tls_routing_reverse_tunnel_address branch from 48c1b9a to 1758f14 Compare November 15, 2021 13:24
@smallinsky smallinsky added backport-required tls-routing Issues related to TLS routing labels Nov 15, 2021

// Got proxy address without a port like: proxy.example.com
// If proxyAddr doesn't contain any port it means that HTTPS port should be used.
return net.JoinHostPort(host, "443"), nil
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 443? Isn't default proxy port 3080?

Copy link
Contributor Author

@smallinsky smallinsky Nov 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is invoked only if Find web API call succeed.

if proxyAddr format doesn't contain port number it means that the default https port was used in Find API call:

	endpoint := fmt.Sprintf("https://%s/webapi/find", proxyAddr)
	req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint, nil)

https://github.com/gravitational/teleport/blob/master/api/client/webclient/webclient.go#L95

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I see. This is a little confusing, let's at least expand the comment to explain. Also, do we have a constant for 443?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extended the comment.

Also, do we have a constant for 443?
there is gravitational/teleport.StandardHTTPSPort const but importing gravitational/teleport in teleport/api` pkg is not possible thus I move this const to api defaults.


// Got proxy address without a port like: proxy.example.com
// If proxyAddr doesn't contain any port it means that HTTPS port should be used.
return net.JoinHostPort(host, "443"), nil
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I see. This is a little confusing, let's at least expand the comment to explain. Also, do we have a constant for 443?

@smallinsky smallinsky force-pushed the smallinsky/fix_tls_routing_reverse_tunnel_address branch 2 times, most recently from 2f83086 to ac3ec8a Compare November 15, 2021 18:57
@smallinsky smallinsky force-pushed the smallinsky/fix_tls_routing_reverse_tunnel_address branch from ac3ec8a to cb73e58 Compare November 15, 2021 19:11
@smallinsky smallinsky enabled auto-merge (squash) November 15, 2021 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-required tls-routing Issues related to TLS routing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants