Automatically block requests from bad IP addresses

475 views
Skip to first unread message

Addy Yeow

unread,
Feb 11, 2012, 3:26:32 AM2/11/12
to django...@googlegroups.com
I was looking for a Django solution to automatically block requests from bad IP addresses to some of my apps.

After searching for a while without much luck, I attempted to write a simple Python script that:
- parses my Apache access log
- block IP that made too many requests within a set interval

I have made the script with the associated Django app available on Github for those who may find it useful:

Cal Leeming [Simplicity Media Ltd]

unread,
Feb 12, 2012, 5:27:18 AM2/12/12
to django...@googlegroups.com
That's pretty cute, we use a similar type of DDoS protection method in our webapps too, along with an abusive IP register (albeit ours isn't based on RPM - requests per minute).

You might also want to consider looking at CloudFlare (free for even huge amounts of traffic), as they maintain a *huge* list like this as well.

If you wanted to extend on this even further, you could look at potentially offering a free/public abusive IP register... (we actually maintain several private abusive IP registers for our clients, they are invaluable!) - you just need to make sure every restriction is categorized. I might even consider donating to the cause by giving out some of our registers in the future - as a project like that would depend solely on user contributions from high traffic/attention sites.

Either way, cool work, thanks for sharing!

Cal


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Reply all
Reply to author
Forward
0 new messages