Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Jetty/Reference/DoSFilter"

(New page: {{Jetty Reference | introduction = The Denial of Service (DoS) filter limits exposure to request flooding, whether malicious, or as a result of a misconfigured client. The filter keeps tra...)
 
m
Line 7: Line 7:
 
The following init parameters control the behavior of the filter:
 
The following init parameters control the behavior of the filter:
  
maxRequestsPerSec
+
* <tt>maxRequestsPerSec</tt>–Maximum number of requests from a connection per second. Requests in excess of this are first delayed, then throttled.
the maximum number of requests from a connection per second. Requests in excess of this are first delayed, then throttled.
+
* <tt>delayMs</tt>–Delay imposed on all requests over the rate limit, before they are considered at all:
delayMs
+
** -1 = Reject request
is the delay given to all requests over the rate limit, before they are considered at all. -1 means just reject request, 0 means no delay, otherwise it is the delay.
+
** 0 = No delay
maxWaitMs
+
** any other value = Delay in ms
how long to blocking wait for the throttle semaphore.
+
* <tt>maxWaitMs</tt>–Length of time, in ms, to blocking wait for the throttle semaphore.
throttledRequests
+
* <tt>throttledRequests</tt>–Number of requests over the rate limit able to be considered at once.
is the number of requests over the rate limit able to be considered at once.
+
* <tt>throttleMs</tt>–Length of time, in ms, to async wait for semaphore.
throttleMs
+
* <tt>maxRequestMs</t>–Length of time, in ms, to allow the request to run.
how long to async wait for semaphore.
+
* <tt>maxIdleTrackerMs</t>–Length of time, in ms, to keep track of request rates for a connection, before deciding that the user has gone away, and discarding it.
maxRequestMs
+
* <tt>insertHeaders</t>–If true, insert the DoSFilter headers into the response. Defaults to true.
how long to allow this request to run.
+
* <tt>trackSessions</t>–If true, usage rate is tracked by session if a session exists. Defaults to true.
maxIdleTrackerMs
+
* <tt>remotePort</tt>If true and session tracking is not used, then rate is tracked by IP+port (effectively connection). Defaults to false.
how long to keep track of request rates for a connection, before deciding that the user has gone away, and discarding it
+
* <tt>ipWhitelist</tt>A comma-separated list of IP addresses that will not be rate limited.
insertHeaders
+
* <tt>managedAttr</tt>If set to true, then this servlet is set as a ServletContext attribute with the filter name as the attribute name. This allows context external mechanism (eg JMX via ContextHandler.MANAGED_ATTRIBUTES) to manage the configuration of the filter.
if true , insert the DoSFilter headers into the response. Defaults to true.
+
trackSessions
+
if true, usage rate is tracked by session if a session exists. Defaults to true.
+
remotePort
+
if true and session tracking is not used, then rate is tracked by IP+port (effectively connection). Defaults to false.
+
ipWhitelist
+
a comma-separated list of IP addresses that will not be rate limited
+
managedAttr
+
if set to true, then this servlet is set as a ServletContext attribute with the filter name as the attribute name. This allows context external mechanism (eg JMX via ContextHandler.MANAGED_ATTRIBUTES) to manage the configuration of the filter.
+
 
}}
 
}}

Revision as of 11:40, 3 September 2010



Introduction

The Denial of Service (DoS) filter limits exposure to request flooding, whether malicious, or as a result of a misconfigured client. The filter keeps track of the number of requests from a connection per second. If the requests exceed the limit, Jetty rejects, delays, or throttles the request, and sends a warning message. This works on the assumption that the attacker might be written in simple blocking style, so by suspending requests you are hopefully consuming the attacker's resources. The DoS filter is related to the QoS filter, using Jetty/Feature/Continuations#Introduction/Continuations to prioritize requests and avoid thread starvation.

(required) Jetty places throttled requests in a priority queue, giving priority first to authenticated users and users with an HttpSession, then to connections identified by their IP addresses. Connections with no way to identify them have lowest priority. To uniquely identify authenticated users, you should implement the The extractUserId(ServletRequest request) function.

The following init parameters control the behavior of the filter:

  • maxRequestsPerSec–Maximum number of requests from a connection per second. Requests in excess of this are first delayed, then throttled.
  • delayMs–Delay imposed on all requests over the rate limit, before they are considered at all:
    • -1 = Reject request
    • 0 = No delay
    • any other value = Delay in ms
  • maxWaitMs–Length of time, in ms, to blocking wait for the throttle semaphore.
  • throttledRequests–Number of requests over the rate limit able to be considered at once.
  • throttleMs–Length of time, in ms, to async wait for semaphore.
  • maxRequestMs</t>–Length of time, in ms, to allow the request to run.
  • <tt>maxIdleTrackerMs</t>–Length of time, in ms, to keep track of request rates for a connection, before deciding that the user has gone away, and discarding it.
  • <tt>insertHeaders</t>–If true, insert the DoSFilter headers into the response. Defaults to true.
  • <tt>trackSessions</t>–If true, usage rate is tracked by session if a session exists. Defaults to true.
  • <tt>remotePortIf true and session tracking is not used, then rate is tracked by IP+port (effectively connection). Defaults to false.
  • ipWhitelistA comma-separated list of IP addresses that will not be rate limited.
  • managedAttrIf set to true, then this servlet is set as a ServletContext attribute with the filter name as the attribute name. This allows context external mechanism (eg JMX via ContextHandler.MANAGED_ATTRIBUTES) to manage the configuration of the filter.

Back to the top