ghickman ghickman - 1 year ago 99
Python Question

How to run a fabric script over a SOCKS proxy?

I have a SOCKS proxy setup to a gateway server which is created by setting up a host definition in my

to use
DynamicForward localhost:9876
. To connect with SSH to the remote server I've setup another host definition to use
ProxyCommand /usr/bin/nc -x localhost:9876 %h %p
which is all working fine.

However my fabric script needs to connect to that remote server. How can I tell it to use the SOCKS proxy when it connects?

Answer Source

Fabric's SSH layer does not support gateways or proxies at the moment but they "may end up patching/forking it sometime to add that functionality." (from here).

There's also an outstanding issue on Fabric to implement tunneling.

This blog post suggests overriding the run function.