You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
lnd: a custom macaroon baked for a normal user is readable by everyone in group users #130
services.lnd.macaroons.<name>.user bakes a scoped macaroon for another user, and docs/configuration.md points operators at it for any application that needs lnd access ("give it a separate macaroon with the permissions it needs via services.lnd.macaroons"). The lnd-create-macaroons script in modules/lnd.nix writes the file like this:
So the macaroon is 0440, owned by the user and by the user's primary group, in /run/lnd, which has mode 711 (RuntimeDirectoryMode) and is traversable by everyone. Who's in that primary group decides who can read the macaroon:
For a system user with its own group, as charge-lnd has, only that user, which is fine.
For the operator, or any isNormalUser account, the primary group is users, which every normal user on the host shares. A macaroon baked for the operator is therefore readable by every login account, and the operator is exactly the user most people would name here, since the operator is the one who runs lncli and local tools. With {"entity":"offchain","action":"write"} in the permissions, that's payment authority for everyone with a shell.
Nothing needs group read on these files, because the consumer runs as the named user.
Fix: umask u=r,go= and chown "${user}:root" (or chown to the user and chmod 400), so the file is 0400 owned by the user with the group left out of it. A test can bake a macaroon for operator in the regtest scenario and assert stat -c '%a %U %G' gives 400 operator root, and that a second normal user can't read it.
I can send that PR if you want it.
Found by DeepSeek V4.1 Flash 1017 at max thinking in the review of #62's tree. GPT-6 Astra, run at xhigh reasoning as the second opinion, confirmed it and rated it medium, and I checked it against master 4452d89.
@ostermayer Yes, please send the PR. It still applies: #236 moves the script to modules/lnd-macaroons.nix with the same umask ug=r,o=, so base it on #236 or rebase it once #236 is merged.
Activity
lnd: turn off Multipath TCP in the lnd listeners (#187)
seberm commentedon Nov 12, 2026
@ostermayer Yes, please send the PR. It still applies: #236 moves the script to
modules/lnd-macaroons.nixwith the sameumask ug=r,o=, so base it on #236 or rebase it once #236 is merged.Assisted-by: Claude Code (Claude Opus 5.5)
prusnak commentedon Nov 13, 2026
#236 has been merged
lnd-macaroons: make custom macaroons readable only by their user