Skip to content

Instantly share code, notes, and snippets.

@liangzan
Last active January 2, 2016 19:09
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save liangzan/8348408 to your computer and use it in GitHub Desktop.
Configuration for fail2ban

First install Fail2ban.

sudo apt-get install fail2ban

Then edit the configuration file at /etc/fail2ban/jail.conf

We are only showing the changed sections.

ignoreip = 127.0.0.1/8 202.166.0.0/16
bantime  = 3600
maxretry = 3


[postfix]

enabled  = true
port     = smtp,ssmtp
filter   = postfix
logpath  = /var/log/mail.log
maxretry = 3

[sasl]

enabled  = true
port     = smtp,ssmtp,imap2,imap3,imaps,pop3,pop3s
filter   = sasl
logpath  = /var/log/mail.log
maxretry = 3

[dovecot]

enabled = true
port    = smtp,ssmtp,imap2,imap3,imaps,pop3,pop3s
filter  = dovecot
logpath = /var/log/mail.log
maxretry = 3

Then restart

sudo service fail2ban restart

Check the log at /var/log/fail2ban.log to see if everything is running smoothly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment