iri icon indicating copy to clipboard operation
iri copied to clipboard

Setting max connections limit to API

Open nuriel77 opened this issue 8 years ago • 3 comments

Is it possible to add an option: max connections for the API port? This can be very handy for nodes going public. Would be great if this can be set in the configuration file/command line.

nuriel77 avatar Jan 21 '18 19:01 nuriel77

Let me explain why I find this important as a measure of node security:

I am seeing public nodes being hit by attackers (lots of connections to the API port). I realise that the max connections limit will not help a denial of service on the API port, but will at least keep the node's load in check, and prevent max open files from being reached (which leads to IRI crashing eventually).

In addition, I wonder if something can be done in IRI to handle dropped connections:

java    3679 iota  133u  IPv4 321052      0t0  TCP 173.xxx.xxx.xxx:14265->171.xxx.xxx.xxx:43060 (CLOSE_WAIT)

These keep stacking up and I wonder if IRI (undertow?) can handle closing those orphan connections. These can cause the max open file limit to reach (4096 by default)

nuriel77 avatar Jan 23 '18 17:01 nuriel77

My node crashed 3 times running out of open files on rocks db. With enabling limiting on the api port I avoid this, however, if the attacker finds a way around it we will see nodes down again due to this issue.

maeck70 avatar Jan 24 '18 07:01 maeck70

we should definetly give it a try. The current situation for all node owners is no longer sustainable. https://pastebin.com/J204kXKg

micha833 avatar Jan 24 '18 07:01 micha833