ralphwetzel / theonionbox

Dashboard to monitor Tor node operations
MIT License
122 stars 17 forks source link

Unable to determine SOCKS version on every machine #47

Closed TheEpTic closed 6 years ago

TheEpTic commented 6 years ago

Hey,

I recently started using this as a way of hopefully monitoring all my nodes at once and allowing me to add more and more without worry. I got it setup and working fine but whenever I refresh I get this:

[WARN] 03:11:33.688 Onionoo: Failed querying 'http://tgel7v4rpcllsrk2.onion/weights' -> Unable to determine SOCKS version from socks5h://127.0.0.1:9050 [WARN] 03:11:33.696 Onionoo: Failed querying 'http://tgel7v4rpcllsrk2.onion/bandwidth' -> Unable to determine SOCKS version from socks5h://127.0.0.1:9050 [WARN] 03:11:33.700 Onionoo: Failed querying 'http://tgel7v4rpcllsrk2.onion/details' -> Unable to determine SOCKS version from socks5h://127.0.0.1:9050

I've tried this on multiple machines, all running recommended versions of Tor and all having working client ports.

I've also tried using the git repo, and pip repo. Any ideas? Would greatly appreciate it! :)

ralphwetzel commented 6 years ago

Just guessing: 1) Your installation tries to access a socks port at socks5h://127.0.0.1:9050. Have you enabled this port in your torrcfile? The option is named SocksPort (or __SocksPort). You can verify this setting via TheOnionBox:

image

2) Your installation tries to connect to socks5h://127.0.0.1:9050 yet your Tor provides a different port. In that case, you need to tell your Box where to find this Tor provided port - via the [TorProxy] section in the configuration file of your installation.

TheEpTic commented 6 years ago

Hey! Thanks for the response, as you can see below TheOnionBox shows the correct port.

chrome_2018-04-28_19-14-14 1

The socks port also works fine for third party programs such as proxychains:

root@relay05:~# proxychains curl google.com
ProxyChains-3.1 (http://proxychains.sf.net)
|DNS-request| google.com
|S-chain|-<>-127.0.0.1:9050-<><>-4.2.2.2:53-<><>-OK
|DNS-response| google.com is 172.217.21.46
|S-chain|-<>-127.0.0.1:9050-<><>-172.217.21.46:80-<><>-OK
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
root@relay05:~#

Line in torrc SocksPort 9050 shows the socksport is 100% there and used by tor

ralphwetzel commented 6 years ago

Which version of the requests package do you operate with? In a python console:

>>> import requests
>>> requests.__version__
'2.18.4'
TheEpTic commented 6 years ago

Exactly the same on my end

root@relay05:~# python
Python 2.7.13 (default, Nov 24 2017, 17:33:09)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> requests.__version__
'2.18.4'
>>>
ralphwetzel commented 6 years ago

urllib3?

>>> import urllib3
>>> urllib3.__version__
'1.22'
TheEpTic commented 6 years ago

Yeah, same version. Is there a way that I can list all the imports and their versions? That way I can just dump it all in one go for you :)

ralphwetzel commented 6 years ago

If you're not affected by #45 & run theonionbox in debug mode, you'll get a dump of the module versions used by your installation:

python theonionbox.py -d

or (within your enabled VirtualEnv): theonionbox -d

Unfortunately I had to disable this (for the time being) if you're using pip10 to hot fix #45.

TheEpTic commented 6 years ago
[DEBUG] 13:58:37.628 theonionbox.py[651]: Required packages version verification:
[DEBUG] 13:58:37.712 theonionbox.py[661]: > tzlocal 1.5.1 installed. ['1.5'] required.
[DEBUG] 13:58:37.713 theonionbox.py[661]: > stem 1.6.0 installed. ['1.5.4'] required.
[DEBUG] 13:58:37.715 theonionbox.py[661]: > requests 2.18.4 installed. ['2.18.0'] required.
[DEBUG] 13:58:37.716 theonionbox.py[661]: > pysocks 1.6.8 installed. ['1.6.7'] required.
[DEBUG] 13:58:37.718 theonionbox.py[661]: > futures 3.2.0 installed. ['3.2'] required.
[DEBUG] 13:58:37.719 theonionbox.py[661]: > bottle 0.12.13 installed. ['0.12.13'] required.
[DEBUG] 13:58:37.720 theonionbox.py[661]: > apscheduler 2.1.2 installed. ['2.1.2', '3.4.0'] required.

Okay, I got the versions for you :)

ralphwetzel commented 6 years ago

This is a tough challenge. :smirk: Please launch python exactly as you would do to run theonionbox.

pi@raspberrypi:~/theonionbox $ source bin/activate
(theonionbox) pi@raspberrypi:~/theonionbox $ python
Python 2.7.13 (default, Nov 24 2017, 17:33:09) 
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

Then:

>>> from urllib3.util.url import parse_url
>>> parse_url('socks5h://127.0.0.1:9050')
Url(scheme='socks5h', auth=None, host='127.0.0.1', port=9050, path=None, query=None, fragment=None)

?

TheEpTic commented 6 years ago

It does seem to be a challenge, I can't get any reference to this anywhere else D:

Also, I got the same output:

root@relay05:~# python
Python 2.7.13 (default, Nov 24 2017, 17:33:09)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from urllib3.util.url import parse_url
>>> parse_url('socks5h://127.0.0.1:9050')
Url(scheme='socks5h', auth=None, host='127.0.0.1', port=9050, path=None, query=None, fragment=None)
>>>
TheEpTic commented 6 years ago

May I add that I've experienced this with an OVH dedi, a scaleway baremetal server and a raspberry pi. Maybe spinning up a VM or using a raspberry pi from scratch could possibly yield the same results.

ralphwetzel commented 6 years ago

Following your proposal I set up a RPi from scratch ... and it's working perfectly; no error. So there seems to be "a something" that is unique to the way you set up your systems ... which leads to the strange behaviour encountered.

TheEpTic commented 6 years ago

It seems changing the TorProxy to the machine's address over 127.0.0.1 fixes it. It was a user error, my apologizes!

ralphwetzel commented 6 years ago

I‘m glad you managed to fix it. 👍 Enjoy operating your Onion Box! Closed.