lnd icon indicating copy to clipboard operation
lnd copied to clipboard

Tor general error when connecting to IPv6 hosts in hybrid mode

Open mercurytoxic opened this issue 3 years ago • 4 comments

Background

tor general error when trying to connect to ipv6 nodes when tor.active=true https://github.com/lightningnetwork/lnd/issues/6378 fixed IPv4 clearnet, but IPv6 is still having issues for me.

Your environment

  • -0.14.3.beta.r13053.63f02c2bd https://github.com/lightningnetwork/lnd/commit/63f02c2bd81e90afd908c72e5dd9e69b68506b31
  • -Linux testnet 5.16.10-arch1-1 SMP PREEMPT Wed, 16 Feb 2022 19:35:18 +0000 x86_64 GNU/Linux
  • -Bitcoin Core version v23.0.0

Steps to reproduce

/usr/bin/lncli --network=testnet connect 02cdfbc50a09e40d0adbe54a275eca9bcf4685bd67d697558bcb22c6c0ebcd0be2@[2600:3c02::f03c:92ff:fea5:5c92]:9735

Expected behaviour

To connect. For example: On the same server I use: lightning-cli --network=testnet connect 02cdfbc50a09e40d0adbe54a275eca9bcf4685bd67d697558bcb22c6c0ebcd0be2@[2600:3c02::f03c:92ff:fea5:5c92]:9735 and get

   "id": "02cdfbc50a09e40d0adbe54a275eca9bcf4685bd67d697558bcb22c6c0ebcd0be2",
   "features": "80282a6aa2",
   "direction": "out",
   "address": {
      "type": "ipv6",
      "address": "2600:3c02::f03c:92ff:fea5:5c92",
      "port": 9735
   }
}

Actual behaviour

[lncli] rpc error: code = Unknown desc = tor general error

===================================

With  /usr/bin/lncli --network=testnet listpeers | grep -E '(address|inbound)' | wc -l Get 408/2=204 connected nodes From those 0 are outbound IPv6 and 30 are inbound Tor 6 are outbound Tor and 1 is inbound IPv6

lnd.conf

[Application Options]
alias=aranguren.org
externalip=203.132.94.196
externalip=[2401:d002:3902:700:8708:37c4:e231:d3d8]
externalip=gsw6sn27quwf6u3swgra6o7lrp5qau6kt3ymuyoxgkth6wntzm2bjwyd.onion
maxpendingchannels=5
noseedbackup=true
nat=false
restlisten=[redacted]:8080
tlscertpath=~/.lnd/tls.cert
tlskeypath=~/.lnd/tls.key

[Bitcoin]
bitcoin.active=true
bitcoin.testnet=true
bitcoin.node=bitcoind 

[Bitcoind]
bitcoind.dir=/home/bitcoin
bitcoind.rpcuser=[redacted]
bitcoind.rpcpass=[redacted]
bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332
bitcoind.zmqpubrawtx=tcp://127.0.0.1:28333

[Autopilot]
autopilot.active=true
autopilot.allocation=0.9
autopilot.maxchannels=50000

[Tor]
tor.active=true
tor.socks=10.10.10.6:9050
tor.dns=10.10.10.6:9053
tor.control=10.10.10.6:9051
tor.v3=true
tor.streamisolation=false
tor.privatekeypath=[redacted]
tor.skip-proxy-for-clearnet-targets=true
tor.password=[redacted]

[watchtower]
watchtower.active=true
watchtower.externalip=203.132.94.196
watchtower.externalip=[2401:d002:3902:700:8708:37c4:e231:d3d8]

[Wtclient]
wtclient.active=1

[routerrpc]
routerrpc.maxmchistory=0

[healthcheck]
healthcheck.chainbackend.attempts=3
healthcheck.chainbackend.timeout=10s
healthcheck.chainbackend.backoff=30s

mercurytoxic avatar May 02 '22 17:05 mercurytoxic

I have the exact same problem of connecting to the IPv6 address of a node giving an error of [lncli] rpc error: code = Unknown desc = tor general error this happens on a completely different machine and lnd install compared to my previous post, this time on mainnet.

cat /home/bitcoin/.lnd/lnd.conf 
alias=aranguren.org
bitcoin.active=1
bitcoin.mainnet=1
bitcoin.node=bitcoind
externalip=203.132.94.196:9736
externalip=[2401:d002:3902:700:d72c:5e22:4e95:389d]
nat=false
bitcoind.dir=/home/bitcoin
autopilot.active=0
listen=0.0.0.0:9736 
listen=[::]:9735
 sudo -u bitcoin lncli connect 0298f6074a454a1f5345cb2a7c6f9fce206cd0bf675d177cdbf0ca7508dd28852f@[2601:18c:8080:300f:219:d1ff:fe75:dc2f]:9735
{

}

IPv4 and IPv6 work as intended. Now when I activate tor.

