To access websites behind an internal network, I proxy web traffic to specific DNS domains over an
ssh connection using the SOCKS protocol. The SwitchyOmega plugin takes care of site specific proxying and
autossh securely forwards all SOCKS traffic through the
To handle network instability, VPN connectivity, and laptop mobility,
autossh automatically restarts the
ssh tunnel during network changes or failures.
ssh key authentication must be setup prior to using
ssh session can not prompt for a password.
ssh tunnel using
autossh -f -D 5555 -N -M 0 host.example.com
Test the connection:
jemurray@mbp-2019:~ $ telnet localhost 5555 Trying ::1... Connected to localhost. Escape character is '^]'. quit Connection closed by foreign host.
ssh test on the remote site for testing:
# Look for the process without a pty session associated with it jemurray@host:~$ ps -ef | grep ssh | grep jemurray jemurray 18053 17885 0 15:49 ? 00:00:00 sshd: jemurray@pts/10 jemurray 20287 20119 0 15:53 ? 00:00:00 sshd: jemurray # kill the process jemurray@host:~$ kill 20287
The session dies, but automatically restarts:
emurray@mbp-2019:~ $ telnet localhost 5555 Trying ::1... Connected to localhost. Escape character is '^]'. quit Connection closed by foreign host.