Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

[PAN-1683] Limit the fraction of wire connections initiated by peers #1665

Conversation

AbdelStark
Copy link
Contributor

@AbdelStark AbdelStark commented Jul 10, 2019

PR description

To protect against eclipse attacks, we should not allow all of our wire connections to be initiated from network peers. Some fraction of wire connections should be initiated by our node by connecting to peers in our discovery peer table. This PR ensures the fraction abides the limit.

  • RlpxAgent checks the fractionRemoteConnectionsAllowed in handleIncomingConnection method
  • add a cli option to configure the fraction: --fraction-remote-connections-allowed
  • introduce Fraction class to handle the conversion of the CLI option to a double and check if the value is between 0.0 and 1.0
  • added explicit CI flag to enable the protection against eclipse attack: --limit-remote-wire-connections-enabled

Fixed Issue(s)

To protect against eclipse attacks, we should not allow all of our wire connections to be initiated from network peers.  Some fraction of wire connections should be initiated by our node by connecting to peers in our discovery peer table. This PR ensures the fraction abides the limit.
@AbdelStark AbdelStark added security Related to security enhancement New feature or request labels Jul 10, 2019
@AbdelStark AbdelStark requested review from NicolasMassart, mbaxter, ajsutton, shemnon and RatanRSur and removed request for NicolasMassart and mbaxter July 11, 2019 07:40
@AbdelStark AbdelStark requested a review from shemnon July 11, 2019 16:23
@@ -236,6 +237,21 @@ void setBootnodes(final List<String> values) {
"Maximum P2P peer connections that can be established (default: ${DEFAULT-VALUE})")
private final Integer maxPeers = DEFAULT_MAX_PEERS;

@Option(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these names need a once over for UX. I opened PIE-1766 to cover that.

@AbdelStark AbdelStark merged commit 17a09af into PegaSysEng:master Jul 11, 2019
@AbdelStark AbdelStark deleted the feature/pan-1683-limit-fraction-remote-wire-connections branch August 23, 2019 16:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request security Related to security
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants