1

I installed tor and torsocks on OS X 10.11 with brew and then ran tor.

$ brew up
$ brew install tor torsocks
$ tor --version
Tor version 0.2.7.6.
$ torsocks --version
Torsocks 2.1.0
$ tor

In another terminal window, I checked that the connection to the tor network was OK.

$ curl --socks5-hostname localhost:9050 https://check.torproject.org/api/ip
{"IsTor":true,"IP":"81.209.35.112"}

However, when I tried to use torsocks, it didn't work.

$ torsocks curl https://check.torproject.org/api/ip 
{"IsTor":false,"IP":"XX.XXX.XX.XXX"}

I noticed that torsocks is a shell script and tried to reproduce its behaviour with the following commands but it didn't work either.

$ export DYLD_INSERT_LIBRARIES=/usr/local/Cellar/torsocks/2.1.0/lib/torsocks/libtorsocks.dylib
$ export DYLD_FORCE_FLAT_NAMESPACE=1
$ curl https://check.torproject.org/api/ip
{"IsTor":false,"IP":"XX.XXX.XX.XXX"}

What can I do to debug this problem?

Edit: the IP address returned by https://check.torproject.org is mine, ie. torsocks curl https://check.torproject.org/api/ip and curl https://check.torproject.org/api/ip return exactly the same output

Edit: tor log

$ tor Jan 14 17:16:34.173 [notice] Tor v0.2.7.6 running on Darwin with Libevent 2.0.22-stable, OpenSSL 1.0.2e and Zlib 1.2.5. Jan 14 17:16:34.174 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning Jan 14 17:16:34.175 [notice] Configuration file "/usr/local/etc/tor/torrc" not present, using reasonable defaults. Jan 14 17:16:34.180 [notice] Opening Socks listener on 127.0.0.1:9050 Jan 14 17:16:34.000 [notice] Parsing GEOIP IPv4 file /usr/local/Cellar/tor/0.2.7.6/share/tor/geoip. Jan 14 17:16:34.000 [notice] Parsing GEOIP IPv6 file /usr/local/Cellar/tor/0.2.7.6/share/tor/geoip6. Jan 14 17:16:34.000 [notice] Bootstrapped 0%: Starting Jan 14 17:16:34.000 [notice] Bootstrapped 80%: Connecting to the Tor network Jan 14 17:16:35.000 [notice] Bootstrapped 85%: Finishing handshake with first hop Jan 14 17:16:35.000 [notice] Bootstrapped 90%: Establishing a Tor circuit Jan 14 17:16:35.000 [notice] Tor has successfully opened a circuit. Looks like client functionality is working. Jan 14 17:16:35.000 [notice] Bootstrapped 100%: Done

2

I found some clues reading this question: https://apple.stackexchange.com/questions/212586/torsocks-not-working-in-el-capitan

Suppose I installed httpie with brew

$ brew install httpie

The following command line won't have expected result:

$ torsocks http https://check.torproject.org/api/ip
HTTP/1.1 200 OK
Connection: Keep-Alive
Content-Length: 35
Content-Type: application/json
Date: Tue, 19 Jan 2016 11:12:30 GMT
Keep-Alive: timeout=15
Strict-Transport-Security: max-age=15768000
Via: 1.1 check.torproject.org

{ 
    "IP": "XX.XX.XX.XXX", 
    "IsTor": false
}

But if I install httpie with pip instead of brew

$ brew uninstall httpie
$ brew install python
$ pip install httpie

The same command line will use tor.

$ torsocks http https://check.torproject.org/api/ip
HTTP/1.1 200 OK
Connection: Keep-Alive
Content-Length: 35
Content-Type: application/json
Date: Tue, 19 Jan 2016 11:06:08 GMT
Keep-Alive: timeout=15
Strict-Transport-Security: max-age=15768000
Via: 1.1 check.torproject.org

{ 
    "IP": "195.154.56.44", 
    "IsTor": true
}
|improve this answer|||||
0

Is the IP shown yours? If it's not - it's just a bug in an external detector you're using. Not all the exit nodes are detectable =)

|improve this answer|||||
  • Yes, the IP is mine. I'll edit the question to clarify. – yansal Jan 14 '16 at 10:18
  • @yansal have you tried to check the SOCKS functionality? can you paste Tor log here? – Alexey Vesnin Jan 14 '16 at 16:05
  • What do you mean by "checking the SOCKS functionality" ? I'll edit the question to add tor log – yansal Jan 14 '16 at 16:18
  • @yansal have you tried to pass through SOCKS proxy something like HTTP/HTTPS from another system and have seen it working? i.e. verify the SOCKS working. In your log I see no problems at all, it seems cURL wasn't talking to it. try to replace localhost with 127.0.0.1 and paste your torrc - are SocksPolicy directives OK? – Alexey Vesnin Jan 14 '16 at 22:10
0

I believe to use torsocks you use the handy torify wrapper and it just works, e.g. from yours above: torify curl https://check.torproject.org/api/ip

I used this method at the time of this writing to curl my own domain jamescampbell.us and it worked fine.

To test on something that is actually a .onion site, try the duckduckgo onion url:

torify curl 3g2upl4pq6kufc4m.onion and check your results.

If you get resolution errors, you can try the direct approach with curl domain resolution turned off that is built-in to curl (note the socks5-hostname vs socks5):

curl --socks5-hostname 127.0.0.1:9050 3g2upl4pq6kufc4m.onion

Hope that at least points you in the right direction.

|improve this answer|||||
  • Using torify instead of torsocks doesn't work. Using one or another returns the exact same input. Using the --socks5-hostname option in curl works, but is irrelevant because I would like to use other command line utilities which don't have that option. – yansal Jan 14 '16 at 17:34
  • @yansal have you tried proxychains-ng? It allows you to wrap any command line util in a list of proxies you set. I have found this to be the best approach besides setting up privoxy and routing traffic that way or writing code in python and using the STEM package. – jamescampbell Jan 14 '16 at 17:49
  • I will have a look, but I would really prefer keeping the setup as simple as possible – yansal Jan 14 '16 at 18:06
  • @yansal to implement there is a single conf file and you run it the same way as torify & torsocks but as proxychains4 before each command instead. – jamescampbell Jan 14 '16 at 18:27

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.