-
-
Notifications
You must be signed in to change notification settings - Fork 54
Adding support for proxy_command #350
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
Conversation
|
Apologies for all the commits. I have never used this lint checker before, nor do I know how to create new unit tests for the new functionality. |
|
Hi. |
|
Yes, I realise that using
Of course this has some disadvantages:
|
|
Things I require.
Which leans me to a rather "pass a socket" param way (which can be already done). I'm not a fan of too many assumptions. Function which will work with eg. I could add some example code in docs though on how to create a simple proxy. I need some time to think about a good solution. Open for ideas. |
- Removing zombie processes - Adding unit and integration tests
|
Hello, The latest commit brings:
There are no special assumptions being made. Usage is straight forward: import librouteros
api = librouteros.connect(
username = __REMOVED__,
password = __REMOVED__,
host = "mikrotik",
ssl_wrapper = ctx.wrap_socket,
port = 8729,
proxy_command = "ssh -o BatchMode=yes -o StrictHostKeyChecking=accept-new -W %h:%p bastion",
)The only difference from normal More examples of proxy_command: proxy_command ="nc -c %h %p" # GNU netcat
proxy_command="nc -N %h %p" # OpenBSD netcat
proxy_command="nc -N -xbastion:8080 -Xconnect %h %p" # OpenBSD netcat using HTTP proxy |
|
Sorry for long delay in reply. Unfortunately I can't accept this PR. I will however accept |
|
Thanks for the feedback. |
This implements
proxy_commandfunctionality in the same vein as OpenSSH'sProxyCommand option. (See example).
It adds a new kwargs to the
connectand theasync_connectfunctions:proxy_command: Connect to host using the given proxy command. (If not specifieda direct connection is used.
Example
proxy_command:This allows
librouterosto connect devices that are not directly connected to us. Thisis a very common scenario where network devices are on a special secure network,
and/or can only be accessed from dedicated security devices. I personally use it for testing
where the test devices are in a virtual network, the proxy command allows
librouterosto tunnel the connection over a virtual interface.
There are two implementations, one uses low-level OS calls, and a generic one based on
subprocess.Popen. The later is more portable and should run on Windows, butI have not tested that.