-2

Let's say I create a reverse ssh tunnel, with the following command.

ssh -R 8080:localhost:11111 user@remote

I can test that the tunnel is open on the remote with nc command

nc -v 127.0.0.1 8080
localhost.localdomain [127.0.0.1] 8080 (http-alt) open

However I have no idea how I could test that the remote can indeed communicate with the client trough the tunnel, how could I do that ?

  • 2
    You want to create that tunnel to do something. Why don't you just try this something and see if it works? – Sven Oct 04 '18 at 09:41
  • Of course, but that something is quite complex and can have multiple points of failure. I first need to make sure the tunnel is working correctly with the simplest test possible. – Mathieu Westphal Oct 04 '18 at 13:26

1 Answers1

0

The simplest way to test a ssh tunnel is with the telnet command and with a python http server.

For reverse connection, this would be the following. On the local, install python3 and ssh, then.

  1. Run a python http server in a terminal (on port 8000 by default)

    python -m http.server

  2. Create your ssh tunnel

    ssh -R 8080:localhost:8000 user@remote

On The remote, connect to it trough telnet

>telnet localhost 8080
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

You can even connect to it with a browser, but it not as simple as telnet.