SOCKS proxy with SSH
That’s not a new thing, but I happened to use it during the weekend to be able to access some services back in Brazil that were IP-limited and HideMyAss couldn’t help, so I asked a friend for a small proxy help.
What I did on my side:
- Opened a port on my modem to forward the connection to the port 51000 on my computer;
- Started a container:
docker run -p 51000:51000 -p 51001:51001 --rm -it ubuntu:xenial bash
; - Installed
supervisord
,openssh-server
and addedGatewayPorts yes
to/etc/ssh/sshd_config
;
My friend had to run those commands in parallel:
ssh -D 51001 localhost
;ssh -R :51001:localhost:51001 use@myIP -p 51000
;
And voilá, I had a SOCKS proxy over localhost:51000
that was going out to the internet using a Brazilian IP address.