-
Notifications
You must be signed in to change notification settings - Fork 37.7k
zmq: Add support to listen on multiple interfaces #18309
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
zmq: Add support to listen on multiple interfaces #18309
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
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.
Concept ACK.
Maybe use a minimal diff
for (const auto& entry : factories)
{
std::string arg("-zmq" + entry.first);
- if (gArgs.IsArgSet(arg))
- {
- CZMQNotifierFactory factory = entry.second;
- std::string address = gArgs.GetArg(arg, "");
+ CZMQNotifierFactory factory = entry.second;
+ for (const std::string& address : gArgs.GetArgs(arg)) {
CZMQAbstractNotifier *notifier = factory();
notifier->SetType(entry.first);
notifier->SetAddress(address);
Also:
- update the doc/zmq.md with this change
- add release note too
- update some test in test/functional/interface_zmq.py with multiple interfaces.
Welcome!
582d81e
to
2dcb4df
Compare
@n-thumann don't forget about this. |
Thank you for your feedback! The test is already in the works :) |
Currently the |
Yes, makes sense in this change. Alternatively it could avoid printing the duplicate messages but not worth it. |
d6f80e8
to
751a5c5
Compare
Tested ACK I tested on Ubuntu 19.10 x86_64 with zmq version 4.3.2. I verified that the node starts when not specifying any of the zmq flags, when starting with between 1 and 3 @n-thumann side note, you might have the right skill set to review my #14687 related to zmq, if you have some spare cycles. that's a small change that the lightning guys have been requesting for a while. thanks! |
751a5c5
to
6b8d300
Compare
concept ACK, will review |
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.
utACK 6b8d300
Small, straight forward change. We can clean up log messages later if they're confusing.
6b8d300
to
ab996c2
Compare
re-utACK ab996c2 |
Concept ACK |
ab996c2
to
d8ecf73
Compare
d8ecf73
to
f50cd3c
Compare
f50cd3c
to
d39d889
Compare
Adjusted log output to new notification types of #19572. |
d39d889
to
e66870c
Compare
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.
utACK
Code review ACK e66870c |
reACK e66870c |
e66870c zmq: Append address to notify log output (nthumann) 241803d test: Add zmq test to support multiple interfaces (nthumann) a0b2e5c doc: Add release notes to support multiple interfaces (nthumann) b1c3f18 doc: Adjust ZMQ usage to support multiple interfaces (nthumann) 347c94f zmq: Add support to listen on multiple interfaces (Nicolas Thumann) Pull request description: This PR adds support for ZeroMQ to listen on multiple interfaces, just like the RPC server. Currently, if you specify more than one e.g. `zmqpubhashblock` paramter, only the first one will be used. Therefore a user may be forced to listen on all interfaces (e.g. `zmqpubhashblock=0.0.0.0:28332`), which can result in an increased attack surface. With this PR a user can specify multiple interfaces to listen on, e.g. `-zmqpubhashblock=tcp://127.0.0.1:28332 -zmqpubhashblock=tcp://192.168.1.123:28332`. ACKs for top commit: laanwj: Code review ACK e66870c instagibbs: reACK bitcoin@e66870c Tree-SHA512: f38ab4a6ff00dc821e5f4842508cefadb701e70bb3893992c1b32049be20247c8aa9476a1f886050c5f17fe7f2ce99ee30193ce2c81a7482a5a51f8fc22300c7
Summary: > This PR adds support for ZeroMQ to listen on multiple interfaces, just like the RPC server. > Currently, if you specify more than one e.g. zmqpubhashblock paramter, only the first one will be used. Therefore a user may be forced to listen on all interfaces (e.g. zmqpubhashblock=0.0.0.0:28332), which can result in an increased attack surface. > With this PR a user can specify multiple interfaces to listen on, e.g. > -zmqpubhashblock=tcp://127.0.0.1:28332 -zmqpubhashblock=tcp://192.168.1.123:28332. This is a backport of [[bitcoin/bitcoin#18309 | core#18309]] Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D10339
This PR adds support for ZeroMQ to listen on multiple interfaces, just like the RPC server.
Currently, if you specify more than one e.g.
zmqpubhashblock
paramter, only the first one will be used. Therefore a user may be forced to listen on all interfaces (e.g.zmqpubhashblock=0.0.0.0:28332
), which can result in an increased attack surface.With this PR a user can specify multiple interfaces to listen on, e.g.
-zmqpubhashblock=tcp://127.0.0.1:28332 -zmqpubhashblock=tcp://192.168.1.123:28332
.