Skip to content

Instantly share code, notes, and snippets.

@hkhoshraftar
Created September 9, 2020 07:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hkhoshraftar/354ec4e8f04dc49f2e6cdedc2504043c to your computer and use it in GitHub Desktop.
Save hkhoshraftar/354ec4e8f04dc49f2e6cdedc2504043c to your computer and use it in GitHub Desktop.
yum install epel-release -y
yum install fail2ban nano -y
systemctl enable fail2ban
cat <<EOF > /etc/fail2ban/jail.local
[DEFAULT]
# Ban hosts for one hour:
bantime = 3600
# Override /etc/fail2ban/jail.d/00-firewalld.conf:
banaction = iptables-multiport
[sshd]
enabled = true
[nginx-http-auth]
enabled = true
EOF
systemctl restart fail2ban
fail2ban-client status
fail2ban-client status sshd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment