Outils pour utilisateurs

Outils du site


linux:fail2ban-apache-antibot

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
linux:fail2ban-apache-antibot [2016/06/24 18:03] – modification externe 127.0.0.1linux:fail2ban-apache-antibot [2020/07/24 22:03] (Version actuelle) – modification externe 127.0.0.1
Ligne 1: Ligne 1:
 ====== Fail2ban et Apache - Bannir les scans d'url d'administration (antibot) ====== ====== Fail2ban et Apache - Bannir les scans d'url d'administration (antibot) ======
  
-<WRAP center round info 100%>+===== Information ===== 
 + 
 +<WRAP center info 100%>
 Testé sur Debian 8 Testé sur Debian 8
 </WRAP> </WRAP>
Ligne 26: Ligne 28:
 filter = apache-antibot filter = apache-antibot
 port = http,https port = http,https
-#Fichier ou dossier de logs à surveiller +#Fichier ou dossier de logs à surveiller (prends en compte logrotate) 
-logpath = /home/www-data/logs/apache2/*.log+logpath = /home/www-data/logs/apache2/*.log*
 # Nombre de match dans les logs avant de bannir # Nombre de match dans les logs avant de bannir
-maxretry = 2+maxretry = 3
 # Période max surveillée # Période max surveillée
 findtime = 432000 findtime = 432000
Ligne 37: Ligne 39:
 #mta = mail #mta = mail
 #destemail = user@email.com #destemail = user@email.com
-#action = %(action_mw)s+#Ban, mail avec whois et log 
 +#action = %(action_mwl)s 
 +#Ban 
 +action = %(action_)s  
 </sxh> </sxh>
  
Ligne 49: Ligne 54:
 #Modifier 'badurls' selon votre besoin #Modifier 'badurls' selon votre besoin
 [Definition] [Definition]
-badurls = phpmyadmin|myadmin|mysql|phpadmin|sql|msd|mysqldumper|sqlite|sqlitemanager|webdb|soapCaller|manager|setup\.php|pma|status|jmx-console|HNAP1+badurls = stat|phpmyadmin|myadmin|mysql|phpadmin|sql|msd|mysqldumper|msd1.24.4|msd1.24.4stable|sqlite|sqlitemanager|webdb|soapCaller|manager|setup\.php|shell.\php|pma|status|jmx-console|HNAP1|wp-config\.txt|wp-config\.orig|wp-config\.php\.orig|wp-config\.old|wp-config\.php\.old|wp-config\.bak|wp-config\.php\.bak|wp-config\.php\.save|wp-config\.php_bak
  
 failregex = ^(?i)<HOST> .* "(GET|POST|HEAD) .*(%(badurls)s).* HTTP.*" (403|404) .*$ failregex = ^(?i)<HOST> .* "(GET|POST|HEAD) .*(%(badurls)s).* HTTP.*" (403|404) .*$
Ligne 112: Ligne 117:
 fail2ban-client status apache-antibot | grep 'IP list' | sed -n 's/\([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}/\nip&\n/gp' | grep ip | sed 's/ip//'| sort | uniq > /dev/shm/f2b.txt fail2ban-client status apache-antibot | grep 'IP list' | sed -n 's/\([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}/\nip&\n/gp' | grep ip | sed 's/ip//'| sort | uniq > /dev/shm/f2b.txt
 fail2ban-client status apache-antibot | grep 'IP list' | sed -n 's/\([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}/\nip&\n/gp' | grep ip | sed 's/ip//'| sort | uniq | xargs -n 1 geoiplookup { } | sed -e 's/GeoIP Country Edition: //g' > /dev/shm/f2bgeo.txt fail2ban-client status apache-antibot | grep 'IP list' | sed -n 's/\([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}/\nip&\n/gp' | grep ip | sed 's/ip//'| sort | uniq | xargs -n 1 geoiplookup { } | sed -e 's/GeoIP Country Edition: //g' > /dev/shm/f2bgeo.txt
-paste /dev/shm/f2b.txt /dev/shm/f2bgeo.txt > /home/www-data/domain.info/f2b-bans.html +paste /dev/shm/f2b.txt /dev/shm/f2bgeo.txt > /home/www-data/domain.info/f2b-bans.txt
-sed -i 's/$/<br \/>\n/g' /home/www-data/domain.info/f2b-bans.html+
 </sxh> </sxh>
  
 ===== Remarques ===== ===== Remarques =====
  
-<WRAP center round important 100%>+<WRAP center important 100%>
 Attention si les fichiers de logs analysés sont affectés par ''logrotate''. Ne pas ajouter ''compress'' et ''delay compress''. fail2ban ne sais pas lire les fichier compressés par défaut. Attention si les fichiers de logs analysés sont affectés par ''logrotate''. Ne pas ajouter ''compress'' et ''delay compress''. fail2ban ne sais pas lire les fichier compressés par défaut.
 </WRAP> </WRAP>
  
-[[http://fips.at/how-to-get-rid-of-http-bots-with-fail2ban.html|Source 1]] - [[http://www.fail2ban.org/wiki/index.php/Commands|Source 2]]+===== Sources ===== 
 + 
 +[[http://fips.at/how-to-get-rid-of-http-bots-with-fail2ban.html|fips.at]] - [[http://www.fail2ban.org/wiki/index.php/Commands|fail2ban.org]]
linux/fail2ban-apache-antibot.1466791398.txt.gz · Dernière modification : 2020/07/24 22:03 (modification externe)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki