Fail2Ban monitors log files like /var/log/pwdfail or /var/log/apache/error_log and bans failure-prone addresses. It updates firewall rules to reject the IP address or executes user defined commands.
Please see code and download from https://github.com/fail2ban/fail2ban . SF Fail2ban portal might not be up-to-date