Fail2Ban Daily SSH Report Script

 

πŸ” Fail2Ban Daily Report Script

Security isn’t just about blocking attacks β€” it’s about knowing they happened. This lightweight Bash script integrates with Fail2Ban to generate daily email reports on SSH intrusion attempts, giving you clear, actionable visibility without logging into the server.

🧰 What It Does

  • Pulls the list of IPs banned by the sshd jail
  • Uses geoiplookup to identify attacker locations
  • Formats a clean daily report:
    • βœ… IP Address
    • 🌍 Country of Origin
    • πŸ•’ Timestamp
  • Emails the report to a predefined address

βš™οΈ Requirements

  • fail2ban
  • geoip-bin (for geoiplookup)
  • CLI mail client (e.g., mutt, mailx, or ssmtp)
  • Basic cron setup

πŸ“« Why It Matters

Many sysadmins install Fail2Ban and forget it’s there. This script makes intrusion detection visible again β€” without manual log review. Perfect for: βœ”οΈ Home lab monitoring βœ”οΈ Lightweight VPS hardening βœ”οΈ Situational awareness for SSH threats

πŸ“Ž Project Link

πŸ”— GitHub Repository: mikecozier/fail2ban