-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bitcoind: add separate p2p socket for tor connections #405
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ let | |
default = config.public; | ||
description = '' | ||
Create an onion service for the given service. | ||
The service must define options 'address' and 'port'. | ||
The service must define options 'address' and 'onionPort' (or `port`). | ||
''; | ||
}; | ||
public = mkOption { | ||
|
@@ -64,7 +64,7 @@ in { | |
inherit (cfg.${name}) externalPort; | ||
in nbLib.mkOnionService { | ||
port = if externalPort != null then externalPort else service.port; | ||
target.port = service.port; | ||
target.port = service.onionPort or service.port; | ||
target.addr = nbLib.address service.address; | ||
} | ||
); | ||
|
@@ -118,6 +118,10 @@ in { | |
externalPort = 80; | ||
}; | ||
}; | ||
|
||
# When the bitcoind onion service is enabled, add an onion-tagged socket | ||
# to distinguish local connections from Tor connections | ||
services.bitcoind.onionPort = mkIf (cfg.bitcoind.enable or false) 8334; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does "or false" do? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's just too much sugar for me |
||
} | ||
]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! This is actually a low to medium security issue because obtaining the mempool via bip35 allows determining the transactions originating from a node (iirc). I think in general the download permission is still necessary, because bitcoin module users might want to use
maxuploadtarget
without breaking their btcpayserver. On the other hand, givingdownload
permissions for inbound onion peers also breaksmaxuploadtarget
(as is the for the electrs module).If you're confident that no whitelisting works with btcpayserver (@nixbitcoin did you test this?) we can merge this to fix the issue of fully whitelisting onion nodes. But my guess is that if we want to do this correctly we won't get around the complexity of having a whitebind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only introduced whitelisting three weeks ago and it has worked fine before.
As mentioned here,
whitebind
is incompatible with listening on all interfaces (0.0.0.0
).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh true that. I remember having issues using btcpayserver without whitelisting but that may have been before we added the btcpayserver module to nix-bitcoin.
Is there a problem with whitebinding on 8335?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would need to add options
listenLocal
andlocalPort
(= 8335
) in bitcoind and liquidd and use them inbtcpayserver
andelectrs
.This adds more complexity and we would move away from the default p2p port which might surprise users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More complex, yes, but seems like the right approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I add it to this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to have, but not extremely high priority (compared to not give full whitelisting permissions to onion peers).