Merge pull request #11292 from ViktorT-11/2026-10-harden-remote-signing-no-op
What changed, and why it matters
This change is a hardening fix for LND's remote-signing feature. Previously, if a node was configured to act as an outbound remote signer but was compiled without the required 'signrpc' and 'walletrpc' sub-servers, it would silently fall back to a no-op client. That left the signer node running and appearing healthy while never connecting to the watch-only node, and the watch-only node would wait indefinitely for a signer that never arrives. The patch makes this a fatal startup error with a clear message naming the missing build tags and how to rebuild. It also centralizes the 'is this a signer node?' check so future graduation out of experimental mode only needs one code change.
Operators using the outbound remote signer feature should verify their signer node binary includes the signrpc and walletrpc build tags; official release binaries already include them. Source builders should use tags='signrpc walletrpc ...' or 'make build with-rpc=1'. Reviewers should confirm IsSignerNode() is used consistently elsewhere and that the error is surfaced before the wallet unlock stage.
Security signals we found
silent-degradation-to-no-op prevented
configuration-misconfiguration now surfaces as fatal error
build-tag-dependency explicitly validated at runtime
encapsulation of experimental feature flag for future hardening
follow-up to prior hardening PR #8754
Evidence from the diff
The commit modifies lncfg/remotesigner.go to add WatchOnlyNode.IsSignerNode(), encapsulating the ExperimentalEnable flag. config.go and remote_signer_client_builder.go now call IsSignerNode() instead of reading ExperimentalEnable directly. The builder now detects missing signrpc/walletrpc sub-servers and, if IsSignerNode() is true, returns a wrapped ErrSignerSubServersMissing with the missing build tags and rebuild instructions, instead of returning a NoOpClient. If the node is not a signer, missing sub-servers still produce a NoOpClient as before. Tests cover all combinations of signer flag and sub-server availability, plus the error message contents.
Changed components
lncfg/remotesigner.golnwallet/rpcwallet/remote_signer_client_builder.goconfig.godocs/remote-signing.mdInspect captured patch +241 / −12
### config.go
@@ -1966,9 +1966,7 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
// Validate that the node isn't configured as both a remote signer and a
// watch-only node.
- if cfg.RemoteSigner.Enable &&
- cfg.WatchOnlyNode.ExperimentalEnable {
-
+ if cfg.RemoteSigner.Enable && cfg.WatchOnlyNode.IsSignerNode() {
return nil, fmt.Errorf("cannot be configured as both a " +
"watchonly node and a remote signer node " +
"simultaneously")
### docs/remote-signing.md
@@ -281,6 +281,15 @@ wallet with a connected watch-only wallet. After this setup, the signer and
watch-only node can be started as usual, provided the configuration from these
steps remains in place.
+Note: The outbound signer node needs the `signrpc` and `walletrpc` sub-servers
+to service signing requests from the watch-only node. The official release
+binaries include them. If you build `lnd` from source, make sure `signrpc` and
+`walletrpc` are part of the build tags you pass, alongside any other tags your
+setup needs, for example `make install tags="signrpc walletrpc <other tags>"`.
+See the [installation guide](INSTALL.md) for the full list of tags. A signer
+node built without them exits with an error naming the missing tags once its
+wallet has been unlocked.
+
#### Step 1: export the `xpub`s of the outbound signer node's wallet
When starting the signer node to export the `xpub`s of the wallet, these entries
### lncfg/remotesigner.go
@@ -166,9 +166,20 @@ func DefaultWatchOnlyNodeCfg() *WatchOnlyNode {
}
}
+// IsSignerNode returns true if the node has been configured to act as a remote
+// signer node that connects to a watch-only node.
+//
+// NOTE: This is the single place that decides whether the outbound remote
+// signer feature has been requested. Callers should use this rather than
+// reading the configuration fields directly, so that when the feature graduates
+// out of experimental mode only this function needs to change.
+func (w *WatchOnlyNode) IsSignerNode() bool {
+ return w.ExperimentalEnable
+}
+
// Validate checks the values set in the WatchOnlyNode config are valid.
func (w *WatchOnlyNode) Validate() error {
- if !w.ExperimentalEnable {
+ if !w.IsSignerNode() {
return nil
}
### lnwallet/rpcwallet/remote_signer_client_builder.go
@@ -1,12 +1,33 @@
package rpcwallet
import (
+ "errors"
+ "fmt"
+ "strings"
+
"github.com/lightningnetwork/lnd/lncfg"
"github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/lnrpc/signrpc"
"github.com/lightningnetwork/lnd/lnrpc/walletrpc"
)
+const (
+ // signerBuildTag and walletBuildTag are the names of the build tags
+ // that gate the sub-servers required to service remote signing
+ // requests. They are spelled out here rather than referenced from the
+ // sub-server packages, as those packages only export their identifiers
+ // when the corresponding tag is enabled, which is exactly the case we
+ // need to produce an error message for.
+ signerBuildTag = "signrpc"
+ walletBuildTag = "walletrpc"
+)
+
+// ErrSignerSubServersMissing is returned when the node has been configured to
+// act as a remote signer node, but lnd was built without the sub-servers that
+// are required to service signing requests.
+var ErrSignerSubServersMissing = errors.New("unable to act as a remote " +
+ "signer node")
+
type rscBuilder = RemoteSignerClientBuilder
// RemoteSignerClientBuilder creates instances of the RemoteSignerClient
@@ -21,9 +42,17 @@ func NewRemoteSignerClientBuilder(cfg *lncfg.WatchOnlyNode) *rscBuilder {
return &rscBuilder{cfg}
}
-// Build creates a new RemoteSignerClient instance. If this node is configured
-// to act as a remote signer that dials the watch-only node, an OutboundClient
-// is returned. Otherwise a NoOpClient is returned.
+// Build creates a new RemoteSignerClient instance. If the configuration enables
+// an outbound remote signer, a new OutboundRemoteSignerClient will be returned.
+// Else, a NoOpClient will be returned.
+//
+// If the node has been configured to act as a remote signer but the sub-servers
+// required to service signing requests are unavailable, an error is returned
+// rather than a NoOpClient. Degrading to a no-op in that case would leave the
+// signer node running and reporting healthy while never connecting to the
+// watch-only node, which in turn leaves the watch-only node waiting for a
+// signer connection that is never coming, with nothing in either node's logs at
+// the default log level to explain why.
//
// NOTE: "outbound" here is from this node's point of view, as it is this node
// that dials out. The watch-only node calls the resulting connection inbound.
@@ -45,17 +74,44 @@ func (b *rscBuilder) Build(subServers []lnrpc.SubServer) (
}
}
- // Check if we have all servers and if this node is configured to act as
- // a remote signer that dials the watch-only node. If not, return a
- // NoOpClient.
- if walletServer == nil || signerServer == nil {
+ // Collect the build tags of any required sub-server that isn't
+ // available, so that we can name them specifically if the node did ask
+ // to act as a remote signer.
+ var missingTags []string
+ if walletServer == nil {
+ missingTags = append(missingTags, walletBuildTag)
+ }
+ if signerServer == nil {
+ missingTags = append(missingTags, signerBuildTag)
+ }
+
+ // Check if we have all servers and if the configuration enables an
+ // outbound remote signer. If not, return a NoOpClient.
+ if len(missingTags) > 0 {
+ // We cannot service any signing requests without these
+ // sub-servers, so if the node was configured to act as a remote
+ // signer, this is a misconfiguration we must surface instead of
+ // silently ignoring it.
+ if b.cfg.IsSignerNode() {
+ return nil, fmt.Errorf("%w: lnd was built without "+
+ "the %s sub-server(s), which are required to "+
+ "service signing requests. Rebuild lnd with "+
+ "the %q and %q build tags enabled (e.g. 'make "+
+ "build with-rpc=1'), or use an official "+
+ "release build", ErrSignerSubServersMissing,
+ strings.Join(missingTags, " and "),
+ signerBuildTag, walletBuildTag)
+ }
+
log.Debugf("Using a No Op remote signer client due to " +
"current sub-server support")
return &NoOpClient{}, nil
}
- if !b.cfg.ExperimentalEnable {
+ // Check if this node is configured to act as a remote signer that dials
+ // the watch-only node. If not, return a NoOpClient.
+ if !b.cfg.IsSignerNode() {
log.Debugf("Using a No Op remote signer client due to the " +
"current watchonly config")
### lnwallet/rpcwallet/remote_signer_client_test.go
@@ -8,6 +8,7 @@ import (
"testing"
"time"
+ "github.com/lightningnetwork/lnd/lncfg"
"github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/lnrpc/signrpc"
"github.com/lightningnetwork/lnd/lnrpc/walletrpc"
@@ -731,3 +732,157 @@ func (m *mockSignerServer) InjectDependencies(
return nil
}
+
+// TestRemoteSignerClientBuilder tests that the RemoteSignerClientBuilder
+// returns the correct client for every combination of the watch-only node
+// configuration and the availability of the sub-servers that are required to
+// service signing requests.
+//
+// The case that matters most is a node that has been configured to act as a
+// remote signer while the required sub-servers are unavailable, i.e. lnd was
+// built without the signrpc and/or walletrpc build tags. That must be a loud
+// error, as a NoOpClient would leave the signer node running and reporting
+// healthy while never connecting to the watch-only node.
+func TestRemoteSignerClientBuilder(t *testing.T) {
+ t.Parallel()
+
+ var (
+ walletKitServer = &mockWalletKitServer{}
+ signerServer = &mockSignerServer{}
+ )
+
+ tests := []struct {
+ name string
+
+ // isSignerNode indicates if the node has been configured to act
+ // as a remote signer node.
+ isSignerNode bool
+
+ // subServers are the sub-servers that are passed to the
+ // builder.
+ subServers []lnrpc.SubServer
+
+ // expectedClient is the type of client we expect the builder to
+ // return. It is nil if we expect the builder to error out.
+ expectedClient RemoteSignerClient
+
+ // expectedErr is the error we expect the builder to return. It
+ // is nil if we expect no error.
+ expectedErr error
+
+ // expectedErrContains are substrings that the returned error
+ // must additionally contain, to check that it names the
+ // missing build tags.
+ expectedErrContains []string
+ }{
+ {
+ name: "not a signer node, no sub-servers",
+ isSignerNode: false,
+ subServers: nil,
+
+ // A node that isn't acting as a remote signer has no
+ // use for the sub-servers, so their absence is
+ // expected and must remain a no-op.
+ expectedClient: &NoOpClient{},
+ },
+ {
+ name: "not a signer node, all sub-servers",
+ isSignerNode: false,
+ subServers: []lnrpc.SubServer{
+ walletKitServer, signerServer,
+ },
+ expectedClient: &NoOpClient{},
+ },
+ {
+ name: "signer node, no sub-servers",
+ isSignerNode: true,
+ subServers: nil,
+
+ // Both sub-servers are missing, so both build tags
+ // should be named in the error.
+ expectedErr: ErrSignerSubServersMissing,
+ expectedErrContains: []string{
+ walletBuildTag,
+ signerBuildTag,
+ },
+ },
+ {
+ name: "signer node, only the walletkit server",
+ isSignerNode: true,
+ subServers: []lnrpc.SubServer{walletKitServer},
+
+ // Only the signer sub-server is missing, so only that
+ // build tag should be reported as missing.
+ expectedErr: ErrSignerSubServersMissing,
+ expectedErrContains: []string{
+ "lnd was built without the " + signerBuildTag +
+ " sub-server(s)",
+ },
+ },
+ {
+ name: "signer node, only the signer server",
+ isSignerNode: true,
+ subServers: []lnrpc.SubServer{signerServer},
+ expectedErr: ErrSignerSubServersMissing,
+ expectedErrContains: []string{
+ "lnd was built without the " + walletBuildTag +
+ " sub-server(s)",
+ },
+ },
+ {
+ name: "signer node, all sub-servers",
+ isSignerNode: true,
+ subServers: []lnrpc.SubServer{
+ walletKitServer, signerServer,
+ },
+ expectedClient: &OutboundClient{},
+ },
+ }
+
+ for _, test := range tests {
+ t.Run(test.name, func(t *testing.T) {
+ t.Parallel()
+
+ cfg := lncfg.DefaultWatchOnlyNodeCfg()
+ cfg.ExperimentalEnable = test.isSignerNode
+
+ builder := NewRemoteSignerClientBuilder(cfg)
+
+ client, err := builder.Build(test.subServers)
+
+ if test.expectedErr != nil {
+ require.ErrorIs(t, err, test.expectedErr)
+ require.Nil(t, client)
+
+ for _, sub := range test.expectedErrContains {
+ require.ErrorContains(t, err, sub)
+ }
+
+ return
+ }
+
+ require.NoError(t, err)
+ require.IsType(t, test.expectedClient, client)
+ })
+ }
+}
+
+// TestRemoteSignerClientBuilderErrorNamesBuildInstructions tests that the error
+// returned when a signer node is missing its sub-servers tells the operator how
+// to fix it. The root cause is a missing build tag, which an operator has no
+// way of inferring from a bare "sub-server unavailable" message.
+func TestRemoteSignerClientBuilderErrorNamesBuildInstructions(t *testing.T) {
+ t.Parallel()
+
+ cfg := lncfg.DefaultWatchOnlyNodeCfg()
+ cfg.ExperimentalEnable = true
+
+ _, err := NewRemoteSignerClientBuilder(cfg).Build(nil)
+ require.ErrorIs(t, err, ErrSignerSubServersMissing)
+
+ // The error must name the build tags to enable, and point at a concrete
+ // way of producing a binary that has them.
+ require.ErrorContains(t, err, "build tags enabled")
+ require.ErrorContains(t, err, "make build with-rpc=1")
+ require.ErrorContains(t, err, "official release build")
+}Why this scored 32/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.