Skip to content

Commit

Permalink
Use new limits for rack_attack, decidim geo requests a lot
Browse files Browse the repository at this point in the history
  • Loading branch information
Kagemaru committed Mar 27, 2024
1 parent c036f62 commit 643a812
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions config/initializers/rack_attack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# Rack::Attack.enabled = ENV.fetch('ENABLE_RACK_ATTACK', Rails.env.production?.to_s).in?(%w[true 1])
Rack::Attack.enabled = true


safelist_ips = ENV.fetch('RACK_ATTACK_SAFELIST_IPS', '').split(',').map(&:strip)

safelist_ips.each do |ip_or_subnet|
Expand All @@ -14,7 +13,7 @@
Rack::Attack.safelist_ip(ip_or_subnet)
end

Rack::Attack.throttle('requests by ip', limit: 5, period: 2, &:ip)
Rack::Attack.throttle('requests by ip', limit: 100, period: 10, &:ip)

Rack::Attack.blocklist('secure admin logins') do |req|
Rack::Attack::Allow2Ban.filter(req.ip, maxretry: 5, findtime: 10.minutes, bantime: 1.hour) do
Expand Down

0 comments on commit 643a812

Please sign in to comment.