You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was just reading your blog post on this and spotted a potential problem with the code, so thought I would report it here for your consideration:
Using the ActionDispatch::Request#remote_ip method to determine the acting IP is opening up the module for easy circumvention and potential Denial Of Service for legit users.
ActionDispatch::Request#remote_ip usually defers the IP detection to the ActionDispatch::RemoteIp Middleware, which does some magic detection of the remote IP by looking at various request headers, such as X-Forwarded-For, in case the application is sitting behind Nginx or another proxy. This usually makes sense to do, but it also makes it possible for a malicious client to spoof the origin of the request by adding the X-Forwarded-For header to their requests. This makes it relatively trivial to circumvent the banning by shuffling between random IPs. It also opens up the possibility for the attacker to actively deny access to legit users by flooding the server with malicious request and spoofing the legit user's IP or even a whole IP range.
This file contains hidden or 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
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.
A fail2ban notifier that creates a log file with every exception so you can parse it with fail2ban.
See file comments for fail2ban configuration (which you can also add to the wiki, I'll try adding them myself, but not sure if I got perms).
This PR- references
#205