-
Notifications
You must be signed in to change notification settings - Fork 648
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
P2P network security #659
Comments
I may not be understanding the problem this issue is trying to resolve, so please stop reading if I'm off in the weeds. Short version: The longer (and more secure IMHO) fix would be protocol negotiation and authentication. Long version: All of the above was to get to this: If we truly want to know who's who, there should be some authentication beyond ip:port. That may be in the code somewhere, but I don't see it. I haven't looked hard, as some comments I've found indicate connections are not authenticated, so I stopped looking. I have found pieces, as node.cpp:L235 indicates peers have key pairs. With authentication in place, peers know who they're talking to, and can discriminate. With protocol negotiation, peers can choose to degrade the channel to something they don't want, or disconnect (i.e. backward compatibility). As for the not advertising part, it could be agreed upon during negotiation. But I can't imagine a way it could be guaranteed. |
This shoud be: ... that only allows connections to certain ip:port ... This feature would enable a node to hide itself behind trusted peers. Although this can be done via a firewall.
This is correct. The trusted nodes which are hiding a node behind should not let other peers know it. After these are done, an attack wouldn't know where the real block producing node is, so would be harder if still able to attack. |
This looks like something I'd like to tackle. Please let me know if someone else is already working on it. |
Hey @jmjatlanta i think you can go ahead with the short version and the addition of the 2 commands. The longer version seems to require a lot of work and planning even if it seems to be a good idea we probably leave that for the future. |
Here is a list of parameters that can be used in combination to hopefully achieve the desired result. I'll modify this post based on your comments: Parameters that determine who your witness_node connects to:
The "accept-incoming-connections" is an existing field in the node configuration file, now accessible from the command line. |
What I'm researching now: |
This is an advanced feature, which is "good to have" but not "must to have" for this issue.
Should be who can connect your witness_node to. It's important that your node initializes a connection which then exposes your IP address.
Yes. But be aware that there is a peers.db file as well as a
Although we can have this feature, I think a firewall can do the same job. Not sure which one is better though.
This is needed. |
Thank you for the clarifications @abitmore . I have changed the post above to include some of your clarifications. A question: When you say "This is needed." Do you mean (a) the feature is needed, or (b) that a list of peers must be returned when a remote peer requests your list of peers? I believe you are saying (a), but wanted to be sure. And another question: I've made the changes, and have tested it by running 3 nodes on my machine and making sure you can see when you're supposed to, and not see when you're not supposed to. Now I'd like to do this exercise in a repeatable test. I've taken stabs at twisting the application and node classes, but with the implementation embedded in the class, I'm having difficulty calling just the methods I want and checking their results. Are there any suggestions here? I've looked at database_fixture to see if I can glean some ideas, but no success as yet. ... still digging and learning ... |
Thank you.
(a) About testing, sorry I don't know if there are existing code. |
@jmjatlanta I think |
@abitmore What about only advertising a random number of the trusted nodes? That will exclude the node advertising itself, and give a possible attacker something to chew on. Another question for everyone: I have made some changes that allow me to test the node_impl->on_message method. But it required some changes to node.cpp/node.hpp and some others. The changes aren't drastic, but the test is ugly. Rather than pollute the bitshares repository with a PR that has a high probability of drastically changing, I did it in my own repository. Please critique: |
After some pondering and testing, I believe that separating the implementation from the declaration of things like node_impl (by placing the declaration in a header file) will make things easier to test. I am attempting to do so, and will propose a new PR that shows how it will work. I hope this will satisfy the requirements of (1) hide implementations and (2) make things testable. Declarations that we don't want to typically "share" with others will be put in a header file with the extension .hxx. Such header files will exist in the source code directory instead of the include directory. |
I think it's ok to use .hpp as extension, just need to put it in source directory. |
@jmjatlanta Please take a look at this branch https://github.com/bitshares/bitshares-core/tree/network_params |
@abitmore Thank you for the find. That certainly would open up configuring the p2p configuration from the command line. The advertising question: What about another parameter that is
I see this solution as the hardest to implement, but the most comprehensive. Am I overengineering? |
@jmjatlanta I think it's a good idea, so it's good to do it at the correct time (I don't know whether now is the best time). |
Done via #1764. |
For better security,
Possible to port this feature from BitShares1-core.
More ideas are welcome.
The text was updated successfully, but these errors were encountered: