Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Block IP's In a rails app on heroku

I have a rails app on heroku, and there are about 10 requests per second, which is strange because no one is using the app right now. All of the requests are for URI's that are clearly attempting to exploit security vulnerabilities, for example.

http://myapp.com/etc/passwd

and things like that.

How can I block this person from accessing my app? Is there a quick fix for this?

like image 690
OneChillDude Avatar asked May 03 '13 22:05

OneChillDude


People also ask

How do I block IP on Heroku?

From the Block/Allow IPs page of your Expedited WAF dashboard, add each IP or CIDR-notated IP range that you want to block: All requests from that IP/range will be stopped at the WAF and will not reach your Heroku application.

Does heroku change IPs?

Heroku's QuotaGuard Static IP solution routes your traffic through a pair of static IP addresses that never change. It should be used if you need your traffic to pass through a known IP address for the purpose of firewall ingress rules or application whitelisting with a third party.


1 Answers

Perhaps rack-attack will do what you want?

# Block requests from 1.2.3.4
Rack::Attack.blacklist('block 1.2.3.4') do |req|
  # Request are blocked if the return value is truthy
  '1.2.3.4' == req.ip
end
like image 189
catsby Avatar answered Sep 27 '22 21:09

catsby