Note: The IP ban function is new in PyLucid v0.9

The componentes:

  • pylucid_project.middlewares.ip_ban.IPBanMiddleware
  • pylucid_project.apps.pylucid.models.ip_ban_list.BanEntry

settings:

  • PYLUCID.cleanup_ip_ban - Number of seconds after the IP ban cleanup method would be called

Dbpreferences / pylucid / SystemPreferencesForm:

  • ban_release_time - How long should a IP address banned in minutes. (Changes need app restart)

The BanEntry model is a simple list of banned IP addresses with a create datetime.
The IPBanMiddleware check on every request, if the current client IP address (from: request.META["REMOTE_ADDR"]) is in the BanEntry list. If the IP is banned, the middleware sends back a HttpResponseForbidden.
The middleware also called the BanEntry.objects.cleanup() method sometimes, to remove old entries from the list.

Some plugins automatically adds clients to the ban list. e.g.: The search plugin ban a user if he starts too many searches. You can setup the limit values in the plugin preferences.