The node holds real funds and is always online. This is the hardening checklist, ordered by how much damage the gap actually allows.
Each of these is a live hole, not a theoretical one. Check the lnd service's
Variables tab and delete any that are still set:
| Variable / setting | Why it must go |
|---|---|
ALLOW_WALLET_CREATE |
Leaves LND's unauthenticated wallet-creation RPC open |
PRINT_CREDS |
Dumps the admin macaroon into the deploy logs on every restart |
REGEN_TLS |
Issues a new TLS cert every boot, breaking both other services |
| TCP proxy on 8080 | Publishes LND's REST API to the internet. Delete the proxy itself, not just the variable |
The only TCP proxy that should remain is 9735.
Left empty, anyone who finds the URL can register a wallet on your node. Public
instances get scanned within hours — expect probes of /admin, /lndhub and
the OAuth endpoints.
LNBITS_ALLOWED_USERS=<your user id>
LNBITS_ADMIN_USERS=<your user id>
Get your user id from the LNbits UI once registered. Set both before the node holds meaningful balance.
The admin macaroon can open and close channels and spend the on-chain wallet. Neither service needs that much, and LNbits — public domain, public registration, biggest attack surface — needs very little.
Run these in the lnd container console (Railway → lnd → Console).
--rpcserver=[::1]:10009 is required: LND binds the IPv6 wildcard and this
container enforces IPv6-only on that socket, so lncli's default IPv4
127.0.0.1 is refused. The same applies to every other lncli command.
LNbits — derived from the only endpoints lnbits/wallets/lndrest.py calls
(/v1/balance/channels, /v1/invoices*, /v2/invoices/*, /v2/router/*).
Cannot spend on-chain, cannot close channels:
lncli --lnddir=/data --rpcserver=[::1]:10009 bakemacaroon \
invoices:read invoices:write offchain:read offchain:writeThunderHub — full channel management, including opening and closing.
LND gates OpenChannel / CloseChannel on onchain:write, the same
permission as SendCoins, so there is no macaroon that opens channels but
cannot sweep the on-chain wallet — granting one grants the other. It still
withholds macaroon:generate (cannot mint further macaroons) and
signer:generate (cannot sign with raw keys). message:write is what the
Amboss login needs — it signs a challenge via /lnrpc.Lightning/SignMessage,
and fails with "Error signing message to login" without it (signer:generate
is a different RPC and does not help):
lncli --lnddir=/data --rpcserver=[::1]:10009 bakemacaroon \
info:read peers:read peers:write \
onchain:read onchain:write \
offchain:read offchain:write \
invoices:read invoices:write \
address:read address:write \
message:read message:writeIf you do not need open/close from the UI, drop onchain:write — ThunderHub
still shows channels, balances, forwards, and fees, and the macaroon can no
longer move on-chain funds.
Each prints { "macaroon": "<hex>" }. Put the hex in LND_REST_MACAROON
(lnbits) and LND_MACAROON_HEX (thunderhub), then redeploy both.
After swapping both services over, the admin macaroon should exist only on the volume — held by no service, pasted into no variable.
Worth being honest about the residual risk: offchain:write still lets a
compromised LNbits pay invoices, so channel balance is reachable. And a
compromised ThunderHub with onchain:write can sweep the on-chain wallet and
force-close channels. Neither macaroon can mint new macaroons, so the admin
macaroon on the volume stays the only full-access credential. This is a
reduction in blast radius, not an elimination.
| Port / service | Exposure | Notes |
|---|---|---|
| 9735 (p2p) | Public, intended | Peers must reach it to open channels |
| LNbits | Public domain | Guarded by user accounts — see §2 |
| ThunderHub | Public domain | Guarded only by masterPassword. Make it long and unique |
| gRPC 10009, REST 8080 | Private network only | Never give these a public domain or TCP proxy |
| Postgres | Private network only | Never expose |
If you do not need ThunderHub reachable from anywhere, removing its public domain and reaching it only when required is the single biggest reduction in attack surface available here.
- Never commit
.env,walletpassword.txt, the seed, or any*.macaroon/tls.*. See.gitignore. - Anyone with Railway project access can read deploy logs. The macaroon was printed there during setup — if project access ever changes hands, rebake macaroons and rotate the ThunderHub password.
- Changing
tlsextradomaindoes not reissue the cert. UseREGEN_TLS=1once, then remove it, then re-dump withPRINT_CREDS=1and remove that too.
- 24-word seed: offline, on paper or metal. The only backup of on-chain funds.
- channel.backup: auto-pushed to Telegram by
lnd/start.shon every change. The file is encrypted by LND with a key derived from your seed, so storing it in a chat is acceptable — it is useless to anyone without the seed. - Verify the Telegram push actually fires after a channel opens. It is silent when broken, and you find out at the worst possible moment.
- Never restore an old
channel.backuponto a running node. It force-closes channels at the recorded state. Disaster recovery only.
- Single replica, no HA. Railway maintenance means downtime.
- A failed payment method suspends the project — an outage with channels open.
- While offline, nobody defends your channels. See the watchtower note in
DEPLOY.md; it matters more as balances grow and with unknown peers.