0

I have the following problem/idea:

I want to access a hidden remote machine with SSH, but the network I am in does not allow a connection through port 22 (SSH) so I want to try a HTTP or more like a HTTPS tunnel over port 443 to my SSH port 22. But I am a bit limited and so I thought about a 2 server solution where I connect to the first server over the HTTP tunnel and then just forward all SSH requests to the second hidden server.

But I have only PHP on the first server.

The connection should look something like that:

 _______        _______       _______
|My     |______|       |_____|Hidden |
|Machine|_HTTP_|Server |_SSH_|Server |
|_______|      |_______|     |_______|

(I know the ASCII drawing is not the best)

My Question is now: Can I make a PHP HTTP tunnel with my server to my hidden server? And if yes how? Because the ssh2_tunnel documentation is not good.

Or is there even a easier method to connect to my hidden server?

Play_it
  • 109
  • 1
  • 12
  • How are you planning to utilize the SSH tunnel? Not sure how you're going to leverage HTTP in this scenario. Are you expecting to be able to use an SSH client? – Devon Bessemer May 01 '21 at 14:36
  • I am also not that sure but I think something of a HTTP wrapper – Play_it May 01 '21 at 14:38
  • Maybe https://unix.stackexchange.com/questions/190490/how-to-use-ssh-over-http-or-https will help – Devon Bessemer May 01 '21 at 14:49
  • The first server has a domain and subdomains. I would make a subdomain for the tunnel. If I access now the subdomain it will create the tunnel. At least that is my idea – Play_it May 01 '21 at 14:49
  • I looked into the unix stackexchange and only sslh could be a solution but also not the best – Play_it May 01 '21 at 15:00
  • You should use Docker to `expose` the service to the local IPV4 network. – Jaquarh May 01 '21 at 15:04
  • Where should i use docker? On my machine, on the server or the hidden server? – Play_it May 01 '21 at 15:09
  • Maybe this will help [https://phpseclib.com/docs/connect](https://phpseclib.com/docs/connect) – Alex May 01 '21 at 17:08
  • It uses a nice lib but only sends one command over the line, but i need to open a whole session over the tunnel. Maybe you @Alex have an idea if there is a solution for my problem? – Play_it May 01 '21 at 17:40

0 Answers0