4

I am trying to setup SSH tunneling using tor on Ubuntu 14.04

I have added the tor repo:

deb http://mirror.noreply.org/pub/tor lenny main

And installing the following packages:

  - tor
  - connect-proxy

And this is my .ssh/config

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

But when I try to SSH to a host I seem to get this error

OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /home/adithya/.ssh/config
debug1: /home/adithya/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Executing proxy command: exec connect -4 -S localhost:9050 $(tor-resolve 192.168.0.10 localhost:9050) 22
debug1: identity file /home/adithya/.ssh/id_rsa type -1
debug1: identity file /home/adithya/.ssh/id_rsa-cert type -1
debug1: identity file /home/adithya/.ssh/id_dsa type -1
debug1: identity file /home/adithya/.ssh/id_dsa-cert type -1
debug1: identity file /home/adithya/.ssh/id_ecdsa type -1
debug1: identity file /home/adithya/.ssh/id_ecdsa-cert type -1
debug1: permanently_drop_suid: 1000
ERROR: Got error response: 91: 'request rejected or failed'.
FATAL: failed to begin relaying via SOCKS.
ssh_exchange_identification: Connection closed by remote host

Can someone please help me trouble shoot this?

Thanks,

Adithya
  • 41
  • 2

1 Answers1

2

I tend to use socat instead of connect, using the following ProxyCommand:

ProxyCommand socat STDIO SOCKS4A:localhost:%h:%p,socksport=9050

No need to use tor-resolve, as, quoting the man page,

In the command string, any occurrence of '%h' will be substituted by the host name to connect, '%p' by the port, and '%r' by the remote user name.

And I've verified that it indeed passes the name, as this works even when the HostName (not the Host) is a tor hidden service.

That being said, please note that I'm mainly using Gentoo, but I remember setting up this this command on Ubuntu, somewhere in 12.* (I don't have access to that machine any more).

Torinthiel
  • 121
  • 1