'hide socks5 behind local port
my setup:
- vpn accessible network where I have bastion/jump host and target server with say "target" server and some service on it that is accessible by port 12345
- ssh option for AllowTcpForwarding is disabled on this jump host and cannot be enabled because bla-some-corporate-crap-bla
- local pc that must make connection to target server & port
I found and used for sometime socks5 proxy option for ssh client.
ssh -f -C2qTnN -D 1080 user@jump-host
I can specify proxy settings for local software client (actually more then 10 of them). I mean proxy through socks5 and use local port 1080.
And all was rather fine until I messed up and executed some command thinking that I am connected to local service (I start it on the same port 12345) while actually being connected to remote and to make situation worse I had mixed environment with some apps connected to local service and some to remote.
Now I am searching for way to centralize configuration and easily switch from one configuration settings to other.
The way with ssh tunnel is most preferable. As I can make tunnel/terminate it and know that all of client apps are working with the same env which will be either local or remote service on the same port 12345.
Also with this approach I cannot start local service when I have ssh tunnel on as port is used and vice versa so it is also error prone.
But unfortunately AllowTcpForwarding as I said before is not an option so I am searching for a way to imitate it with socks5 proxy.
Some iptables rules or 3rd software that will listen and redirect all traffic from local port via socks5 proxy to remote server ?
Or if I am using ssh client in wrong way I need a hint about other options ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
