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

Support proxy jump #94

Merged
merged 8 commits into from
Jan 9, 2024
Merged

Support proxy jump #94

merged 8 commits into from
Jan 9, 2024

Conversation

francoismichel
Copy link
Owner

@francoismichel francoismichel commented Jan 3, 2024

This PR adds support for classical, secure, UDP-based Proxy-Jump.
Let's say we want to connect from A to C through B, B being the proxy. This works with the client located on A connecting to B and establishing UDP forwarding from towards C. By doing so, the client can send regular encrypted QUIC packets through the forwarded socket to connect to C. B cannot manipulate the QUIC packets are they are encrypted and authenticated.

The drawbacks of the approach are:

  • quic-go datagram are slow
  • we tunnel a congestion-controlled protocol through another congestion-controlled protocol which might cause problems, especially that quic-go is quite prompt to drop UDP datagrams.

So this will work the best for interactive sessions. If troughput is needed, we may want to look at #89 instead.

The current latest quic-go release does not allow to send large datagrams, so this PR is based on quic-go commit 1083d1fb that fixes this problem. I am unsure whether we should wait for quic-go release 0.41 or if we could merge this PR as-is.

Fixes #44

@drewwells
Copy link
Contributor

Dropping 1.20 isn't a major problem. If it is we can file changes upstream to remove the new methods they're calling.

What's the speed drawback? Is this due to datagram wrapped in a datagram?

@francoismichel
Copy link
Owner Author

Dropping 1.20 isn't a major problem. If it is we can file changes upstream to remove the new methods they're calling.

I agree. quic-go always provides support for the last two Go versions. I guess that when quic-go 0.41.0 gets released, these two versions will be 1.21 and 1.22, as it recently dropped support for 1.20.

Concerning datagram performance, here is an issue stating the problem: quic-go/quic-go#3766 and the PR quic-go/quic-go#4223 seems to fix that issue, so we should give it a try as well. The problems seems to be due to how the datagram queue was managed.

@@ -47,21 +47,24 @@ func homedir() string {
// If non-nil, use udpConn as transport (can be used for proxy jump)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This parameter no longer exists

Suggested change
// If non-nil, use udpConn as transport (can be used for proxy jump)
// If non-nil, establishes a proxy connection towards proxyRemoteAddr first

})

It("works through proxy jump", func() {
testUDPPortForwarding(8080, true, &net.UDPAddr{IP: net.ParseIP("127.0.0.1"), Port: 9090}, "hello from client", "hello from server")
})

// Due to current quic-go limitations, the max datagram size is limited to 1200, whatever the real MTU is,
Copy link
Collaborator

Choose a reason for hiding this comment

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

How does this work now that we have QUIC in QUIC, is this limit still in place?

@vaminakov
Copy link

Because proxy is implemented, maybe good idea to make possible to start ssh3-server without cert/key? In any case, it will be behind reverse-proxy, which one is terminating tls

@drewwells
Copy link
Contributor

Not sure I follow here. You typically auth to a proxy even a jump host. It's actually the point of a jump host to act as a bastion with more cumbersome auth than the target

@francoismichel
Copy link
Owner Author

francoismichel commented Jan 9, 2024

Because proxy is implemented, maybe good idea to make possible to start ssh3-server without cert/key? In any case, it will be behind reverse-proxy, which one is terminating tls

If users don't need to use their own existing certs, then can start the server using the -generate-selfsigned-cert argument. :-)

That being said, I agree with @drewwells. Right now proxy jump is performed by tunneling UDP packets so the connection between the client and the proxied server are still end-to-end, it is just tunneled through the proxy using UDP forwarding.

Regarding this PR, I think we can merge it and make it part of the next release, I haven't seen any issues with it yet.

@francoismichel francoismichel merged commit 6aa6868 into main Jan 9, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ProxyJump support
4 participants