Skip to Content
  • +31 653-919-302
Cafayate.Net
  • 0
  • 0
  • Sign in
  • Nederlands English (US) Español (AR)
  • Contact Us
  • Home
  • Blog
  • Jobs
  • Contact us
Cafayate.Net
  • 0
  • 0
    • Home
    • Blog
    • Jobs
    • Contact us
  • +31 653-919-302
  • Nederlands English (US) Español (AR)
  • Sign in
  • Contact Us

HOWTO: Protect against postfix AUTH DoS attacks

  • All Blogs
  • Tech Blog
  • HOWTO: Protect against postfix AUTH DoS attacks
  • March 5, 2021 by
    Administrator

     

    I have tons of

    Oct 19 06:30:50 mail postfix/smtpd[14043]: connect from unknown[151.237.190.118]
    Oct 19 06:30:50 mail postfix/smtpd[14043]: lost connection after AUTH from unknown[151.237.190.118]
    Oct 19 06:30:50 mail postfix/smtpd[14043]: disconnect from unknown[151.237.190.118]
    Oct 19 06:30:50 mail postfix/smtpd[14043]: connect from unknown[151.237.190.118]
    Oct 19 06:30:50 mail postfix/smtpd[14043]: lost connection after AUTH from unknown[151.237.190.118]
    Oct 19 06:30:50 mail postfix/smtpd[14043]: disconnect from unknown[151.237.190.118]
    Oct 19 06:30:51 mail postfix/smtpd[14043]: connect from unknown[151.237.190.118]
    Oct 19 06:30:51 mail postfix/smtpd[14043]: lost connection after AUTH from unknown[151.237.190.118]
    Oct 19 06:30:51 mail postfix/smtpd[14043]: disconnect from unknown[151.237.190.118]

    in my logs. If you are on the same boat and want to block such attacks, you can use fail2ban:

    1/ add following section to the end of your /etc/fail2ban/jail.local

    [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, [email protected]]
    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.

     

    in Tech Blog
    Mastering file searches on Linux

    Designed for companies

    We are a team of passionate people whose goal is to improve everyone's life through disruptive products. We build great products to solve your business problems. Our products are designed for small to medium size companies willing to optimize their performance.

    Get in touch

    Plantexel
    Pedernera
    Salta Capital 
    Argenina

    • +31 653-919-302
    • [email protected]
    Follow us
    Copyright © Plantexel
    Nederlands | English (US) | Español (AR)