Fail2ban: differenze tra le versioni

Vai alla navigazione Vai alla ricerca
(6 versioni intermedie di uno stesso utente non sono mostrate)
Riga 46: Riga 46:
</pre>
</pre>


== Attivazione di nuovi filtri ==
== Attivazione di nuovi filtri (Da Debian Stretch) ==
Fail2ban utilizza una directory apposita per l'attivazione e la gestione di filtri personalizzati. Tutti i file inseriti in questa directory e aventi estensione <tt>.conf</tt> vengono letti e processati all'avvio del demone.
<br/>
Per attivare dei filtri su demoni diversi da SSH è sufficiente quindi creare un nuovo file di configurazione, inserendolo nella directory <tt>/etc/fail2ban/jail.d</tt>:
<pre>
# nano /etc/fail2ban/jail.d/custom.conf
</pre>
Un contenuto per il file, che ci garantisca un buon numero di filtri attivi può essere il seguente:
<pre>
[DEFAULT]
bantime = 14400
ignoreip = 127.0.0.1/8
maxretry = 5
 
[sshd]
enabled = true
port    = 2293
logpath = %(sshd_log)s
backend = %(sshd_backend)s
 
[sshd-ddos]
enabled = true
port    = 2293
logpath = %(sshd_log)s
backend = %(sshd_backend)s
 
[dropbear]
enabled = true
port    = 2293
logpath  = %(dropbear_log)s
backend  = %(dropbear_backend)s
 
[apache-auth]
enabled = true
port    = http,https
logpath  = %(apache_error_log)s
 
[apache-badbots]
enabled = true
port    = http,https
logpath  = %(apache_access_log)s
bantime  = 172800
maxretry = 1
 
[apache-noscript]
enabled = true
port    = http,https
logpath  = %(apache_error_log)s
 
[apache-overflows]
enabled = true
port    = http,https
logpath  = %(apache_error_log)s
maxretry = 2
 
[apache-nohome]
enabled = true
port    = http,https
logpath  = %(apache_error_log)s
maxretry = 2
 
[apache-botsearch]
enabled = true
port    = http,https
logpath  = %(apache_error_log)s
maxretry = 2
 
[apache-fakegooglebot]
port    = http,https
logpath  = %(apache_access_log)s
maxretry = 1
ignorecommand = %(ignorecommands_dir)s/apache-fakegooglebot <ip>
 
[apache-modsecurity]
enabled = true
port    = http,https
logpath  = %(apache_error_log)s
maxretry = 2
 
[apache-shellshock]
enabled = true
port    = http,https
logpath = %(apache_error_log)s
maxretry = 1
 
[php-url-fopen]
enabled = true
port    = http,https
logpath = %(nginx_access_log)s
          %(apache_access_log)s
 
[suhosin]
enabled = true
port    = http,https
logpath = %(suhosin_log)s
 
[roundcube-auth]
[roundcube-auth]
#enabled = true
port    = http,https
logpath  = %(roundcube_errors_log)s
 
[drupal-auth]
enabled = true
port    = http,https
logpath  = %(syslog_daemon)s
backend  = %(syslog_backend)s
 
[monit]
#enabled = true
port = 2812
logpath  = /var/log/monit
 
[webmin-auth]
enabled = true
port    = 10000
logpath = %(syslog_authpriv)s
backend = %(syslog_backend)s
 
[froxlor-auth]
enabled = true
port    = http,https
logpath  = %(syslog_authpriv)s
backend  = %(syslog_backend)s
 
[vsftpd]
enabled = true
port    = ftp,ftp-data,ftps,ftps-data
logpath  = %(vsftpd_log)s
 
[postfix]
#enabled = true
port    = smtp,465,submission
logpath  = %(postfix_log)s
backend  = %(postfix_backend)s
 
[postfix-rbl]
#enabled = true
port    = smtp,465,submission
logpath  = %(postfix_log)s
backend  = %(postfix_backend)s
maxretry = 1
 
[postfix-sasl]
#enabled = true
port    = smtp,465,submission,imap3,imaps,pop3,pop3s
logpath  = %(postfix_log)s
backend  = %(postfix_backend)s
 
[squirrelmail]
#enabled = true
port = smtp,465,submission,imap2,imap3,imaps,pop3,pop3s,http,https,socks
logpath = /var/lib/squirrelmail/prefs/squirrelmail_access_log
 
[recidive]
enabled = true
logpath  = /var/log/fail2ban.log
banaction = %(banaction_allports)s
bantime  = 604800  ; 1 week
findtime = 86400  ; 1 day
 
[pam-generic]
enabled = true
banaction = %(banaction_allports)s
logpath  = %(syslog_authpriv)s
backend  = %(syslog_backend)s
 
[xinetd-fail]
enabled = true
banaction = iptables-multiport-log
logpath  = %(syslog_daemon)s
backend  = %(syslog_backend)s
maxretry  = 2
</pre>
 
== Attivazione di nuovi filtri (Fino a Debian Jessie) ==
=== Server di posta Dovecot ===
=== Server di posta Dovecot ===
Creare il file di filtro <code>/etc/fail2ban/filter.d/dovecot-pop3imap.conf</code>:
Creare il file di filtro <code>/etc/fail2ban/filter.d/dovecot-pop3imap.conf</code>:
Riga 167: Riga 342:
Salviamo e riavviamo:
Salviamo e riavviamo:
<pre>
<pre>
# systemctl restart fal2ban
# systemctl restart fail2ban
</pre>
</pre>


=== Server FTP===
=== Server FTP===
All'interno del file <code>/etc/fail2ban/jail.conf</code> è presente una sezione FTP in cui basta abilitare quello che si desidera.
All'interno del file /etc/fail2ban/jail.conf è presente una sezione FTP in cui basta abilitare quello che si desidera.
<pre>
<pre>
# FTP servers
# FTP servers

Menu di navigazione