Skip to content

Conversation

keithel-qt
Copy link
Contributor

This allows one to tunnel to a jumpserver right from the toolbox.

Example usage:

cargo make run --ssh-tunnel="[email protected]" --ssh-remote-bind-address="10.1.52.164:55555"

@keithel-qt
Copy link
Contributor Author

One remaining mypy issue - Not sure how to resolve it.
I only incude the sshtunnel module if the --ssh-tunnel option is provided - which mypy doesn't like.
The sshtunnel module is specified as an optional module in pyproject.toml.

I suppose I could move this whole ssh tunneling logic to a separate .py file - that might fix the issue, but I don't really want to spend much time on this. It is just a convenience feature.

@keithel-qt keithel-qt force-pushed the keithel-qt/ssh-tunnel branch from 6cab5cf to 5cbf203 Compare October 4, 2022 14:02
@john-michaelburke
Copy link
Collaborator

One remaining mypy issue - Not sure how to resolve it. I only incude the sshtunnel module if the --ssh-tunnel option is provided - which mypy doesn't like. The sshtunnel module is specified as an optional module in pyproject.toml.

I suppose I could move this whole ssh tunneling logic to a separate .py file - that might fix the issue, but I don't really want to spend much time on this. It is just a convenience feature.

Yeah I was thinking this might be better as a cargo make command, if you can do it through bash. But if this works and it doesn't add much overhead by all means.

@keithel-qt
Copy link
Contributor Author

keithel-qt commented Oct 5, 2022

Yeah I was thinking this might be better as a cargo make command, if you can do it through bash. But if this works and it doesn't add much overhead by all means.

I would rather it be part of the app startup, as it will open the tunnel when the app starts, and tear it down when it stops.
Doing so with a separate process requires some extra work watching the python process, and that isn't as easy.

The changes I made should have very, very minimal performance impact. If the sshtunnel module isn't installed, it will try importing it, set the FEATURE_SSHTUNNEL flag, and do two checks on that flag on startup - once for adding the command line options to the parser, and a second one for doing the command line arg validation for these args. Then on handling of CLI args it will check once for args.ssh_tunnel.

@keithel-qt keithel-qt force-pushed the keithel-qt/ssh-tunnel branch 2 times, most recently from 6603ac4 to 3f771ca Compare November 1, 2022 18:50
This allows one to tunnel to a jumpserver right from the toolbox.
@keithel-qt keithel-qt force-pushed the keithel-qt/ssh-tunnel branch from 3f771ca to 54b04a7 Compare November 1, 2022 20:21
@keithel-qt keithel-qt merged commit 2a7d590 into main Nov 7, 2022
@keithel-qt keithel-qt deleted the keithel-qt/ssh-tunnel branch November 7, 2022 17:38
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.

3 participants