-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Experimental DosHandler #12068
Open
gregw
wants to merge
24
commits into
jetty-12.1.x
Choose a base branch
from
experiment/jetty-12.0.x/DosHandler
base: jetty-12.1.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,070
−0
Open
Experimental DosHandler #12068
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
073719a
Experimental DosHandler
gregw a50561c
Converted to exponential moving average.
gregw a800fff
Javadoc
gregw 28ef152
Experimental DosHandler
gregw 14ae55e
Experimental DosHandler
gregw a929386
Experimental DosHandler
gregw 73d546c
Experimental DosHandler
gregw 71a3eb8
Experimental DosHandler
gregw 52c533a
Experimental DosHandler
gregw d0a9eab
Experimental DosHandler
gregw 51ba764
Experimental DosHandler
gregw fc6c2d3
Experimental DosHandler
gregw f1dbb02
Experimental DosHandler
gregw 4f8d2f5
Experimental DosHandler
gregw b904bbf
Merge branch 'jetty-12.1.x' into experiment/jetty-12.0.x/DosHandler
gregw 7363151
Updates from review
gregw 41a6e8e
updates from review
gregw d769987
Merge branch 'jetty-12.1.x' into experiment/jetty-12.0.x/DosHandler
gregw 04dbe06
Merge remote-tracking branch 'origin/jetty-12.1.x' into experiment/je…
gregw 26ab55f
WIP updates from review
gregw 3f5ec3d
Merge branch 'jetty-12.1.x' into experiment/jetty-12.0.x/DosHandler
gregw 033f0bb
WIP updates from review
gregw 65252a3
WIP updates from review
gregw 40a68bf
WIP
gregw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://jetty.org/configure_10_0.dtd"> | ||
|
||
<Configure id="Server" class="org.eclipse.jetty.server.Server"> | ||
<Call name="insertHandler"> | ||
<Arg> | ||
<New id="DosHandler" class="org.eclipse.jetty.server.handler.DoSHandler"> | ||
<Arg name="getId"> | ||
<Get> | ||
<Name><Property name="jetty.dos.id.type" default="ID_FROM_REMOTE_ADDRESS"/></Name> | ||
<Class><Property name="jetty.dos.id.class" default="org.eclipse.jetty.server.handler.DoSHandler"/></Class> | ||
</Get> | ||
</Arg> | ||
<Arg name="rateControlFactory"> | ||
<New> | ||
<Class><Property name="jetty.dos.rateControlFactory" default="org.eclipse.jetty.server.handler.DoSHandler$ExponentialMovingAverageRateControlFactory"/></Class> | ||
<Arg name="samplePeriodMs" type="long"><Property name="jetty.dos.rateControlFactory.samplePeriodMs" default="-1"/></Arg> | ||
<Arg name="alpha" type="double"><Property name="jetty.dos.rateControlFactory.expMovingAvg.alpha" default="-1.0"/></Arg> | ||
<Arg name="maxRequestsPerSecond" type="int"><Property name="jetty.dos.maxRequestsPerSecond" default="100"/></Arg> | ||
</New> | ||
</Arg> | ||
<Arg name="rejectHandler"> | ||
<New> | ||
<Class><Property name="jetty.dos.rejectHandler" default="org.eclipse.jetty.server.handler.DoSHandler$DelayedRejectHandler"/></Class> | ||
<Arg name="delayMs" type="long"><Property name="jetty.dos.rejectHandler.delayed.delayMs" default="1000"/></Arg> | ||
<Arg name="maxDelayQueue" type="int"><Property name="jetty.dos.rejectHandler.delayed.maxDelayQueue" default="1000"/></Arg> | ||
<Arg name="reject"> | ||
<New class="org.eclipse.jetty.server.handler.DoSHandler$StatusRejectHandler"> | ||
<Arg name="status"><Property name="jetty.dos.rejectStatus" default="429"/></Arg> | ||
</New> | ||
</Arg> | ||
</New> | ||
</Arg> | ||
<Arg name="maxTrackers" type="int"><Property name="jetty.dos.maxTrackers" default="-1"/></Arg> | ||
|
||
<Call name="includeInetAddressPattern"> | ||
<Arg> | ||
<Call class="org.eclipse.jetty.util.StringUtil" name="csvSplit"> | ||
<Arg><Property name="jetty.dos.include.inet" default="" /></Arg> | ||
</Call> | ||
</Arg> | ||
</Call> | ||
<Call name="excludeInetAddressPattern"> | ||
<Arg> | ||
<Call class="org.eclipse.jetty.util.StringUtil" name="csvSplit"> | ||
<Arg><Property name="jetty.dos.exclude.inet" default="" /></Arg> | ||
</Call> | ||
</Arg> | ||
</Call> | ||
<Call name="includePath"> | ||
<Arg> | ||
<Call class="org.eclipse.jetty.util.StringUtil" name="csvSplit"> | ||
<Arg><Property name="jetty.dos.include.path" default="" /></Arg> | ||
</Call> | ||
</Arg> | ||
</Call> | ||
<Call name="excludePath"> | ||
<Arg> | ||
<Call class="org.eclipse.jetty.util.StringUtil" name="csvSplit"> | ||
<Arg><Property name="jetty.dos.exclude.path" default="" /></Arg> | ||
</Call> | ||
</Arg> | ||
</Call> | ||
</New> | ||
</Arg> | ||
</Call> | ||
</Configure> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# DO NOT EDIT THIS FILE - See: https://eclipse.dev/jetty/documentation/ | ||
|
||
[description] | ||
Enables the DosHandler for the server. | ||
|
||
[tags] | ||
connector | ||
|
||
[depend] | ||
server | ||
|
||
[xml] | ||
etc/jetty-dos.xml | ||
|
||
[ini-template] | ||
|
||
## The algorithm to use for obtaining an Id from an Request: ID_FROM_REMOTE_ADDRESS, ID_FROM_REMOTE_PORT, ID_FROM_REMOTE_ADDRESS_PORT, ID_CONNECTION | ||
#jetty.dos.id.type=ID_FROM_REMOTE_ADDRESS | ||
#jetty.dos.id.class=org.eclipse.jetty.server.handler.DosHandler | ||
|
||
## The class to use to create RateControl instances to track the rate of requests | ||
#jetty.dos.rateControlFactory=org.eclipse.jetty.server.handler.DosHandler$ExponentialMovingAverageRateControlFactory | ||
|
||
## The sample period(ms) to determine the request rate, or -1 for a default value | ||
#jetty.dos.rateControlFactory.samplePeriodMs=100 | ||
|
||
## The Exponential factor for the moving average rate | ||
#jetty.dos.rateControlFactory.expMovingAvg.alpha=0.2 | ||
|
||
## The maximum requests per second per client | ||
#jetty.dos.maxRequestsPerSecond=100 | ||
|
||
## The Handler class to use to reject DOS requests | ||
#jetty.dos.rejectHandler=org.eclipse.jetty.server.handler.DosHandler$TooManyRequestsRejectHandler | ||
|
||
## The period to delay dos requests before rejecting them. | ||
#jetty.dos.rejectHandler.delayed.delayMs=1000 | ||
|
||
## The maximum number of requests to be held in the delay queue | ||
#jetty.dos.rejectHandler.delayed.maxDelayQueue=1000 | ||
|
||
## The maximum number of clients to track; or -1 for a default value | ||
#jetty.dos.maxTrackers=10000 | ||
|
||
## The status code used to reject requests; or 0 to abort the request; or -1 for a default | ||
#jetty.dos.rejectStatus=429 | ||
|
||
## List of InetAddress patterns to include | ||
#jetty.dos.include.inet=10.10.10-14.0-128 | ||
|
||
## List of InetAddressPatterns to exclude | ||
#jetty.dos.exclude.inet=10.10.10-14.0-128 | ||
|
||
## List of path patterns to include | ||
#jetty.dos.include.path=/context/* | ||
|
||
## List of path to exclude | ||
#jetty.dos.exclude.path=/context/* | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd swap these 2 lines, so it looks more Java like as in
DoSHandler.ID_FROM_REMOTE_ADDRESS
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately that order does not validate again the DTD