Add fail2ban filter

This commit is contained in:
Gregory Soutade 2016-05-22 10:28:58 +02:00
parent 8bf132976d
commit 3caae2dee2
2 changed files with 22 additions and 1 deletions

View File

@ -806,7 +806,10 @@ def add_comment(request, post_id, parent_id):
# Anti robot !! # Anti robot !!
if request.POST['email'] != '': if request.POST['email'] != '':
print 'fucking robot' if 'HTTP_X_REAL_IP' in request.META:
print 'Dynastie : fucking robot %s' % (request.META['HTTP_X_REAL_IP'])
else:
print 'Dynastie : fucking robot %s' % (request.META['REMOTE_ADDR'])
return HttpResponseRedirect(ref) return HttpResponseRedirect(ref)
post = Post.objects.get(pk=post_id) post = Post.objects.get(pk=post_id)

18
misc/apache-dynastie.conf Normal file
View File

@ -0,0 +1,18 @@
# Fail2Ban apache-dynastie filter
#
[INCLUDES]
# Read common prefixes. If any customizations available -- read them from
# apache-common.local
before = apache-common.conf
[Definition]
failregex = ^\[[^]]*\] \[wsgi\:error\] \[pid [0-9]+\] Dynastie : fucking robot <HOST>$
ignoreregex =
# http://indefero.soutade.fr/p/dynastie
# [Sun May 22 10:10:33.804242 2016] [wsgi:error] [pid 10514] Dynastie : fucking robot 192.168.1.1
# Author: Grégory Soutadé