Anonymous SSH Sessions With TOR

OpenSSH is a great means to protect your connection from being sniffed by others. However, this isn't always enough. Simply proving that you connected to a server is enough to get incriminated. Unfortunately, SSH doesn't provide a native way to obfuscate to whom it connects. Instead, a proxy server can be set up. And this is where TOR comes to play.

Use the following package to install tor

dnf install tor
dnf install connect-proxy

Your ~/.ssh/config file contain all the setting to redirect ssh through tor netwok. Use here hereafter example

Setup OpenSSH to use TOR for all connections

Host *
CheckHostIP no
Compression yes
Protocol 2
ProxyCommand connect-proxy -4 -S localhost:9050 $(tor-resolve %h localhost:9050) %p

Set up OpenSSH to use TOR for a specific connection

Host mydomain
HostName mydomain.com
User myaccount
CheckHostIP no
Compression yes
Protocol 2
ProxyCommand connect-proxy -4 -S localhost:9050 $(tor-resolve %h localhost:9050) %p

Set up OpenSSH to use TOR for a bunch of connections

Host anon_*
CheckHostIP no
Compression yes
Protocol 2
ProxyCommand connect-proxy -4 -S localhost:9050 $(tor-resolve %h localhost:9050) %p
Host anon_mydomain
HostName mydomain.com
User myaccount
Host anon_mydomain2
HostName mydomain2.com
User myaccount
Port 980