Install Fail2ban
yum install epel-release
yum install fail2ban
#: CentOS
yum install jwhois
#: CentOS 6.X
chkconfig postfix on
service postfix start
#: CentOS 7.X
systemctl start postfix
systemctl enable postfix
Only make changes in the jail.local file , not inside jail.conf
If Openvpn:
Add inside the file /etc/fail2ban/filter.d/openvpn.conf
[Definition]
* <HOST>:[0-9]{4,5} Connection reset, restarting \[[0-9]{1,2}\]
If Openvpnas:
Add inside the file /etc/fail2ban/filter.d/openvpnas.conf
[Definition]
* <HOST>:[0-9]{4,5} Connection reset, restarting \[[0-9]{1,2}\]
# Otherwise it fails
echo > /var/log/openvpn.log
#: CentOS 6.X
chkconfig fail2ban on
service fail2ban start
#: CentOS 7.X
systemctl enable fail2ban
systemctl start fail2ban
To see active jails: fail2ban-client status
On systems monitored by Nagios, add this in /etc/sudoers :
nagios ALL = (root) NOPASSWD: /usr/bin/fail2ban-client
yum install epel-release
yum install fail2ban
#: CentOS
yum install jwhois
#: CentOS 6.X
chkconfig postfix on
service postfix start
#: CentOS 7.X
systemctl start postfix
systemctl enable postfix
Only make changes in the jail.local file , not inside jail.conf
If Openvpn:
Add inside the file /etc/fail2ban/filter.d/openvpn.conf
[Definition]
* <HOST>:[0-9]{4,5} Connection reset, restarting \[[0-9]{1,2}\]
If Openvpnas:
Add inside the file /etc/fail2ban/filter.d/openvpnas.conf
[Definition]
* <HOST>:[0-9]{4,5} Connection reset, restarting \[[0-9]{1,2}\]
# Otherwise it fails
echo > /var/log/openvpn.log
#: CentOS 6.X
chkconfig fail2ban on
service fail2ban start
#: CentOS 7.X
systemctl enable fail2ban
systemctl start fail2ban
To see active jails: fail2ban-client status
On systems monitored by Nagios, add this in /etc/sudoers :
nagios ALL = (root) NOPASSWD: /usr/bin/fail2ban-client