1. EGh5
  2. django-doorkeeper

Commits

EGh5  committed 3bebf2f

change log level

  • Participants
  • Parent commits c057f52
  • Branches memcached

Comments (0)

Files changed (4)

File README.rst

View file
 This application bannes bad bots making requests for exactly non-existent urls.
 Middleware-level is using.
 
+Since version 1.5 daemon *memcached* can be used. In this case middleware
+uses memory only operations. All overhead in this case is: md5 calculation 
+for string  50-80 chars and  *memcahed* inquiry for key existance!
+
+
 Installation
 ------------
 
 
   DOORKEEPER_PATIENCE=3  # number of bad attempts
   DOORKEEPER_TERM=1200   # penalty time (sec.)
+  
+If memcached is available, strictly recommended to use it adding 
+its address (or list of addresses). 
+
+  DOORKEEPER_MEMCACHE=['127.0.0.1:11211']
+
+Also you can avoid smart slash adding, which lead to Http404 
+duplicating for urls, example: /dddf --> /ddddf/ . 
+To do this just set Django variable in settings.py::
+
+  APPEND_SLASH = False
+
+(But don't forget to use /admin/ (with last slash) is this case).
 
+  
 Add to INSTALLED_APPS,::
 
   'doorkeeper', 
 NOTE: this application is not intendent for high-loaded django-site. 
 Please consider os-level utilities. fail2ban should be mentioned among them.
 
+Check actual revision in `Bitbucket repository`_
 
 Good luck in hunting!
 

File doorkeeper/__init__.py

View file
 """
 Django-doorkeeper helps to deal with malicious url requests
 """
-version = (1,5,5)
+version = (1,5,6)
 __version__ = '.'.join(map(str, version))

File doorkeeper/middleware.py

View file
             
             if br.detention_upto:                    # check detention end time
                 if br.detention_upto> now:           # if it is a fresh banned client
-                    log.error("Memcached middleware  %s penalty %s, detention %s for %s" % (shash,br.penalty_count,
+                    log.info("Memcached middleware  %s penalty %s, detention %s for %s" % (shash,br.penalty_count,
                          br.detention_upto, request.path))
                     raise Http404()                  # ==>> bounce - it's active bad bot!
                 else:

File doorkeeper/views.py

View file
     br.save()
     if MEMCACHE: 
         mc.set(memhash,br)
-        log.error("Memcached view %s, penalty %s, detention %s" % (shash,br.penalty_count,br.detention_upto))
+        log.info("Memcached view %s, penalty %s, detention %s" % (shash,br.penalty_count,br.detention_upto))
     raise Http404()