feat: convert status handler to match existing handlers #175
+25
−23
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.
Hi,
I recently found your plugin and thought it would be useful to easily secure one of my websites against bruteforce attacks.
Expected behaviour
I want a request receiving a given status code to be blocked by the plugin after a few retries.
Bug noticed
While trying it, I noticed that no matter what configuration I put in terms of status codes, I was always getting 403-ed when hitting the
maxretry
limit. I think #136 relates to my issue.What I did
Instead of complaining and adding noise to the issue, I thought it would be more interesting to submit a fix :)
What I did is :
(*chain.Status, error)
)Go is clearly not in my field of expertise so please feel free to give implementation advice.
Behaviour with this fix
Now, requests go through if their status code is not contained in the configuration. If they do, they go through the last fail2ban handler before going through.
Thanks in advance for your review !