Skip to content

Simple Http:BL middleware implementation for Django

Notifications You must be signed in to change notification settings

regulusweb/django-httpbl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Http:BL

Provides a simple middleware class that checks the client's IP address against the Http:BL database. IP addresses identified as threats will receive a HTTP 403 response.

Usage

  • Add httpbl to INSTALLED_APPS
  • Insert httpbl.middleware.HttpBlMiddleware into MIDDLEWARE_CLASSES, preferably at the top so that it runs before everything else.
  • Add a HTTPBL_API_KEY with your API key obtained from Project Honey Pot

Optional settings

  • HTTPBL_THREAT_SCORE: the threat score at which to consider an IP a threat. Defaults to 35.
  • HTTPBL_THREAT_AGE: the maximum age in days at which to consider an IP a threat. Defaults to 30.
  • HTTPBL_CACHE_LIFETIME: cache lifetime for results, in seconds. Only applies if you have a working cache backend. Defaults to 86400 (1 day).

Testing

Create a venv using requirements.txt and run py.test.

About

Simple Http:BL middleware implementation for Django

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages