Free Tool
Fail2Ban Config Generator
Generate ready-to-use Fail2Ban jail configurations for SSH, web servers, mail servers, and custom services. Includes filter patterns, ban actions, and best-practice defaults.
fail2ban-client -t before restarting the service. Use fail2ban-regex to test filter patterns against your log files. Overly aggressive settings can lock out legitimate users.
Understanding Fail2Ban Parameters
maxretry
Number of failures before a host is banned. Set lower for sensitive services (SSH: 3-5) and higher for web (5-10). Too low causes false positives; too high is ineffective.
bantime
Duration of the ban in seconds. Common values: 600 (10 min) for mild, 3600 (1 hour) for moderate, 86400 (24 hours) for aggressive. Use -1 for permanent bans.
findtime
Time window in which maxretry failures must occur to trigger a ban. If set to 600, the host must fail maxretry times within 10 minutes to get banned.
action
What happens when a ban triggers. iptables-multiport blocks via iptables, nftables-multiport uses nftables, firewallcmd-rich-rules uses firewalld. Some actions also send email alerts.
filter
The regex pattern file that Fail2Ban uses to detect failures in log files. Built-in filters exist for common services. Custom filters go in /etc/fail2ban/filter.d/.
logpath
Path to the log file that Fail2Ban monitors for the jail. Supports glob patterns. Ensure Fail2Ban has read permission on the log file.
ignoreip
IPs or CIDR ranges that should never be banned. Always include your own IPs and management networks. Separate multiple entries with spaces.
fail2ban-regex
Test tool: fail2ban-regex /var/log/auth.log /etc/fail2ban/filter.d/sshd.conf - shows matches against real log data. Always test before deploying.
Protect your infrastructure with Flowtriq
Detect DDoS attacks in under 1 second. Classify attack types automatically. Get instant alerts.
Start your free trial →