Created
March 14, 2022 12:46
-
-
Save doches/7ce8d27fb094185c3dd71055794b0b04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euxo pipefail | |
dnf install -y fail2ban | |
systemctl enable fail2ban | |
cat > /etc/fail2ban/jail.local<< EOF | |
[DEFAULT] | |
# Ban hosts for one hour: | |
bantime = 3600 | |
findtime = 600 | |
maxretry = 3 | |
# Override /etc/fail2ban/jail.d/00-firewalld.conf: | |
banaction = iptables-multiport | |
[sshd] | |
enabled = true | |
EOF | |
systemctl restart fail2ban | |
sleep 2 | |
fail2ban-client status sshd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment