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

Add convenience flag for reverse ssh tunnels #562

Merged
merged 2 commits into from
Nov 22, 2021
Merged

Add convenience flag for reverse ssh tunnels #562

merged 2 commits into from
Nov 22, 2021

Conversation

oakreid
Copy link
Contributor

@oakreid oakreid commented Oct 17, 2021

SSH supports the creation of reverse tunnels using a very similar syntax to normal tunnels. From the man pages:

     -R [bind_address:]port:host:hostport
     -R [bind_address:]port:local_socket
     -R remote_socket:host:hostport
     -R remote_socket:local_socket
     -R [bind_address:]port

This PR adds a flag to the .tunnel() method of SshMachine that allows for easy creation of a reversed SSH tunnel

@henryiii henryiii merged commit e5f1e3e into tomerfiliba:master Nov 22, 2021
@henryiii
Copy link
Collaborator

Thanks! Didn't format or catch that time_ns was included, but doing that in #566.


def test_reverse_tunnel(self):

def serve_reverse_tunnel(queue):
Copy link
Collaborator

@henryiii henryiii Nov 23, 2021

Choose a reason for hiding this comment

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

FYI, this is not picklable, so can't be forked. Why did this only matter on Python 3.10 + macOS? I have no idea. Anyway, moving it out of the test function should fix the problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's very strange. Thanks for cleaning that up!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Think you could look into possibly making the test support forked multiprocessing? Not a big issue if not (the MP part is really due to the test needing both sides of the tunnel, not a normal occurrence).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I can definitely look into it!

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