Replies: 6 comments
-
in your fail2ban.filter code, check for the throttle key in |
Beta Was this translation helpful? Give feedback.
-
@courtenay I like your suggestion, but in this case we should set maxretry to 0 in the Fail2Ban filter, right? |
Beta Was this translation helpful? Give feedback.
-
Solved with using
|
Beta Was this translation helpful? Give feedback.
-
@kruglyjmax using |
Beta Was this translation helpful? Give feedback.
-
I solved my issue by adding a method to def exceeded?(request)
discriminator = discriminator_for(request)
return false unless discriminator
current_period = period_for(request)
current_limit = limit_for(request)
key = [Time.now.to_i / current_period, name, discriminator].join(':')
count = cache.read(key).to_i
count > current_limit
end And then I can use: Rack::Attack::Fail2Ban.filter("throttled/#{req.ip}", maxretry: 10, findtime: 1.minute, bantime: 1.hour) do
configuration.throttles.any? { |_name, throttle| throttle.exceeded?(req) }
end |
Beta Was this translation helpful? Give feedback.
-
I want to first throttle abusers but then if they continue issue a ban, I am not being successful as everything is getting "forbidden"
Beta Was this translation helpful? Give feedback.
All reactions