Manually Configuring SSH Tunneling

Index of All Documentation » Wing Pro Reference Manual » Advanced Debugging Topics » Manually Configured Remote Debugging »


If you are manually configuring remote debugging without Wing Pro's Remote Hosts feature, you may find that firewalls get in the way of making a direct connection between the remote host and Wing running locally. The way around this is to establish an SSH tunnel that forwards network traffic from the remote host to the local host. This also encrypts all your debugger traffic in a secure way.

This does require a working ssh server, which most remote hosts will already have. You will want to set up remote login using ssh first, and in most case add your ssh key to the list of allowed keys on the remote host, so that ssh can login without any password. Once that is done, SSH tunneling can be configured as follows.

Wing Running on OS X or Linux or on Windows with cygwin

When Wing is running on OS X or Linux, or with cygwin on Windows, tunneling is done as follows from the machine that is running Wing (not the remote host):

ssh -N -R 50005:localhost:50005 username@remotehost

You'll need to replace username@remotehost with the login name and ip address of the remote host.

The -R option sets up a reverse tunnel, which is needed since the debug process initiates the connection back to the IDE.

The -N option causes ssh not to run any code on the remote host, so it just sets up the tunnel and nothing else.

The -f option can be added just after ssh to cause ssh to run in the background. Without this option, you can use Ctrl-C to terminate the tunnel. With it, you'll need to use ps and kill to manage the process.

If you also want a login shell on the remote host, use this form instead:

ssh -R 50005:localhost:50005 username@remotehost bash

Wing Running on Windows

When Wing is running on Windows, use PuTTY to configure an ssh tunnel with the same settings on the Connections > SSH > Tunnels page: Set Source port to 50005, Destination to localhost:50005, and select the Remote radio button, then press the Add button. Once this is done the tunnel will be established whenever PuTTY is connected to the remote host.

Using Different Port Numbers

The above assumes the default configuration where Wing is listening for connections on port 50005. If for some reason you can't use port 50005 as the debug port on either machine, this can be changed on the remote host with kHostPort in wingdbstub.py or with the WINGDB_HOSTPORT environment variable. To change the port the IDE is listening on, use the Debugger > Listening > Server Port preference and or Debug Server Port in Project Properties in Wing.

If this is done, you will need to replace the port numbers in the ssh tunnel invocation in the following form:

ssh -N -R <remote_port>:localhost:<ide_port> username@remotehost

<remote_port is the port specified in kHostPort or with WINGDB_HOSTPORT environment variable, and <ide_port is the port set in Wing's preferences or Project Properties.

On Windows using PuTTY, the Source port is the port set with kHostPort or WINGDB_HOSTPORT on the remote host, and the port in the Destination is the port Wing is configured to listen on.

Refer to the documentation for ssh or PuTTY for details.

Location Maps

When using an SSH tunnel, the IP address entered into the Location Map preference described in the following sections is the IP address of the host the IDE is running on, since the IDE thinks the connection is coming from the local host. This is often 127.0.0.1 but on Windows it may instead be the IP address for the host. This depends on the peer ip that is reported on the IDE side for connections opened through the pipe.