Other toolsBash

Linux – Fail2ban Quick Setup (Bash)

Set up Fail2ban for a Linux environment.

Bash
#!/usr/bin/env bash
set -e
apt update && apt install -y fail2ban
cat >/etc/fail2ban/jail.d/ssh.local <<'EOF'
[sshd]
enabled = true
port = 22
logpath = /var/log/auth.log
maxretry = 5
bantime = 3600
EOF
systemctl enable --now fail2ban
fail2ban-client status sshd
  

From Joseph Nakhle's automation workbench.

More Other tools scripts