#!/usr/bin/env bash

# fix fail2ban config after update

yum -y install fail2ban-server fail2ban-sendmail fail2ban-systemd  --enablerepo=epel

echo Adjust fai2lan config
sed -i.bak -e 's|logtarget = SYSLOG|logtarget = /var/log/fail2ban.log|' /etc/fail2ban/fail2ban.conf

cat >/etc/fail2ban/jail.local <<-EOF
[sshd]
enabled = true

[recidive]
enabled = true
EOF

systemctl enable  fail2ban
systemctl restart fail2ban
