You can tunnel ØMQ socket connections across machines or untrusted networks using the zmq.ssh.tunnel module. This module allows you to connect to a remote ØMQ endpoint by routing the traffic through an SSH server.
By default, PyZMQ uses the system's ssh command via pexpect, but it also supports paramiko, making it compatible with Windows.
An SSH tunnel consists of:
- server: The SSH server used to create the tunnel (can be a hostname or
user@server:port). - remote ip: The IP of the remote machine as seen from the server.
- remote port: The port on the remote machine you want to connect to.
- local ip: The local interface to use (defaults to
127.0.0.1). - local port: The local port to forward to (defaults to a high random port).
Once established, connections to the local ip:local port are transparently forwarded to remote ip:remote port.