0

I would like to access my raspberry pi via ssh over tor. This works from a Linux client, but not from a windows client. When I try it from putty on a windows machine I get "Proxy error: General SOCKS server failure"

I'm using this guide so I can access my Raspberry Pi globally via tor. After starting tor on the client machine, i can connect to my Pi: https://www.khalidalnajjar.com/access-your-raspberry-pi-globally-using-tor/

The guide works fine, tested with Raspian buster and Ubuntu 18.04 (You have to start tor on the client machine, and the guide does not mention that)

On the Pi (running Raspian Buster):

$ sudo apt-get install tor
$ sudo nano /etc/tor/torrc #and add the following two lines:
    HiddenServiceDir /var/lib/tor/ssh_hidden_service/
    HiddenServicePort 22 127.0.0.1:22
$ sudo /etc/init.d/tor restart
$ sudo cat /var/lib/tor/ssh_hidden_service/hostname
    qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmdmyd.onion #not the actual address

On the Client(running Ubuntu 18.04.3 desktop amd64 in virtualbox):

$ sudo apt-get install tor
$ sudo apt-get install connect-proxy
$ sudo /etc/init.d/tor restart
$ sudo nano /etc/ssh/ssh_config #and add the following three lines:
Host *.onion
    ProxyCommand connect -R remote -5 -S 127.0.0.1:9050 %h %p
    ForwardX11 yes
$ ssh -l pi qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmdmyd.onion #not the actual address

It also works with putty on Ubuntu, with the following settings:

Session - Host name: qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmdmyd.onion
Session - Port: 22
Session - Connection type: ssh
Connection - Proxy: Proxy type: SOCKS 5
Connection - Proxy: Proxy hostname: 127.0.0.1
Connection - Proxy: Port: 9050

On a windows 7 machine, I've downloaded, installed and run Tor Browser 8.5.5. I am able to connect to the tor network and browse to clear web pages. (I didn't try .onion sites) Next I start putty with the following settings:

Session - Host name: qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmdmyd.onion
Session - Port: 22
Session - Connection type: ssh
Connection - Proxy: Proxy type: SOCKS 5
Connection - Proxy: Proxy hostname: 127.0.0.1
Connection - Proxy: Port: 9150 #port 9050 gives Network Error: Connection Refused"

Now I get the error: "Proxy error: General SOCKS server failure"

Edit1: Here's my tor log

9/12/19, 12:02:15.146 [NOTICE] Bootstrapped 10% (conn_done): Connected to a relay 
9/12/19, 12:02:15.146 [NOTICE] Bootstrapped 14% (handshake): Handshaking with a relay 
9/12/19, 12:02:15.147 [NOTICE] Bootstrapped 15% (handshake_done): Handshake with a relay done 
9/12/19, 12:02:15.147 [NOTICE] Bootstrapped 20% (onehop_create): Establishing an encrypted directory connection 
9/12/19, 12:02:15.222 [NOTICE] Bootstrapped 25% (requesting_status): Asking for networkstatus consensus 
9/12/19, 12:02:15.222 [NOTICE] Bootstrapped 30% (loading_status): Loading networkstatus consensus 
9/12/19, 12:02:16.622 [NOTICE] Bootstrapped 75% (enough_dirinfo): Loaded enough directory info to build circuits 
9/12/19, 12:02:16.623 [NOTICE] Bootstrapped 90% (ap_handshake_done): Handshake finished with a relay to build circuits 
9/12/19, 12:02:16.623 [NOTICE] Bootstrapped 95% (circuit_create): Establishing a Tor circuit 
9/12/19, 12:02:16.624 [NOTICE] Bootstrapped 100% (done): Done 
9/12/19, 12:02:17.421 [NOTICE] New control connection opened from 127.0.0.1. 
9/12/19, 12:02:23.555 [NOTICE] New control connection opened from 127.0.0.1. 
9/12/19, 12:02:30.860 [WARN] Your application (using socks5 to port 22) gave Tor a malformed hostname: [scrubbed]. Rejecting the connection.

And my torrc file:

# This file was generated by Tor; if you edit it, comments will not be preserved
# The old torrc file was renamed to torrc.orig.1 or similar, and Tor will ignore it

DataDirectory C:\Users\*******\Desktop\Tor Browser\Browser\TorBrowser\Data\Tor
GeoIPFile C:\Users\*******\Desktop\Tor Browser\Browser\TorBrowser\Data\Tor\geoip
GeoIPv6File C:\Users\*******\Desktop\Tor Browser\Browser\TorBrowser\Data\Tor\geoip6

Edit2: I've added this line to torrc:

SafeLogging 0

Now I see this line in the log (it's not the actual .onion address):

9/12/19, 12:41:31.786 [WARN] Your application (using socks5 to port 22) gave Tor a malformed hostname: "qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmdmyd.onion\n\n". Rejecting the connection. 

How can I get rid of those 2 extra \n chars?

Edit3: It turns out during the copy and paste of the .onion address to putty, I've copied two extra \n chars. Going to the end of the line in putty and pressing backspace two times solved the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.