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

Reverse port forwarding implementation #148

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jdhozdiego
Copy link

The reverse port forwarding feature provides a proxy for service within reach of the machine executing the SSH3 client, which is deployed into the SSH3 server machine. This allows any incoming communication request arriving at the proxy deployed on the SSH3 server to be forwarded to the SSH3 client.

In this implementation, the SSH3 client generates a request to the server to open a new channel through RequestTCPReverseChannel() and includes in the additional bytes the information regarding reverse port forwarding. Then, the server listens to the defined socket and waits for incoming connections. Once they occur, the server opens a new channel through OpenTCPReverseForwardingChannel(), which is used to forward the communications back to the client to act as a reverse proxy.

@francoismichel
Copy link
Owner

Thanks for the PR ! Reverse port forwarding is a feature I would love to add indeed.
Would you mind adding unit tests that verify the correct behaviour of the feature ?
There are already a few tests for TCP/UDP classical port forwarding in integration_tests/ssh3_test.go. Adding a few for reserve forwarding would help us ensuring it works well and avoid regression when implementing new features.

Thanks !

@jdhozdiego
Copy link
Author

Sure! I have included the tests in this pull already. To implement the tests, I used your testTCPPortForwarding function for the reverse testing to make both direct and reverse tests on the same "TCP port forwarding" context. This works because the SSH3 client and the server are in the same container during the testing process.
The reverse port forwarding for UDP still needs to be implemented, but I intend to work on that as well.

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.

2 participants