Skip to content

Instantly share code, notes, and snippets.

@assafmo
Last active May 30, 2019 09:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save assafmo/a2fffe494979787e6525db67f9c938f4 to your computer and use it in GitHub Desktop.
Save assafmo/a2fffe494979787e6525db67f9c938f4 to your computer and use it in GitHub Desktop.
SSH Over TOR (Good for any service, also to expose a server behind NAT)
#!/bin/bash
sudo apt install -y tor
# get hostname from /var/lib/tor/ssh/hostname on the server
torsocks ssh user@xxxxyyyyzzzzaaaa.onion
#!/bin/bash
sudo apt install -y tor
sudo mkdir -p /var/lib/tor/ssh/
sudo chown -R debian-tor:debian-tor /var/lib/tor/ssh/
sudo chmod 700 /var/lib/tor/ssh/
echo "HiddenServiceDir /var/lib/tor/ssh/" | sudo tee -a /etc/tor/torrc
echo "HiddenServicePort 22 127.0.0.1:22" | sudo tee -a /etc/tor/torrc
sudo systemctl restart tor
# sudo cat /var/lib/tor/ssh/hostname -> xxxxyyyyzzzzaaaa.onion
@assafmo
Copy link
Author

assafmo commented Dec 27, 2018

Can also use HiddenServiceAuthorizeClient on the server and HidServAuth on the client (in /etc/tor/torrc) to be more selective about allowed users.

@assafmo
Copy link
Author

assafmo commented May 30, 2019

TODO: Check if a windows client can use https://github.com/basil00/TorWall instead of torsocks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment