Search code examples
pythonproxyfabricsocks

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 ssh_config 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?


Solution

  • Tunnelling is now (March 2013) supported by Fabric natively: see the discussion leading to the changes in code and the commit message with a bit of rationale.