Skip to content

docs: explain that netns-isolation keeps other local users off the REST and Electrum ports - #347

Merged
seberm merged 1 commit into
bitcoinix:masterfrom
sebsgent:docs-netns-port-takeover
Nov 29, 2026
Merged

seberm merged 1 commit into
bitcoinix:masterfrom
sebsgent:docs-netns-port-takeover

Conversation

@sebsgent

@sebsgent sebsgent commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Without netns-isolation, clnrest, electrs and Fulcrum listen on the host's loopback address, and their onion services forward there. While a service is down, for example during a restart or an update, another local user can listen on its port and receive the clnrest rune from ZEUS or a wallet's addresses. With netns-isolation, the services listen on their namespace's address, and a process in the host namespace can't receive connections to it.

This documents that on the ZEUS and electrs/Fulcrum pages and in the netns-isolation section, and adds a 0.2.1 release-note draft. lnd's onion service forwards to a Unix socket since #343 and isn't affected.

The WireGuard preset (lndconnect-wg, lnconnect-clnrest-wg) binds lnd and clnrest to 0.0.0.0 and can't be combined with netns-isolation, so it isn't covered. The same applies to the direct REST connection examples. The ZEUS page says not to give untrusted users an account on such a node.

Docs only, no code or config changes.

Closes #342.

Assisted-by: Claude Code (Claude Opus 5.5)

@github-actions github-actions Bot added area: docs docs/, README, examples/, SECURITY.md, book.toml, assets size: M 30–99 changed lines (additions + deletions) labels Nov 28, 2026
@sebsgent
sebsgent force-pushed the docs-netns-port-takeover branch from c7349cb to c858a04 Compare November 28, 2026 22:15
@seberm seberm added this to the v0.2.1 milestone Nov 28, 2026
@seberm
seberm marked this pull request as ready for review November 28, 2026 22:19
@seberm
seberm requested a review from ostermayer November 28, 2026 22:19
@sebsgent
sebsgent force-pushed the docs-netns-port-takeover branch from c858a04 to c4b8fda Compare November 28, 2026 22:38

@ostermayer ostermayer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebsgent I ran our gate on c4b8fda with Kimi K3.1 Pro twice, DeepSeek V4.1 Flash, Gemini 4 Carbon and GPT-6 Astra twice, and checked each finding against the code. The default ports, the netns-isolation support for clnrest, electrs and Fulcrum, the WireGuard assertion and the links are right.

One small fix in docs/configuration.md. The new bullet says that without netns-isolation, any other local user can take a service's port while the service is down. That isn't true for RTL and Orchard. A systemd socket from modules/web-interface-proxy.nix holds their port while they're stopped, so another user's bind fails with EADDRINUSE. Naming the services that bind their port themselves, like clnrest, electrs and Fulcrum, would make it right.

@ostermayer ostermayer added status: changes needed Cannot proceed until suggested changes are implemented type: bug Behaviour is wrong vs. documented or intended labels Nov 28, 2026
@sebsgent
sebsgent force-pushed the docs-netns-port-takeover branch from c4b8fda to 78bf540 Compare November 29, 2026 10:08
@sebsgent

Copy link
Copy Markdown
Contributor Author

@ostermayer Thanks, fixed in 78bf540. The netns-isolation bullet now says that most services, such as clnrest, electrs and Fulcrum, bind their port themselves, and that RTL and Orchard aren't affected because a systemd socket from modules/web-interface-proxy.nix holds their port while they're stopped. The rest of the PR (ZEUS, electrs, release note) already names only services that bind their own port, so it's unchanged.

Assisted-by: Claude Code (Claude Opus 5.5)

@seberm
seberm requested a review from ostermayer November 29, 2026 10:12
@seberm seberm removed the status: changes needed Cannot proceed until suggested changes are implemented label Nov 29, 2026

@ostermayer ostermayer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebsgent I reran our gate on 78bf540 with DeepSeek V4.1 Flash 1017 (max), Gemini 4 Carbon (high), Gemini 4 Neon (high), Claude Opus 5.5 (high) and GPT-6 Astra (max), and checked each finding against the code. The bullet is right now, and the Orchard link resolves to docs/services/orchard.md.

One small point, and it doesn't block. The socket holds RTL's and Orchard's port only once it has started. Its unit name comes from the listen address (modules/web-interface-proxy.nix:18), so enabling RTL or Orchard, changing the address or port, or turning off netns-isolation starts a new socket unit. If another user already listens on the port, the socket fails, but RTL still starts on its Unix socket because it only binds to its backends (modules/rtl.nix:395), and the onion service forwards to the other user. "once its socket has started" in the bullet would cover this. Making RTL and Orchard require their socket would make them fail closed, which fits better in a follow-up.

…e ports

Without netns-isolation, clnrest, electrs and Fulcrum listen on the
host's loopback address, and their onion services forward there. While
a service is down, another local user can listen on its port and receive
the clnrest rune or a wallet's addresses. With netns-isolation, the
services listen on their namespace's address, which no process in the
host namespace can take.

RTL and Orchard aren't affected once their systemd socket has started,
because it holds their port while they're stopped, so the
netns-isolation section names them as exceptions.

The WireGuard preset and the direct REST connection examples can't be
combined with netns-isolation, so the ZEUS page says not to give
untrusted users an account on such a node.

Assisted-by: Claude Code (Claude Opus 5.5)
@sebsgent
sebsgent force-pushed the docs-netns-port-takeover branch from 78bf540 to 7d7c6d0 Compare November 29, 2026 15:55
@seberm
seberm enabled auto-merge November 29, 2026 15:57
@seberm
seberm merged commit 7a6dc3b into bitcoinix:master Nov 29, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: docs docs/, README, examples/, SECURITY.md, book.toml, assets size: M 30–99 changed lines (additions + deletions) type: bug Behaviour is wrong vs. documented or intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lndconnect: another local user can take lnd's and clnrest's REST ports while they are down

3 participants