BUIP053: (closed) Tweakable client DoS responses

freetrader

Moderator
Staff member
Dec 16, 2015
2,806
6,088
Summary

In recent followup work on the denial-of-service (DoS) responses of the client, there have been calls for a clear policy in terms of treatment of misbehaving peers.

Instead of a rigid "design guideline" based approach, which still hardcodes certain responses, it is proposed to move client DoS response firmly into the "user policy" arena by making the design guideline simply state "punishments for misbehaving peers should always be configurable by the user".

Motivation

The Bitcoin system's network environment is complex and always changing in unpredictable ways.

Currently, the BU software contains some hardcoded responses of the type "if a peer exhibits behavior A, ban the peer" or "if a peer exhibits behavior B, increase the peer's denial-of-service score by so-and-so much".
Once a client's DoS score reaches a certain level (100), the client is banned for a default period of 24 hrs.
In some cases, the client's network response may also be to straightaway disconnect the peer.

Hardcoded responses are inconvenient, as they make it necessary to deliver client updates (new releases) which could be avoided by issuing advisories to users to adjust configuration settings.

They also prevent users from easily defending their own BU nodes, which may be subject to focused attacks.

As an example, we have had reports (unverified) that a mining pool was being attacked in a specific way. Having tunable settings could give advanced users immediate remedy against such attacks, and be able to share effective measures with others.

Configurable options allow the 'emergent consensus' / swarm intelligence to develop better and faster responses for the defense of the node network than can be done by a small group of developers.

Implementation considerations

It is proposed to convert all responses into Misbehaving() calls, with the strength of the response (the amount which to increase the client's DoS score) to be made into a specific "tweak" (a configurable parameter which can be set in the configuration files, but also changed at runtime).

The value should range from 0 (do nothing) to whatever is necessary to get the peer banned immediately (currently 100 should achieve that).

The built-in default values of these new "response" tweaks should be set to emulate current behavior as closely as possible.

A default parameter file extract should be delivered as an example with the client, describing the response parameters (exactly to which defensive situation they apply). This will allow advanced users to easily include whichever of these in their own configurations, and adapt them as they need.

The parameters would be changeable at runtime through RPC calls (this is an existing mechanism applying to all tweakable parameters).

The GUI client should get a separate window tab for tweaking these DoS response levels.
A slider bar is envisioned for each response parameter, preset to its configured value.

Further discussion

The author would welcome discussion of all aspects of this proposal, as it is currently only at the "concept" stage - although technically it does not require much beyond what is already available as features in the software.
 
Last edited:

awemany

Well-Known Member
Aug 19, 2015
1,387
5,054
Some random feedback:

- I am o.k. with the idea, but not super-excited to make everything more complex needlessly. What are the believable scenarios where a fixed ban score does not make sense? Are there guidelines for ban scores available already?

- Can the code be made 'minimally invasive', e.g. so that merges of patches on top of Core can still happen without a lot of hassle? I imagine a tool could be made so that the ban(..)/misbehaving(..) call becomes a macro and the code location (somehow, meta data in comments?) names the configuration variable?
Which also sounds like complexity, admittedly ...

A default parameter file extract should be delivered as an example with the client, describing the response parameters (exactly to which defensive situation they apply). This will allow advanced users to easily include whichever of these in their own configurations, and adapt them as they need.
At risk of bike-shedding, I'd make it (maybe specially named, e.g. prefixed/suffixed) configuration settings within bitcoin.ini, and not another config file.
 

freetrader

Moderator
Staff member
Dec 16, 2015
2,806
6,088
@awemany : thanks for the feedback!

the code location (somehow, meta data in comments?) names the configuration variable
This breaks static analysis tools. But I like the idea of trying to keep it easy to merge patches from elsewhere. Will have to think on that - if anyone else has more suggestions on this, please let me know!

specially named, e.g. prefixed/suffixed) configuration settings within bitcoin.ini
As I understand it, this is how parameters built on BU's new Tweak class operate already.
So absolutely, users could just take whichever of these they want to modify, and add them into their bitcoin.conf.
They would have some descriptive names, e.g.

# amount to increase DoS score of peer for every bad POW
# (not matching network difficulty) in thinblock header
net.dos_response.bad_thinblock_pow=20


The names above are fictional - I'd have to check what matches actual tweak naming, but they have a dot notation prefix scheme.
 
Last edited:
  • Like
Reactions: awemany and HostFat

theZerg

Moderator
Staff member
Aug 28, 2015
1,012
2,327
Seems fine to me. Using "tweaks" is very appropriate. Released from developer review, for public review and voting...
 
  • Like
Reactions: freetrader