-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add two stage Nginx rate limit #1316
Merged
Merged
Conversation
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
TheVillageGuy
previously approved these changes
Dec 24, 2024
When you really spam your own server (don't do evil on other servers). The error log should show something like this eventually:
Again, if you configured Fail2ban to pick this up (eg. 50 of these limiting requests errors). You can auto-ban IPs for an x amount of time (eg. 1 day or 1 week). |
TheVillageGuy
approved these changes
Dec 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
delay=200
means it will allow the first 200 requests without any delay. After 200 requests you will hit the delaying of the requests, which is set to 5 requests/second. If the client keep requesting requests these will still get queued. However, after 300 requests in the buffer (bust=300
), Nginx will start rejecting requests./var/log/nginx/mbin_error.log
.See also: https://blog.nginx.org/blog/rate-limiting-nginx
If you use Fail2Ban this error log will be matched as
nginx_error_log
variable. You could use the error log to actually ban bots/users who are exceeding the rate limit (this ban is triggered if there are 50 rejected requests, default is only 3, in the past 10 minutes dedicated for the same IP):I will later document Fail2Ban config in a different markdown file / docs.