Board logo

標題: [介紹] 使用Fail2Ban 來防止 postfix AUTH DoS attacks [打印本頁]

作者: duncanchen    時間: 2017-4-21 15:31     標題: 使用Fail2Ban 來防止 postfix AUTH DoS attacks

最近每天系統報表都會顯示以下多個訊息
引用:
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]
似乎是被鎖定 Sasl 攻擊了,由於之前已經有安裝 fail2ban,可以打開相關的 sasl 防護功能


(1) add following section to the end of your /etc/fail2ban/jail.conf
引用:
[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
(2) create new file /etc/fail2ban/filter.d/postfix.auth.conf
引用:
[Definition]
failregex = lost connection after AUTH from (.*)\[<HOST>\]
ignoreregex =
(3) Restart fail2ban. Attacker will be blocked after five attempts.




歡迎光臨 ADJ網路實驗室 (http://dz.adj.idv.tw/) Powered by Discuz! 6.0.0