Repository navigation
Add native unbeholden-lnurl service for LND and Core Lightning - #288
Conversation
Package v0.3.0 and add typed settings, scoped node credentials, persistent secrets and state, Tor and namespace isolation, backups, documentation and integration tests. Assisted-by: Codex (gpt-6.1-sol)
restart-bitcoind, config-replace and clnrest-admin-rune start clightning six times within seconds on fast scenarios, which hits systemd's default start limit. Assisted-by: Claude Code (claude-opus-5-5)
- Keep the CLN rune in the data dir and reuse it while its restrictions stay the same. Blacklist it when they change, so that disabling a feature revokes its methods. Previously every start created another valid rune. - Add `unbeholden-lnurl-vouchers` to print unclaimed vouchers. - Use plain option declarations and a freeform `settings` type. - Drop the redundant StateDirectory and Tor client setup. - Move the release note to 0.2.0, add the package to the version manifest and run two LNURL scenarios in CI. Assisted-by: Claude Code (claude-opus-5-5)
- Update the package to v0.4.0, which adds `-diagnose`. - Default `settings.withdraw_secret_file` to null and generate no voucher secret when `settings.withdraw_secret` is set. The app rejects configs that set both. - Link the example config on the `main` branch. - Group the netns address assignment with the other services. Assisted-by: Claude Code (claude-opus-5-5)
Assisted-by: Claude Code (claude-opus-5-5)
Assisted-by: Claude Code (claude-opus-5-5)
Assisted-by: Claude Code (claude-opus-5-5)
viberaven
left a comment
There was a problem hiding this comment.
Reviewed 73c2e2e. I found three actionable issues, detailed inline: a privileged symlink write in CLN credential setup, missing recovery after backend stop/start, and wildcard listener addresses being rewritten to loopback.
Validation: built checks.x86_64-linux.module-config, checks.x86_64-linux.test-runner, and unbeholden-lnurl (including its Go tests). All passed. I also ran a disposable KVM test based on unbeholden-lnurl-cln and reproduced all three findings against the unchanged PR code. This was a targeted reproduction test, not a rerun of the full six-scenario matrix.
Review assisted by Codex (gpt-6-astra).
- Access the data dir and clnrest's certs dir only as their owners, so a planted symlink can't redirect a root write. Check the saved rune with `showrunes` instead of a restrictions file, and revoke only a rune that clightning stored. - Pass the rune to `showrunes` as `rune=`, since a rune with `=` was parsed as a key=value pair and the old rune was never revoked. - Start the service from the backend's ExecStartPost, so it comes back after a backend stop and start. - Keep wildcard listen addresses instead of rewriting them to loopback. - Fetch the package by tag and drop `meta.platforms`. Assisted-by: Claude Code (Claude Opus 5.5)
|
Addressed in 3819076:
All six |
# Conflicts: # test/tests.nix
|
Hello @unbeholdendev , please recheck this review: The earlier findings are fixed in 17191d6. Must fix
Should fix
Tested: CI green on 17191d6. Locally, Assisted-by: Claude Code (Claude Opus 5.5) |
|
Closes #256 |
ostermayer
left a comment
There was a problem hiding this comment.
I ran our reviews on 17191d66. seberm's URI list covers the macaroon, so here's the rest. I'd fix the first one before merge.
- The service user can still make the root setup script blacklist any rune.
lightning-clicopies a value wrapped in"into the request as is (is_literalincli/lightning-cli.c). Socln-runecan add a top-levelfilterto theshowrunescall that hidesstored,our_runeandblacklisted. The jq step then answersrevoke <id>for a forged rune with any id, for example 0, which is usually clnrest's admin rune that RTL and lnconnect use. Check the file against the rune alphabet first, then callshowruneswith no argument and match.runethroughjq --arg. That also keeps the rune off the command line, where any local user can read it in/procwhile the script runs. - An old rune stays valid when the file changes or goes away. The file is the only record, so when it's missing or wrong the script makes a new rune and never blacklists the old one. Nothing blacklists it when the service is disabled or moves to lnd either. If the rune id lived where the service can't write, the script could revoke it in those cases, like
lnd-macaroons.nixdoes with root keys. - After a restore, vouchers claimed since the backup can be claimed again, because the claims only live in
state.jsonand the secret comes back too. That's worth a line next to the channel database warning indocs/services.md. - Behind the onion service every caller comes from Tor's address, so they all share one rate limit bucket and one client can starve the rest.
- lnd runs with
GODEBUG=multipathtcp=0since #187. This is a new public Go listener, so it should get the same.
- LND: grant only the six RPCs the service calls, as `uri` permissions, instead of whole entities such as `offchain:write`. - CLN: clightning records the ID of the service's rune in its own data dir. The setup compares the service's rune file with that rune and never passes the file to lightning-cli, so a forged file can't pick a rune to revoke. A changed or missing file revokes the recorded rune. clightning also revokes it when the service is disabled or uses LND. - Run with GODEBUG=multipathtcp=0, like lnd. - Docs: what vouchers can pay, re-claims after a restore, the shared rate limit behind the onion service, and zap receipts leaking the IP without the Tor proxy. Assisted-by: Claude Code (Claude Opus 5.5)
|
Addressed in b7ae669:
|
Match the service name used elsewhere in bitcoinix, so the backend value is also its systemd unit and netns service name. Assisted-by: Claude Code (Claude Opus 5.5)
|
Checked One edge case is left, and it's not blocking. After clightning starts on a new or restored database, the recorded ID can belong to another rune, and the next start revokes that one. #291 has the same case for RTL and documents it in |
On a new or restored clightning database, the recorded ID can belong to another rune, and the next start revoked that rune. Record the rune itself and revoke only the ID that clightning lists for it. Assisted-by: Claude Code (Claude Opus 5.5)
Move the release note into docs/release-notes/0.2.0/. Assisted-by: Claude Code (Claude Opus 5.5)
viberaven
left a comment
There was a problem hiding this comment.
My three original findings are fixed on 80ea000. CLN setup writes service-owned files as the service user and the symlink regression checks the target. Backend startup brings LNURL back, and the bitcoind stop/start test includes LNURL. The listener now preserves wildcard addresses and brackets IPv6.
One credential exposure from the follow-up discussion remains. Both setupCln and revokeRecordedRune pass the full recorded CLN rune to jq via --arg recorded. During a normal restart that rune remains valid. On a host with the usual process visibility, another local user can read it from jq's command line while jq waits for showrunes. With vouchers enabled the rune authorizes payments. Please pass the recorded value through a protected file descriptor or a process-scoped environment variable in both places and update the jq filters accordingly.
I reviewed the current diff and checked GitHub CI. The LND and CLN-netns scenarios passed. I did not rerun the VMs locally.
Assisted-by: Codex (gpt-6.2-astra)
Any local user can read a process's arguments while it runs. Pass the recorded rune to jq through the environment, which only its user and root can read. Assisted-by: Claude Code (Claude Opus 5.5)
|
Addressed in e01d185: @viberaven:
|
|
Re-reviewed e01d185. This resolves my last change request. Both I also checked that setup keeps a matching rune, rotates it when its permissions change, and that cleanup selects only the matching active rune. The No remaining findings from my review. Assisted-by: Codex (gpt-6.2-astra) |
|
Please resolve merge conflicts - GitHub UI shows there are none, but there are some ... |
Summary
Adds
services.unbeholden-lnurl, a native package (v0.4.0) and module for Unbeholden LNURL: Lightning Addresses, withdrawal vouchers, ntfy notifications and Nostr zaps from the local node.The module also generates persistent secrets and wires up backups, Tor, netns isolation (id 34) and
sudo unbeholden-lnurl-vouchers. No versioning notice: the service is new and off by default.Evidence
The
unbeholden-lnurlVM test requests an address and an invoice and checks the verify URL. On CLN, it also checks that a restart reuses the rune and that changed restrictions revoke it.On a KVM host, the head passes
nix flake check --all-systems, shellcheck,mdbook buildand the sixunbeholden-lnurl-{lnd,cln}{,-netns,-tor}scenarios. CI runs-lndand-cln-netns.Merge Danger
Door: two-way
Blast Radius: small
Outside the new module, the only change that affects other scenarios is in
test/suite/restarts.py:clnrest-admin-runenow resets clightning's systemd start limit, which earlier tests use up on fast scenarios.Models
Codex GPT-6.1 Sol wrote the first version. Claude Opus 5.5 wrote the follow-up commits.