SSH Tunnel
Aug 14, 2012·
·
1 min read
Julio Batista Silva
Tunneling or tunneling is a very useful technique to bypass restrictions and create an encrypted channel for data traffic.
SOCKS
ssh -ND 8888 julio@host
Parameters:
-N: do not execute commands-D: run a proxy server on the specified port-f: run in the background-C: enable compression
Firefox
Edit » Preferences » Advanced » Settings… » Manual proxy configuration:
SOCKS Host:localhostPort:8888
Chromium
$ chromium --proxy-server="socks5://localhost:8888" \
--proxy-bypass-list="192.168.15.10;127.0.0.1:8080;*.google.com" \
--host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE localhost"
Jump Server
Let’s say there is a database (PostgreSQL on port 5432) that is only accessible from the local network. If you have SSH access to a machine on that network, you can interact with the database as follows:
ssh -N -L 127.0.0.1:5434:$DB_HOST:5432 my_server
pg_dump --verbose --create --schema-only --no-owner -d nome_bd -h localhost -p 5434 -U usuario --password -f dump.sql