Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Add banning mechanism #3343

Closed
shuse2 opened this issue Nov 22, 2018 · 0 comments
Closed

Add banning mechanism #3343

shuse2 opened this issue Nov 22, 2018 · 0 comments
Assignees

Comments

@shuse2
Copy link
Collaborator

shuse2 commented Nov 22, 2018

Description

With phase 2 from LIP0004, we have to introduce a robust mechanism in lisk-p2p. There is a ban score for every peer that is initially 0 and at most 100. It is increased every time a peer sends invalid information or too many messages. Once the ban score reaches 100, a peer is banned for a period of banTime seconds and the ban score is reset to 0. The default value of banTime is 86400, which corresponds to 24 h, and it can be changed by the user in the configuration.

  • Ban scores are stored in memory and not broadcast.

  • Banned peers are further removed from the collections triedPeers and newPeers and stored in a separate data structure to be able to prevent reconnection of the banned peer for banTime seconds.

  • The peers that are declared whitelisted or fixed and the seed nodes are never banned.

  • Blacklisted peers stay permanently banned.

  • For keeping track of the number of Events/RPCs in a 10-second window for a message type, it is sufficient to use a counter that is reset to 0 every 10 seconds instead of counting the number of calls in a sliding 10 s window.

Banned peers need to be maintained and checked during peer selection and discovery.

@shuse2 shuse2 transferred this issue from LiskArchive/lisk-elements Apr 15, 2019
@shuse2 shuse2 assigned mitsuaki-u and unassigned ishantiw May 8, 2019
jondubois added a commit that referenced this issue May 29, 2019
Implement peer banning mechanism - Closes #3343 #3664
@shuse2 shuse2 closed this as completed Jun 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants