Lion Cipher Lab

Auto-block brute-force attempts with Fail2Ban

Why it matters

Any server reachable on the internet gets a steady stream of automated login attempts — bots trying common usernames and passwords against SSH and other services, all day, forever. Reading the logs (the previous lab) tells you it's happening; it doesn't stop it. Fail2Ban is the standard, lightweight tool that closes the loop: it watches your auth logs for the failure pattern you learned to recognise, and when a single source crosses a threshold you set, it bans that IP at the firewall for a while. It turns a manual, reactive chore into an automatic control that runs while you sleep. Learning…

What you'll learn

Steps in this lab

  1. What Fail2Ban does, and the one safety rule
  2. Install Fail2Ban
  3. The three pieces: jails, filters, and actions
  4. Write jail.local: thresholds and your own IP
  5. Reload and confirm the jail is active
  6. Watch a ban happen, and lift it
  7. Why this small tool matters more than it looks

Open the full interactive lab →