config f2b for Ubuntu or Debian

This commit is contained in:
Matthew Saunders Brown 2024-06-14 16:03:53 -07:00
parent 05485d5128
commit d47d07d62f

View File

@ -123,7 +123,12 @@ cp -a fail2ban/* /etc/fail2ban/
echo "destemail = $WEBMASTER" >> /etc/fail2ban/jail.local
echo "bantime = 24h" >> /etc/fail2ban/jail.d/defaults-debian.conf
echo "maxretry = 3" >> /etc/fail2ban/jail.d/defaults-debian.conf
echo "logpath = /var/log/auth.log tail" >> /etc/fail2ban/jail.d/defaults-debian.conf
if [ $os_codename = jammy ]; then
echo "backend = auto" >> /etc/fail2ban/jail.d/defaults-debian.conf
echo "logpath = /var/log/auth.log tail" >> /etc/fail2ban/jail.d/defaults-debian.conf
elif [ $os_codename = bookworm ]; then
echo "backend = systemd" >> /etc/fail2ban/jail.d/defaults-debian.conf
fi
systemctl enable fail2ban
systemctl start fail2ban