Repository navigation
Description
Without netns-isolation, lnd's REST server (127.0.0.1:8080 by default) and clnrest (127.0.0.1:3010) listen on the host's loopback address. While a daemon is down, for example during a restart or an update, any other local user can bind its port. This is the same problem #293 fixed for RTL.
The onion services from lndconnect.onion and clnrest.lnconnect.onion forward to these ports, and the WireGuard helpers connect to the same ports on the WireGuard address. The connection URLs use --nocert, so a wallet that connects during the downtime sends lnd's admin macaroon or clnrest's admin rune to whoever holds the port.
Adding the certificate to the URLs doesn't help ZEUS, the wallet our docs name:
- Its lndconnect and clnrest parsers don't use the
cert/certsparameter (utils/ConnectionFormatUtils.ts). - Over Tor it accepts any certificate for https
.onionhosts (isOnionHttpsUrl). - Without Tor,
certVerificationis off by default.
So the fix has to stop other users from taking the ports.
Options so far:
- lnd onion service: lnd also serves REST on a Unix socket (
restlisten=unix://…), and Tor forwards the onion service to it. Only lnd and tor can access the socket's directory. lnd keeps its TCP listener for RTL and local clients. The onion address and port stay the same, so wallets don't need to pair again. - clnrest only accepts an IP address in
clnrest-host, and the WireGuard URLs need the TCP ports, so option 1 doesn't cover them. Candidates:- netns-isolation, where the daemons listen on their namespace's address. This needs no new code, but it's optional today.
- A firewall rule that accepts connections on the port only for the daemon's own sockets (nftables
socket cgroupv2). Untested. It must keep working while the daemon is stopped and after a restart.
- Enable netns-isolation by default in the secure-node preset. This also covers other onion services that forward to loopback ports, such as electrs and fulcrum, where a wallet would send its addresses to whoever holds the port. It is a breaking change and needs a versioning notice.
Until this is fixed, netns-isolation prevents it.
@prusnak, what do you think about option 3? Reported by @ostermayer, who has a branch for option 1 ready.
Assisted-by: Claude Code (Claude Opus 5.5)
Activity
ostermayer commentedon Nov 27, 2026
A small correction. The branch I had ready put the certificate in the URLs, and I've dropped it. I'm building option 1 for lnd's onion service now and will link the PR here.
ostermayer commentedon Nov 27, 2026
#343 forwards lnd's onion service to a Unix socket. clnrest and the WireGuard URLs aren't part of it, so they stay open here.
Forward lnd's REST onion service to a Unix socket (#343)
sebsgent commentedon Nov 28, 2026
#347 will close this issue. For v0.2.1:
0.0.0.0and doesn't support netns-isolation. docs: explain that netns-isolation keeps other local users off the REST and Electrum ports #347 says not to give untrusted users an account on such a node.WireGuard and whether the secure-node preset should enable netns-isolation by default continue in #349.
Assisted-by: Claude Code (Claude Opus 5.5)
docs: explain that netns-isolation keeps other local users off the RE…