Skip to content

lndconnect and lnconnect add an onion-address entry for the operator user even when the operator is disabled, and that breaks every onion address #166

Closed

Description

@ostermayer

modules/lndconnect.nix gives the operator user access to the onion address of the REST endpoint whenever the onion variant is on:

nix-bitcoin.onionAddresses.access = {
  ${lnd.user} = [ "lnd-rest" ];
  ${operatorName} = [ "lnd-rest" ];   # line 174, and line 207 for clnrest
};

operatorName is nix-bitcoin.operator.name, but the user only exists when nix-bitcoin.operator.enable is true, and that defaults to false. The secure-node preset enables it, so the recommended deployment is fine. A node that enables services.lnd.lndconnect.onion or services.clightning.plugins.clnrest.lnconnect.onion without the preset gets an access.operator entry for a user that isn't there.

onion-addresses then fails at boot. Its script builds every user's directory in a staging area and runs chown '<user>' on it before anything is published. The chown for the missing user fails, the script runs with set -e, and it exits before the staging directory is moved into place. So not one onion address is written, not only the operator's. With nix-bitcoin.onionServices.bitcoind.public = true, bitcoind's preStart reads an empty services/bitcoind file and writes externalip=, and bitcoind refuses to start. clightning's announce-addr ends up as :9735 and lightningd refuses too. The lnconnect helper for clnrest reads the operator directory as well (line 187), so it has nothing to read even if the publish step survived.

Fix in two parts:

  • Add the operator entries only when config.nix-bitcoin.operator.enable is true, in both places, and point the clnrest helper at a directory that exists in that case.
  • In onion-addresses, don't let one bad owner stop every address. Check that each access user exists before the staging run, or assert at evaluation time that every key of nix-bitcoin.onionAddresses.access is a defined user. An eval-time assertion is the clean fix, since the names are all static.

Found by DeepSeek V4.1 Flash 1017 (max) in the review of the tree at e28a7e5. Codex (GPT-6 Astra, xhigh) confirmed it and rated it medium, and added the point about the clnrest helper. I checked the modules and the onion-addresses script.

Activity

  1. added
    type: bug
    area: modules
    on Oct 27, 2026
  2. added a commit that references this issue on Nov 10, 2026
    cf55a0d
  3. added 2 commits that reference this issue on Nov 10, 2026
    919bb71
    8d7714a
  4. added a commit that references this issue on Nov 10, 2026
    6b2acec
  5. added a commit that references this issue on Nov 10, 2026
    2362b11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: modulestype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions