Documentation

Replacing the supplied client python script with your own activation mechanism

The activation script that runs on your computer polls the server every few seconds and, depending on the response from the server, can either open the tunnel or close it.

The python client is needed only if you want to have remote control (through our web interface) of your tunnels, otherwise you can start ssh clients from your command line. While we provide the client activation script, sometimes running the python script is not possible (because of a lack of python interpreter, for instance) or the user might want to create his or her own script. You can replace the python client with any kind of script or program which would periodically poll our server and run or kill the ssh client on your computer depending on the response from our server.

For such cases, here is how to create your own activation script.

First, download the supplied activation script because it contains parameters for your connection.

Search for these global variables in the script.

  URL = 'https://p.sshreach.me/rHe61rNXZ63e97hA5ABsn49hQonsra'
  PORTS_ID = '86'
  UNIX_USERNAME = 'HbN9EerI5QkA7PWGc32NItpSwICKpe'
  HOST_UUID = '87c38740-23fa-4131-9bcf-e400394b2f6b'
  USER_ID = '200'
  DB_SERVER_KEY = 'B9iuQ7HIXElzbhzrlNSR'
  FORWARD_PORT = '22'

URL, PORTS_ID, HOST_UUID, USER_ID and DB_SERVER_KEY values are needed in the activation script, while UNIX_USERNAME, FORWARD_PORT values are needed to create a tunnel to the forwarding server.

Your activation script should periodically poll the server using these parameters.

URL/get_port.php?ports_id=PORTS_ID&key=HOST_UUID&uid=USER_ID&dbid=DB_SERVER_KEY

(Note: do not poll the server more often than every 5 seconds or your client might get blocked on the server.)

In this example, it would look like this:

  https://p.sshreach.me/rHe61rNXZ63e97hA5ABsn49hQonsra/get_port.php?ports_id=86&key=87c38740-23fa-4131-9bcf-e400394b2f6b&uid=200&dbid=B9iuQ7HIXElzbhzrlNSR

The server responds with the following json:

  {"command":"0", "iport":"10148", "forwarding_server":"192.168.3.213", "disconnect_ssl_when_server_unreachable":"T"}

Parameters are the following:

  • command: can be 1 or 0. 1 - start the tunnel, 0 - kill the tunnel
  • iport: port to forward to
  • forwarding_server: server to forward port to

If the server responds with {command:1}, then the activation script should execute the command that starts the tunnel if it is not already started, otherwise no action should be taken. If the server responds with {command:0}, then the activation script should execute the command that kills the tunnel if it is active, otherwise no action should be taken.