dashpay / dash

Dash - Reinventing Cryptocurrency
https://www.dash.org
MIT License
1.49k stars 1.2k forks source link

torcontrol assumes that tor proxy is on the localhost #4369

Closed lano1106 closed 3 years ago

lano1106 commented 3 years ago

When torcontrol executes ADD_ONION command, it uses the hardcoded localhost 127.0.0.1.

This only works if tor proxy is running on the same machine than dashd.

On a LAN setup sharing a single tor proxy for all the hosts on the LAN, this will fail with

2021-08-28T21:48:01Z tor: Add onion failed; error code 513

if the proxy is on a different machine.

A possible fix would be to use the bind address if specified...

That being said, that might be an upstream issue if this code comes straight from bitcoin...

lano1106 commented 3 years ago

I gave my idea a shot and it didn't fix the problem. I did tweak a little bit the logs to have more info. I printed the torcontrol reply first line instead of the error code. Here is what I got:

2021-08-29T14:19:06Z tor: Add onion cmd: ADD_ONION NEW:RSA1024 Port=9999,192.168.1.179:9999
2021-08-29T14:19:06Z tor: Add onion failed; error Invalid key type
lano1106 commented 3 years ago

I found something interesting. With tor 0.4.6.7, the algorithm RSA1024 is not accepted anymore. The only choices are:

BEST or ED25519-V3

lano1106 commented 3 years ago

fixed by

https://github.com/bitcoin/bitcoin/pull/19954/commits/dcf0cb477699d11afd0ff37c8bfb2b1b4f7f1ee5