Skip to content
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

Provide the ability to reset Fail2Ban count and ban flag #128

Merged
merged 1 commit into from
May 22, 2015

Conversation

stanhu
Copy link
Contributor

@stanhu stanhu commented May 11, 2015

This code is in production as a monkey-patch in GitLab v7.10, and I thought it would be helpful for others.

Closes #113

@stanhu stanhu changed the title Upon success, provide the ability to reset Fail2Ban count and ban flag Provide the ability to reset Fail2Ban count and ban flag May 11, 2015
@stanhu stanhu force-pushed the support-reset-throttles branch from ab40680 to ec0ab57 Compare May 11, 2015 22:05
@stanhu
Copy link
Contributor Author

stanhu commented May 21, 2015

@ktheory Thoughts?

epoch_time = Time.now.to_i
# Add 1 to expires_in to avoid timing error: http://git.io/i1PHXA
expires_in = period - (epoch_time % period) + 1
key = "#{(epoch_time / period).to_i}:#{unprefixed_key}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stanhu this nearly a dupe of lines 18-21. What do you think about extracting it to a private method?

@ktheory
Copy link
Collaborator

ktheory commented May 21, 2015

@stanhu: thanks for the nudge. 😄

This feature looks useful & I'd like to merge it in.

Could you please add some tests for the Cache#reset_count and Cache#delete methods? I want to make sure those work across the various cache stores.

@stanhu stanhu force-pushed the support-reset-throttles branch from 4005f99 to 427c414 Compare May 22, 2015 01:58
@stanhu
Copy link
Contributor Author

stanhu commented May 22, 2015

@ktheory: Thanks, done. There was already a test for delete, although this monkey patch seems necessary for the test only?

@stanhu stanhu force-pushed the support-reset-throttles branch 2 times, most recently from bcb26b3 to 615a93f Compare May 22, 2015 02:10
@stanhu stanhu force-pushed the support-reset-throttles branch from 615a93f to 91947b8 Compare May 22, 2015 13:47
@ktheory
Copy link
Collaborator

ktheory commented May 22, 2015

@stanhu Awesome! Thanks so much. I aim to release version 4.3.0 with this change this afternoon.

ktheory added a commit that referenced this pull request May 22, 2015
Provide the ability to reset Fail2Ban count and ban flag
@ktheory ktheory merged commit f0941a2 into rack:master May 22, 2015
@ktheory
Copy link
Collaborator

ktheory commented May 22, 2015

@stanhu Just pushed v4.3.0. Thanks for all your improvements recently. You're this release's MVP. 😄

@stanhu
Copy link
Contributor Author

stanhu commented May 22, 2015

@ktheory Thank you for being so responsive and creating/maintaining Rack Attack! I'm very happy I can remove the monkey patches now. :)

DouweM pushed a commit to gitlabhq/gitlabhq that referenced this pull request May 26, 2015
Remove Rack Attack monkey patches and bump to version 4.3.0

I finally got these monkey patches into Rack Attack v4.3.0, so GitLab no longer needs them. Hooray!

See: rack/rack-attack#128

See merge request !693
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to reset specific throttles
2 participants