1

I'm having a hard time understanding why torsocks/torify isn't working in this particular case.

 torify ssh user@remotemachine torsocks ssh user@remotemachine 

When I do the following command when I get in my actual IP is printed:

echo $SSH_CLIENT # [my actual IP + remote/local ports] 

But if I do

ssh -o ProxyCommand='nc -x localhost:9050 %h %p' user@remotemachine # 9050 being the SOCKSPort 

then I get the tor ip. What gives? What am I missing about how torify/torsocks and/or ssh works?

Contents of torsocks.conf:

TorAddress 127.0.0.1 TorPort 9050 # matches tor's SOCKSPort 

edit: I should mention that I'm on MacOS and cannot torify/torsocks /usr/bin/ssh directly since /usr/bin is protected by Apple's System Integrity Protection so I copy it into /tmp/ssh first. I don't imagine that would change anything but don't know what I don't know so...

2 Answers 2

1

From HowToForge:

Add this to your ~/.ssh/config/

Host anon_* CheckHostIP no Compression yes Protocol 2 ProxyCommand connect -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 
0

Try to use full path to your ssh copy like this:

torify /tmp/ssh user@remotemachine torsocks /tmp/ssh user@remotemachine 
2
  • I do that already. The code I put in my question was the simplest presentation of the problem (perhaps too simplified). I'm not at all familair with Apple's System Integrity Protection system but it prevents binaries in /usr/bin (like curl and ssh) from being used with torify/torsocks. Commented Oct 21, 2018 at 15:05
  • I don't know Apple at all but maybe /tmp is not the best choice for exeutables. Have you checked this: lorenzo.mile.si/…? Commented Oct 21, 2018 at 15:26

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.