Score:0

Forwarding incoming SSH traffic to a local Socks5 server (or other services)

bn flag

The scenario is That a cloud Ubuntu server is running a Socks5 proxy server on a specified port; on this cloud server :

  • Socks5 server serving on port 1515 (only local connections accepted)
  • SSH is accepting connections from ports 22,33 and 44

What we want is to let any client use "Dynamic port forwarding" ability of SSH to connect to the Socks5 server running on the cloud server to be specific Client is going to use this command :

ssh -D 1080 -N -f user@cloudserver.host 

So any application that uses Port 1080 on the client will have it's traffic routed through the SSH connection and then That remote Socks5 server, so the traffic path will be like :

App running on client machine>Client Socks server on port 1080>SSH Tunnel>Socks5 server accepting local connections

I hope I have explained clearly, Thnaks

Edit : I want client to only use -D option and want the server to actually route incoming SSH traffic to another interface or a Socks host

Score:0
in flag

Firstly -D 1080 will create a SOCK5 proxy on your localhost and to the remote end of the SSH connection. Which is why it won't forward to the remote SOCKS5 proxy.

What you need todo create a SSH to tunnel that last leg to the tunnel the remote 1515 port so it appears local to your machine..

ssh -L 1515:localhost:1080 -N -f user@cloudserver.host

At which point in another window on the local box where you ran the ssh command above..

You should then be able to connect to the localhost:1080 for transparent access to the remote SOCK5 proxy.

See this helpful visual guide to ssh tunnelling here:- https://iximiuz.com/en/posts/ssh-tunnels/

Sam Jahangiri avatar
bn flag
This is question is not about port forwarding, sorry for bad explanation
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.