---
name: "fail2ban-intrusion-prevention-daemon"
description: "Ban malicious IP addresses attempting brute-force attacks on SSH, Nginx, and web apps."
metadata:
  author: "Fail2ban"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "configure fail2ban jail"
  - "ban brute force ip fail2ban"
  - "write custom fail2ban filter"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Fail2ban Intrusion Prevention Daemon

Configures Fail2ban: jail.local configuration, custom filter regexes, iptables/nftables ban actions, bantime exponential incrementing, and unbanning verified IP addresses.

## When to Invoke
Invoke this skill whenever you need to:
- configure fail2ban jail
- ban brute force ip fail2ban
- write custom fail2ban filter

## Execution SOP & Rules
1. Configure custom settings inside /etc/fail2ban/jail.local; never edit jail.conf directly.
2. Define filter regular expressions matching target log timestamp and host IP formats.
3. Verify filter regex accuracy using fail2ban-regex /var/log/auth.log /etc/fail2ban/filter.d/sshd.conf.
4. Check active bans using fail2ban-client status <jail_name> and unban with set <jail> unbanip <ip>.

## 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.
