Optional regex filter:
SSH, edit or replace /etc/fail2ban/filter.d/sshd.conf or /etc/fail2ban/filter.d/sshd-ddos.conf
^%(__prefix_line)s(?:error: PAM: )?[aA]uthentication (?:failure|error|failed) for .* from
^%(__prefix_line)s(?:error: PAM: )?User not known to the underlying authentication module for .* from
^%(__prefix_line)sFailed \S+ for .*? from
^%(__prefix_line)sROOT LOGIN REFUSED.* FROM
^%(__prefix_line)s[iI](?:llegal|nvalid) user .* from
^%(__prefix_line)sUser .+ from
^%(__prefix_line)sUser .+ from
^%(__prefix_line)sUser .+ from
^%(__prefix_line)srefused connect from \S+ \(
^%(__prefix_line)s(?:error: )?Received disconnect from
^%(__prefix_line)sUser .+ from
^%(__prefix_line)sUser .+ from
^(?P<__prefix>%(__prefix_line)s)User .+ not allowed because account is locked
^(?P<__prefix>%(__prefix_line)s)Disconnecting: Too many authentication failures for .+? \[preauth\]
^(?P<__prefix>%(__prefix_line)s)Connection from
^%(__prefix_line)s(error: )?maximum authentication attempts exceeded for .* from
^%(__prefix_line)spam_unix\(sshd:auth\):\s+authentication failure;\s*logname=\S*\s*uid=\d*\s*euid=\d*\s*tty=\S*\s*ruser=\S*\s*rhost=
^%(__prefix_line)sConnection closed by
^%(__prefix_line)sReceived disconnect from
^%(__prefix_line)sReceived disconnect from
Postfix-sasl, edit or replace /etc/fail2ban/filter.d/postfix-sasl.conf
^%(__prefix_line)swarning: [-._\w]+\[
lost connection after AUTH from (.*)\[
Postfix, edit or replace /etc/fail2ban/filter.d/postfix.conf
^%(__prefix_line)sNOQUEUE: reject: RCPT from \S+\[
^%(__prefix_line)sNOQUEUE: reject: RCPT from \S+\[
from=<\S*> to=<\S+> proto=ESMTP helo=<\S*>$
^%(__prefix_line)sNOQUEUE: reject: RCPT from \S+\[
^%(__prefix_line)sNOQUEUE: reject: EHLO from \S+\[
^%(__prefix_line)sNOQUEUE: reject: VRFY from \S+\[
^%(__prefix_line)sNOQUEUE: reject: RCPT from \S+\[
^%(__prefix_line)simproper command pipelining after \S+ from [^[]*\[
lost connection after (AUTH|UNKNOWN|EHLO) from (.*)\[
connect from unknown\[
disconnect from unknown\[
statistics: max connection rate 1/60s for (smtp:
statistics: max connection rate 1 for (smtp:
ProFTP, edit or replace /etc/fail2ban/filter.d/proftpd.conf
^%(__prefix_line)s%(__hostname)s \(\S+\[
^%(__prefix_line)s%(__hostname)s \(\S+\[
^%(__prefix_line)s%(__hostname)s \(\S+\[
^%(__prefix_line)s%(__hostname)s \(\S+\[
USER \S+: no such user found from \S* ?\[
\(\S+\[
\(\S+\[
\(\S+\[
References:
- http://www.fail2ban.org/wiki/index.php/MANUAL_0_8
- http://serverfault.com/questions/686422/modify-fail2ban-failregex-to-match-failed-public-key-authentications-via-ssh
- http://security.stackexchange.com/questions/10869/fail2ban-does-not-ban-failed-root-login-attempt
- http://serverfault.com/questions/681703/regex-for-multiple-sshd-received-disconnect-from-preauth
- https://github.com/fail2ban/fail2ban/pull/1206/files
- http://serverfault.com/questions/335983/postfix-connection-lost-after-auth