#!/bin/bash echo "🔐 Installing Fail2Ban..." sudo apt update sudo apt install -y fail2ban echo "🛠️ Configuring SSH jail with 1 year ban..." # Backup config if needed if [ ! -f /etc/fail2ban/jail.local.bak ]; then sudo cp /etc/fail2ban/jail.local /etc/fail2ban/jail.local.bak 2>/dev/null fi # Create jail.local if doesn't exist if [ ! -f /etc/fail2ban/jail.local ]; then sudo touch /etc/fail2ban/jail.local fi # Write SSH jail config for 1 year ban sudo bash -c 'cat > /etc/fail2ban/jail.local <