ElementsProject / lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
Other
2.83k stars 896 forks source link

Inbound TOR connections not working #4644

Closed kalibox closed 3 years ago

kalibox commented 3 years ago

Issue and Steps to Reproduce

CL node is setup with both clearnet and TOR addresses; clearnet in and out bound connections work OK. TOR outbound works OK but inbound does not work.

getinfo output

config file: bind-addr=in.te.rn.al:9735 announce-addr=longalphanumerical.onion:9735 announce-addr=pu:bl:ic:ad:9735 proxy=127.0.0.1:9050

getinfo: "address": [ { "type": "ipv4", "address": "pu:bl:ic:ad", "port": 9735 }, { "type": "torv3", "address": "longalphanumerical.onion", "port": 9735 } ], "binding": [ { "type": "ipv4", "address": "in.te.rn.al:", "port": 9735 } ]

I've read the TOR.md article and I believe the config looks OK but can someone please chime in and see anything glaringly wrong here.

Many thanks.

Saibato commented 3 years ago

I am curious, how do you measure and be sure that inbound over Tor v3 onions do not work? And btw what version or compile of c-ln do you use?

Have u tried from local or any other cruft you have to simple TCP connect to the node with (netcat) `nc -vv -x 127.0.0.1:9050 longalphanumerical.onion 9735 ??

kalibox commented 3 years ago

Hi @Saibato, thanks for your reply. I've been testing with another Lightning user/node and whilst they can connect to my node over clearnet, they are unable to connect over TOR. I've had a few other LN nodes fail when trying to connect over TOR too (trying to increase inbound liquidity).

I'll try the netcat command you've mentioned but does the config look OK to you?

Thanks

kalibox commented 3 years ago

Also, version running on my node is - v0.10.0-27-gbbfcae6

Saibato commented 3 years ago

...but does the config look OK to you?

The config looks ok to me, to be bound internal to an other ip than external, should be no problem for Tor and cLN, And btw cLN does not display in config explicitly that is is indirect bound to the local Tor ip or (127.0.0.1) since that is implied by defaults as Tor should route the traffic to the .onion to your internal ip and port u bound the cLN to, To hide the bindings and tunnel service endpoints through NAT is the purpose of Tor. Sometimes ppl host there LN on leases hosted on crufts that have there local loopback not set to 127,0.0.1 i.e when cLN is hosted in secured sub virtual Open/FreeBSD,then those bind often to 10.x.x.x and not to 127.0.0.1 is it that the case and do you use such an OS? Then u have to replace in your configs 127.0.0.1 with that i.e. 10.x.x.x and or add an additional --bind-addr=10.x.x.x:7935

kalibox commented 3 years ago

Hi @Saibato, my OS is Ubuntu 20.04 and I have tried binding it to 127.0.0.1 instead of my LAN IP but that breaks the inbound clearnet connections as the service is listening on 127.0.0.1:9735. I've tested this and also confirmed by looking up the netstat table. Are you suggesting that I leave the current config as is and add another bind-addr=127.0.0.1?

Thanks in advance.

Edit: Hi again @Saibato, just to clarify- my node is hosted privately in my home on a VM and not on a hosted service.

kalibox commented 3 years ago

nc -vv -x 127.0.0.1:9050 longalphanumerical.onion 9735

Hi @Saibato, tried your command and the response is the expected:

nc: connection failed, SOCKSv5 error: Host unreachable

Do you think I should add both these lines to my config:

bind-addr=192.168.1.22:9735 bind-addr=127.0.0.1:9735

Thanks.

kalibox commented 3 years ago

This is now sorted after adding the second bind addr :)

Thanks!