查看完整版本: 使用Fail2Ban 來防止 postfix AUTH DoS attacks


duncanchen 2017-4-21 15:31

使用Fail2Ban 來防止 postfix AUTH DoS attacks

最近每天系統報表都會顯示以下多個訊息

[quote]
Apr 21 15:23:44 mail postfix/smtpd[13516]: lost connection after AUTH from unknown[112.122.101.14]
Apr 21 15:23:44 mail postfix/smtpd[13516]: disconnect from unknown[112.122.101.14]
Apr 21 15:23:44 mail postfix/smtpd[13516]: connect from unknown[112.122.101.14]
Apr 21 15:23:44 mail postfix/smtpd[13516]: lost connection after AUTH from unknown[112.122.101.14]
Apr 21 15:23:44 mail postfix/smtpd[13516]: disconnect from unknown[112.122.101.14]
Apr 21 15:23:44 mail postfix/smtpd[13516]: connect from unknown[112.122.101.14]
Apr 21 15:23:45 mail postfix/smtpd[13516]: lost connection after AUTH from unknown[112.122.101.14]
Apr 21 15:23:45 mail postfix/smtpd[13516]: disconnect from unknown[112.122.101.14]
[/quote]

似乎是被鎖定 Sasl 攻擊了,由於之前已經有安裝 fail2ban,可以打開相關的 sasl 防護功能


(1) add following section to the end of your /etc/fail2ban/jail.conf
[quote]
[postfix-auth]
enabled     = true
filter      = postfix.auth
action      = iptables-multiport[name=postfix, port="http,https,smtp,submission,pop3,pop3s,imap,imaps,sieve", protocol=tcp]
#           sendmail[name=Postfix, dest=you@mail.com]
logpath     = /var/log/mail.log
[/quote]

(2) create new file /etc/fail2ban/filter.d/postfix.auth.conf
[quote]
[Definition]
failregex = lost connection after AUTH from (.*)\[<HOST>\]
ignoreregex =
[/quote]

(3) Restart fail2ban. Attacker will be blocked after five attempts.
頁: [1]
查看完整版本: 使用Fail2Ban 來防止 postfix AUTH DoS attacks