Skip to content

Instantly share code, notes, and snippets.

@pikami
Last active March 29, 2020 21:32
Show Gist options
  • Save pikami/60cd451191c51a399871462800dba3c4 to your computer and use it in GitHub Desktop.
Save pikami/60cd451191c51a399871462800dba3c4 to your computer and use it in GitHub Desktop.

Server setup

  1. Add these lines to /etc/tor/torrc
HiddenServiceDir /var/lib/tor/ssh_hidden_service/
HiddenServicePort 22 127.0.0.1:22
HiddenServiceAuthorizeClient stealth client_name
  1. Restart tor service
  2. Get onion address and client key from /var/lib/tor/ssh_hidden_service/hostname

Example:

fxpnxrbqvto6dypc.onion fd1s5f65d1f6s8r1vr651v # client: client_name

Client setup

  1. Add hidden service secret to /etc/tor/torrc

Example:

HidServAuth fxpnxrbqvto6dypc.onion fd1s5f65d1f6s8r1vr651v
  1. Restart tor service
  2. Add these lines to ~/.ssh/config
Host *.onion
  ProxyCommand nc -x 127.0.0.1:9050 -X5 %h %p

Result

You should now be able to ssh using your server's onion domain.

Example:

ssh pikami@fxpnxrbqvto6dypc.onion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment