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
This toolkit will provide seemless backend support for multiple Firewall and IDS systems deployment. The initial release will only support Snort and FreeBSD\\\'s ipfw, but future releases will expand the firewall selection. The main code is Python,