Originariamente inviato da filter.d/vsftpd-log.conf
codice HTML:
# Fail2Ban configuration file
#
# Author: Cyril Jaquier
#
# $Revision: 728 $
#

[Definition]

# Option: failregex
# Notes.: regex to match the password failures messages in the logfile. The
#          host must be matched by a group named "host". The tag "<HOST>" can
#          be used for standard IP/hostname matching and is only an alias for
#          (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
# Values: TEXT
#
failregex = \[.+\] FAIL LOGIN: Client "<HOST>"\s*$                                                
                   \[.+\] CONNECT: Client "<HOST>"\s*$
# Option:  ignoreregex
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
# Values:  TEXT
#
ignoreregex =
Ho adottato per questo file la regex prevista di default, con una modifica. Ho rimosso la regex "vsftpd(?:\(pam_unix\))?(?:\[\d+\])?:.* authentication failure; .* rhost=(?:\s+user=\S*)?\s*$" ed ho aggiunto "\[.+\] CONNECT: Client ""\s*$".

Questa aggiunta è rischiosa: Tutti i client che si collegano ad un server ftp provocano un registrazione del tipo
codice:
CONNECT: Client "124.227.190.252"
che viene matchata dalla regex.
In pochi però provocano più registrazioni di questo tipo in pochissimo tempo: Nel file jail.local ho impostato valore di "maxretry" per la jail "[vsftpd-log]" di "10" e, dato che il findtime predefinito è di "300" secondi, da quello che ho potuto vedere finora tutti gli IP che hanno provocato più di 10 "CONNECT" in meno di 5 minuti sono riconducibili a scanner. Lo stesso bot di Google non fà mai più di uno o due "CONNECT" nel findtime configurato, mentre uno scanner/bot ne può fare anche diverse decine.

Vediamo come va...