2

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

yansal
  • 141
  • 1
  • 5

3 Answers3

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
}
yansal
  • 141
  • 1
  • 5
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 =)

Alexey Vesnin
  • 6,385
  • 3
  • 15
  • 36
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.

james-see
  • 344
  • 1
  • 12