Skip to content
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

Implement banning based on dynamic ban scores #245

Merged
merged 16 commits into from
May 31, 2016

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented May 28, 2016

Contains the following upstream commits:

  • 907152c
    • This commit has already been cherry picked from Decred and is a NOOP
  • c75fea9

dajohi and others added 16 commits February 4, 2016 15:20
This implements the wire protocol encoding portion of a new
sendheaders message as described by BIP0130. It purpose is to request
that a peer sends header commands instead of inv commands when
announcing new blocks. This includes a protocol version bump to 70012
and a wire version bump to 0.4.0.

Note that this does not implement logic to handle the command in btcd,
rather it only makes the command available at the wire protocol level.
A future commit which honors the command and therefore provides full
BIP0130 support is still required.
This commit does not change functionality. It makes the creation of inbound and outbound peers more homogeneous. As a result the Start method of peer was removed as it was found not to be necessary. This is the first of several pull requests/commits designed to make the peer public API and internals less complex.
This updates a couple of logging statements to use the serverPeer
instance instead of the embedded peer.Peer so they are consistent with
all of the other log statements.
Change 'opcodeReserved' to 'opcodeInvalid'
This commit improves and corrects a few comments in txscript to ensure
they match reality.
Dynamic ban scores consist of a persistent and a decaying component. The
persistent score can be used to create simple additive banning policies
simlar to those found in other bitcoin node implementations. The
decaying score enables the creation of evasive logic which handles
misbehaving peers (especially application layer DoS attacks) gracefully
by disconnecting and banning peers attempting various kinds of flooding.
Dynamic ban scores allow these two approaches to be used in tandem.

This pull request includes the following:

 - Dynamic ban score type & functions, with tests for core functionality
 - Ban score of connected peers can be queried via rpc (getpeerinfo)
 - Example policy with decaying score increments on mempool and getdata
 - Logging of misbehavior once half of the ban threshold is reached
 - Banning logic can be disabled via configuration (enabled by default)
 - User defined ban threshold can be set via configuration
Contains the following upstream commits:
- d127ad4
  - This commit has already been cherry picked and is a NOOP
- d759d1d
  - This commit was originally cherry picked from Decred and is a NOOP
- d127ad4
Contains the following upstream commits:
- d272bfe
  - This commit was originally cherry picked from Decred and is a NOOP
- 9abc2c0
Contains the following upstream commits:
- 907152c
  - This commit has already been cherry picked from Decred and is a NOOP
- c75fea9
@jcvernaleo jcvernaleo added this to the v0.1.5 milestone May 28, 2016
@alexlyp
Copy link
Member

alexlyp commented May 31, 2016

tACK

@alexlyp alexlyp merged commit e3c5cd5 into decred:master May 31, 2016
@alexlyp
Copy link
Member

alexlyp commented May 31, 2016

everything for banning seems to work well, though I wasn't able to force a ban with OnGetData. so we may need to tweak thresholds for Decred to have it be useful

@davecgh davecgh deleted the merge_dynamicbanscore branch June 1, 2016 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants