Bonjour, j'utilise Apache en front end de tomcat, j'ai essayé de configurer apache-badbots dans fail2ban car mon serveur à trop de visite de robots, dans accesslog j'ai par exemple vu ce genre de ligne plusieurs fois :
[12/May/2019:06:25:36 +0200] "GET /164-5150/department/directory/banking+credit+Wahlkreis+St.+Gallen HTTP/1.1" 410 14471 "-" "Mozilla/5.0 (compatible; SemrushBot/3~bl; +http://www.semrush.com/bot.html)"
Donc pour tester j'ai ajouter cette entrée dans jail.conf :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
[...]
bantime  = 86400
 
# A host is banned if it has generated "maxretry" during the last "findtime"
# seconds.
findtime = 3600
maxretry = 5
[...]
[apache-badbots]
enabled = true
port = http,https
filter = apache-badbots
puis j'ai ajouté dans filter.d/apache-badbots.conf |SemrushBot à la fin de badbotscustom sans rien changer d'autre
dans le même fichier on a :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
failregex = ^<HOST> -.*"(GET|POST).*HTTP.*"(?:%(badbots)s|%(badbotscustom)s)"$
j'ai pas voulu y toucher par contre quand je fais un :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
fail2ban-regex -v /var/log/apache2/access.log /etc/fail2ban/filter.d/apache-badbots.conf
j'ai en fin de sortie :
Lines: 45390 lines, 0 ignored, 0 matched, 45390 missed
donc ou la regex ne fonctionne pas ou j'ai mal configuré mais je vois pas trop.
Merci de votre aide.