-
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
Respect HTTP_PROXY/HTTPS_PROXY #10209
Conversation
@atburke This needs test coverage. |
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 tested this locally as well. tsh
login seems to work with and without proxy environment variables set.
@atburke Take a look at the comments (and diff) from @johns-carta in #8108. |
Sorry, that fix is incomplete, this is going to dial directly , again, instead of through the proxy: you need to implement a CONNECT proxy dialer in api/client/contextdialer.go and pass that as a dialer (instead of Addr) to ConnectToAuthServiceThroughALPNSNIProxy There are almost certainly other similar cases littered about I suggest testing this with a deployment that is only accessible via HTTP CONNECT, because if the dev machine or test machine can directly connect to the Teleport cluster it will look successful when it is in fact, not. |
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.
Withdrawing approval, as it seems we didn't quite hit the mark here yet. @atburke, let me know when you are ready for review again.
@atburke This code added to this PR works (I've done an end-to-end test) but you almost certainly don't want to integrate it as-is. I'm relatively sure authConnect shouldn't be the one creating the dialer & I don't feel like tracking down where the right place is but something that looks like this.
|
@atburke You have three things you want to test.
|
lib/utils/proxy/proxy.go
Outdated
ServerName: address.Host(), | ||
}) | ||
conf := tlsConfig.Clone() | ||
if conf == 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.
How can conf
be nil here?
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.
conf
can be nil when the caller doesn't use proxy.WithTLSConfig()
to use a custom tls config.
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.
To be honest, I'm not sure I fully understand this tlsConfig logic. Why are we setting NextProtos to ProtocolReverseTunnel
here in what (I think) is supposed to be a generic proxy, but only in the case when tlsConfig wasn't passed in?
@smallinsky Can you take a look at these changes too pls - do you remember why we're setting ProtocolReverseTunnel here? Is this proxy supposed to be used by the agents only? Just want to make sure we don't break any scenarios.
Is this proxy is now used by both reverse tunnel agents and tsh, I wonder if we should make the TLS config mandatory and have the caller pass it appropriately.
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.
ProtocolReverseTunnel
is the default from before the tls config was injected. As long as it doesn't break anything, I think making tls config mandatory is the way to go.
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.
do you remember why we're setting ProtocolReverseTunnel here?
The name of the dialer is misleading. It is used in TunnelAuthDialer
and Reverse tunnel Agent call so under the hood it is Reverse Tunnel Dialer where a connection is established to Reverse tunnel service thus in case of TLSRouting mode the alpncommon.ProtocolReverseTunnel
protocol is set.
lib/utils/proxy/proxy.go
Outdated
ServerName: addr.Host(), | ||
}) | ||
conf := d.tlsConfig.Clone() | ||
if conf == 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.
How can conf
be nil here?
lib/utils/proxy/proxy.go
Outdated
ServerName: address.Host(), | ||
}) | ||
conf := d.tlsConfig.Clone() | ||
if conf == 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.
Same q as above.
lib/utils/proxy/proxy.go
Outdated
ServerName: address.Host(), | ||
}) | ||
conf := d.tlsConfig.Clone() | ||
if conf == 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.
Same q as above.
…leport into atburke/tsh-https-proxy
This change allows tsh to use HTTP proxies when HTTP_PROXY/HTTPS_PROXY is set in the environment.
This change allows tsh to use HTTP proxies when HTTP_PROXY/HTTPS_PROXY is set in the environment.
This change disables the HTTP_PROXY support for reverse tunnel connections, as introduced in #10209. This is for backwards compatibility.
This change disables the HTTP_PROXY support for reverse tunnel connections, as introduced in #10209. This is for backwards compatibility.
This change disables the HTTP_PROXY support for reverse tunnel connections, as introduced in #10209. This is for backwards compatibility.
This change disables the HTTP_PROXY support for reverse tunnel connections, as introduced in #10209. This is for backwards compatibility. Co-authored-by: Roman Tkachenko <[email protected]>
This change disables the HTTP_PROXY support for reverse tunnel connections, as introduced in #10209. This is for backwards compatibility.
Fixes #8108.