Repository navigation
Conversation
Assisted-by: OpenAI Codex (GPT-6.2 Astra)
Use the ThunderHub package in pinned nixpkgs, a dedicated URI-scoped macaroon and LND's TLS certificate. Keep two-factor enrollment and preferences across restarts, and integrate the dashboard with Tor, netns isolation, backups and nodeinfo. Assisted-by: OpenAI Codex (GPT-6.2 Astra)
ostermayer
left a comment
There was a problem hiding this comment.
I ran the gate on this with GPT-6 Astra, Kimi K3.1 Pro twice, DeepSeek V4.1 Flash and Gemini 4 Carbon. The macaroon, the credential handling and the socket proxy hold up, and RTL's proxy comes out of the refactor unchanged. ThunderHub also keeps the {YML_ENV_n} placeholders when it saves a second factor, because it reads the raw YAML file again before it writes it. Two small bugs and one doc point are inline.
| macaroon: "{YML_ENV_2}" | ||
| certificatePath: "{YML_ENV_3}" | ||
| ''; | ||
| rpcHost = nbLib.address (removePrefix "[" (removeSuffix "]" lnd.rpcAddress)); |
There was a problem hiding this comment.
With services.lnd.rpcAddress = "::", this connects to [::1], but lnd's certificate doesn't cover ::1. lnd.nix adds rpcAddress as it's given, so the certificate has localhost, 127.0.0.1 and ::. ThunderHub checks the certificate, so the login fails with UnableToConnectToThisNode. rpcServer in lnd-macaroons.nix keeps the address unmapped for this reason, and the same code here fixes it. 0.0.0.0 works because 127.0.0.1 is always in the certificate.
| ]; | ||
| systemd.services.thunderhub-proxy = mkIf useProxy { | ||
| serviceConfig = { | ||
| InaccessiblePaths = [ "/run/lnd" ]; |
There was a problem hiding this comment.
/run/lnd only exists while lnd runs. lnd keeps it across restarts but removes it on stop (RuntimeDirectoryPreserve = "restart"). Without a - prefix, the proxy fails to start with 226/NAMESPACE when someone connects while lnd is stopped, for example during boot before lnd is up. Then it backs off up to a minute, so the dashboard can stay unreachable for that long after lnd and ThunderHub are back. The proxy runs as a dynamic user, and /run/lnd is mode 711 with each macaroon readable only by its owner. So -/run/lnd or dropping the line both work.
|
|
||
| ThunderHub verifies LND's TLS certificate and uses its own revocable macaroon. | ||
| **A dashboard login can spend funds**, including sending on-chain payments and | ||
| opening or closing channels. LND denies macaroon administration and signer RPCs, |
There was a problem hiding this comment.
The macaroon still allows lnrpc.Lightning/SignMessage, so a login can sign messages with the node key. LNURL-auth uses DeriveSharedKey from the signer service, which is denied, so the sentence is right. But "signer RPCs" reads as if the dashboard can't sign anything. Saying that it can still sign messages with the node key would make that clear.
Use the address in LND's certificate for the dashboard connection. Share the formatted RPC endpoint with LND, lncli and macaroon creation so bare and bracketed IPv6 addresses work from the listener through login. Allow socket activation while LND's runtime directory is absent. Test activation during a backend stop and cover the RPC address formats. Clarify that the dashboard can sign messages with the node key. Assisted-by: OpenAI Codex (GPT-6.2 Astra)
|
@ostermayer, I addressed all three review comments in 3cd77cd5.
I verified dashboard login in x86_64 NixOS VMs with |
ostermayer
left a comment
There was a problem hiding this comment.
I ran the gate again on 3cd77cd with K3.1 twice, DeepSeek, Gemini and Astra twice. The three fixes hold. With the default address, lnd.conf and the lncli wrapper don't change, so the upgrade doesn't restart lnd. The macaroons in /run/lnd are 0400 for their own users, so the proxy can't read them when it starts without the mask. Two reviewers thought ThunderHub's IP filter would block connections to 0.0.0.0 and ::. I checked that in a VM, and it doesn't. The kernel sends both to loopback before the filter sees the packets.
Use lnd.rpcEndpoint for charge-lnd's --grpc argument and the LNURL server's lnd.host setting. It brackets IPv6 addresses and preserves the wildcard address covered by LND's TLS certificate. Exercise both clients against the IPv6 wildcard in the existing LNURL regtest scenario. Assisted-by: OpenAI Codex (GPT-6.2 Astra)
sebsgent
left a comment
There was a problem hiding this comment.
No must-fix items. One should-fix.
Should: The dashboard makes the operator's browser contact Google. The pinned 0.19.1 index.html loads https://fonts.googleapis.com/css2?family=Noto+Sans…. The CSP the server sends allows https: in style-src and font-src, so the browser fetches the stylesheet and font files on every page load. With the SSH tunnel from the guide, Google sees the operator's clearnet IP each time they open the dashboard. tor.enforce only restricts the service, not the browser, and the docs ("By default the service can only reach local addresses") suggest nothing leaves the machine.
Optional: the CSP also allows connect-src wss://api.boltz.exchange. The browser contacts Boltz directly while swaps are tracked, which may be worth a line in the docs.
Tested: ran the pinned 0.19.1 and checked the served page and CSP header. Matched the macaroon permissions against the lightning library's method map for every call ThunderHub makes. Only the intentionally denied BakeMacaroon, ListMacaroonIDs, DeletePayment (probe cleanup, errors ignored) and DeriveSharedKey are missing. The rtl, rtl-proxy, socket, lnd, charge-lnd and unbeholden-lnurl units are identical to the base commit with default settings.
Assisted-by: Claude Code (Claude Opus 5.5)
Drop the Google Fonts stylesheet and preconnects. ThunderHub already bundles Noto Sans and JetBrains Mono through Fontsource. Restrict font and stylesheet sources and exercise both local WOFF2 assets in the VM. Assisted-by: OpenAI Codex (GPT-6.2 Astra)
Drop the swap page, browser WebSocket provider and GraphQL module, including recovery for saved swaps. Restrict browser connections to the dashboard origin and test that the claim mutation is absent. Assisted-by: OpenAI Codex (GPT-6.2 Astra)
|
@sebsgent, I addressed both browser connections in separate commits.
The x86_64-linux ThunderHub VM fetched both fonts, checked the served policy and confirmed that the claim mutation is absent. All 167 upstream tests passed, and I verified that the installed package contains no |
ostermayer
left a comment
There was a problem hiding this comment.
I ran the gate on 5766fdd and 2fb738e with GPT-6 Astra, Kimi K3.1 Pro twice, DeepSeek V4.1 Flash and Gemini 4 Carbon, and on the earlier commits before. Both patches apply to 0.19.1, nothing on the server still refers to the removed Boltz code, and the browser now loads fonts and connects only to the node. Links like the mempool.space and Amboss ones still open in the browser when you click them, which is fine for a dashboard. With a9a41f6 all my earlier points are fixed too.
|
Re-checked the permissions on 2fb738e. No must or should items.
Optional: add a test that another local user can't connect to Assisted-by: Claude Code (Claude Opus 5.5) |
|
Let's close this PR for now. It seems it needs couple of security updates:
and compatibility with recent LND versions: Will reopen once upstream has cut a new release with the fixes. |
|
Moves RTL and LND changes into #334 |
#334) This PR extracts two independent changes from #326. Each can be reviewed as a separate commit. 1. **RTL socket proxy**. Move RTL’s systemd socket and proxy service into a reusable NixOS module. Systemd still reserves the HTTP port while RTL is stopped and forwards connections to RTL’s Unix socket. The `rtlIPv6` VM permissions check now uses the configured listener, and only scenarios that enable RTL read its address. The shared module validates the port and preserves the secrets and resolver masks when a dashboard has no data directory. [Commit `46cb2f56`](46cb2f5) 2. **LND gRPC endpoint**. Use one endpoint for the LND listener, `lncli`, macaroon creation, charge-lnd and Unbeholden LNURL. Bare and bracketed IPv6 inputs produce the same endpoint syntax. Certificates use the bare IP, and clients keep the configured address when verifying TLS, including wildcard addresses. Empty hosts, whitespace and malformed brackets fail evaluation. [Commit `b0367d66`](b0367d6) The LND module test covers loopback and wildcard addresses on a custom port. The `unbeholden-lnurl-lnd` regtest VM runs both gRPC clients against `[::]`. ### Local verification The `rtlIPv6` VM passed on x86_64 Linux. The RTL commit and the PR head produce the same test derivation. The `unbeholden-lnurl-lnd` VM passed on the PR head. `nix flake check --all-systems`, the CI test-driver evaluation (`nix eval --raw .#ciTestInfo`), shellcheck, release-note validation, and the empty LND RPC host diagnostic also passed. Applying the complete pre-rebase diff (`2fbd6ef5..71196a9`) directly to `master` at `a760f5d3` produced the same Git tree (`0b34b85e`) as the two commits above.
Fixes #136
Enable
services.thunderhub.enable = true;to manage the local LND node through ThunderHub. bitcoinix packages version 0.19.1 from its nixpkgs pin with local dashboard fonts. The package omits the Boltz swap interface, including recovery of saved swaps. The dashboard listens on127.0.0.1:3001by default and supports SSH forwarding, Tor onion services, and network namespace isolation.ThunderHub verifies LND's TLS certificate and uses a dedicated macaroon scoped to individual RPCs. A dashboard login can send funds and manage channels. LND denies macaroon administration, payment-history deletion, and low-level signer RPCs. The YAML account preserves two-factor enrollment across restarts.
nodeinforeports the dashboard address and the backups service includes its settings.The VM tests exercise login, balance queries, invoice creation on regtest, denied macaroon administration, rejection of an untrusted LND certificate, and two-factor login after restart. The operator guide and example configuration include setup and access instructions.
Local verification
default,netns, andnetnsRegtestNixOS VM scenarios passed on x86_64 Linux, along with a dashboard VM using a custom port, user, group and data directory.nix flake check --all-systems, all x86_64 flake check builds, shellcheck, the docs build and release-note validation.