---
name: "fail2ban-brute-force-protection"
description: "Detect authentication brute-force attacks in server logs and dynamically ban offending IP addresses."
metadata:
  author: "Fail2ban"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "configure fail2ban jail.local"
  - "ban ip fail2ban-client"
  - "unban ip fail2ban"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Fail2ban Automated Brute-Force Log Banning

Configures Fail2ban: authoring jail.local, configuring filters (sshd, nginx-http-auth, recidive), setting bantime and findtime, integrating with nftables/iptables, and managing active bans using fail2ban-client.

## When to Invoke
Invoke this skill whenever you need to:
- configure fail2ban jail.local
- ban ip fail2ban-client
- unban ip fail2ban

## Execution SOP & Rules
1. Copy default config: cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local.
2. Configure [sshd] section: enabled = true, maxretry = 5, findtime = 10m, bantime = 24h.
3. Inspect status of active jails: fail2ban-client status sshd.
4. Unban IP: fail2ban-client set sshd unbanip <ip_address>.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