cat /home/bitcoin/.lnd/lnd.conf 
alias=aranguren.org
bitcoin.active=1
bitcoin.mainnet=1
bitcoin.node=bitcoind
externalip=203.132.94.196:9736
externalip=[2401:d002:3902:700:d72c:5e22:4e95:389d]
externalip=gsw6sn27quwf6u3swgra6o7lrp5qau6kt3ymuyoxgkth6wntzm2bjwyd.onion:9736
nat=false
bitcoind.dir=/home/bitcoin
autopilot.active=0
listen=0.0.0.0:9736 
listen=[::]:9735

[Tor]
tor.active=true
tor.socks=10.10.10.6:9050
tor.dns=10.10.10.6:9053
tor.control=10.10.10.6:9051
tor.v3=true
tor.streamisolation=false
tor.privatekeypath=/home/bitcoin/.lnd/v3_onion_private_key
tor.skip-proxy-for-clearnet-targets=true
tor.password=[redacted]

and I restart Tor and lnd, it won't connect to IPv6 nodes anymore, IPv4 and Tor works well.

lncli connect 0298f6074a454a1f5345cb2a7c6f9fce206cd0bf675d177cdbf0ca7508dd28852f@[2601:18c:8080:300f:219:d1ff:fe75:dc2f]:9735
[lncli] rpc error: code = Unknown desc = tor general error

Also it creates two different uris for Tor

lncli getinfo
{
    "version": "0.14.1-beta commit=",
    "commit_hash": "",
    "identity_pubkey": "02450500fa04c03e76ce1f01d5338006111bf5347fabfc14bc2344d4193dfd8abb",
    "alias": "aranguren.org",
    "color": "#3399ff",
    "num_pending_channels": 0,
    "num_active_channels": 2,
    "num_inactive_channels": 5,
    "num_peers": 9,
    "block_height": 735915,
    "block_hash": "000000000000000000077917a26db44fb08cdfdf6801a2616e614182afdb15f9",
    "best_header_timestamp": "1652270289",
    "synced_to_chain": true,
    "synced_to_graph": true,
    "testnet": false,
    "chains": [
        {
            "chain": "bitcoin",
            "network": "mainnet"
        }
    ],
    "uris": [
        "02450500fa04c03e76ce1f01d5338006111bf5347fabfc14bc2344d4193dfd8abb@203.132.94.196:9736",
        "02450500fa04c03e76ce1f01d5338006111bf5347fabfc14bc2344d4193dfd8abb@[2401:d002:3902:700:d72c:5e22:4e95:389d]:9735",
        "02450500fa04c03e76ce1f01d5338006111bf5347fabfc14bc2344d4193dfd8abb@gsw6sn27quwf6u3swgra6o7lrp5qau6kt3ymuyoxgkth6wntzm2bjwyd.onion:9736",
        "02450500fa04c03e76ce1f01d5338006111bf5347fabfc14bc2344d4193dfd8abb@klkd7brly4mhc7jil243jmrrgprpzame3kwkqkwie2pssysqc3pwqtad.onion:9735"

I don't know where that last uri is coming from, it's not configured in my Tor hidden services or in lnd.conf.

mercurytoxic avatar May 11 '22 13:05 mercurytoxic

I have the same issue where I cannot connect to ipv6 nodes while tor is active - "tor general error" Version 0.14.3-beta

huilder avatar May 26 '22 00:05 huilder

I'm in the same situation! IPv6 not working for me either, but inbound connections are no problem. Tested by connecting to my node with Breez (on mobile data, not in the same network).

Fittiboy avatar May 28 '22 09:05 Fittiboy

To reproduce:

[Tor]
tor.active=1
tor.skip-proxy-for-clearnet-targets=true
tor.v3=1

lncli connect 027ce055380348d7812d2ae7745701c9f93e70c1adeb2657f053f91df4f2843c71@[2a01:4f8:c2c:e8a0::1]:9735

Please remove the "missing reproduction" tag.

C-Otto avatar Aug 07 '22 10:08 C-Otto

I was able to reproduce this error in 0.16.3-beta commit=lightning-terminal-v0.10.1-alpha

While Tor is running, I can't make outgoing connections to IPv6 nodes, even though lnd.tor.skip-proxy-for-clearnet-targets=1 is set. When removing the Tor configuration, I'm able to connect to the IPv6 node.

With Tor:

lncli connect 02e64da75794703de72e9a8d6394747bc40fd72d0121c5dda6c1bd845939e30bb7@[2602:ffb6:4:c927:f816:3eff:fea0:ef40]:9735
[lncli] rpc error: code = Unknown desc = tor general error

Without Tor:

lncli connect 02e64da75794703de72e9a8d6394747bc40fd72d0121c5dda6c1bd845939e30bb7@[2602:ffb6:4:c927:f816:3eff:fea0:ef40]:9735
{

}

Liongrass avatar Jun 21 '23 18:06 Liongrass

Same here, running lnd version 0.16.3-beta commit=v0.16.3-beta.

Getting the [lncli] rpc error: code = Unknown desc = tor general error message when trying to connect to an IPv6 peer while Tor is enabled and tor.skip-proxy-for-clearnet-targets=1. I can connect to IPv4 and Tor peers with no issue.

If I want to connect to IPv6 peers I need to remove the Tor configuration in lnd.conf.

ghost avatar Jun 21 '23 18:06 ghost