#!/bin/bash EXISTS=/etc/fail2ban.conf F2B=`rpm -q fail2ban` if [ -f $EXISTS ]; then echo "Updating $F2B installation. Please wait... " rpm -e fail2ban cd /etc mv fail2ban.conf fail2ban.conf.old cd /usr/src wget http://pbxinaflash.net/source/fail2ban/fail2ban-0.8.3.tar.bz2 tar -jxf fail2ban-0.8.3.tar.bz2 cd fail2ban-0.8.3 cp /usr/src/fail2ban-0.8.3/files/redhat-initd /etc/init.d/fail2ban python setup.py install cd /etc/fail2ban/filter.d mv asterisk.conf asterisk.conf.old wget http://pbxinaflash.net/source/fail2ban/asterisk.conf cd /etc/fail2ban mv jail.conf jail.conf.old mv fail2ban.conf fail2ban.conf.old wget http://pbxinaflash.net/source/fail2ban/jail.conf wget http://pbxinaflash.net/source/fail2ban/fail2ban.conf cd /etc/asterisk mv logger.conf logger.conf.bak wget http://pbxinaflash.net/source/fail2ban/logger.conf chown asterisk:asterisk logger.conf asterisk -rx "logger reload" asterisk -rx "logger rotate" /etc/init.d/fail2ban start chkconfig fail2ban on service fail2ban restart echo "Update to failban 0.8.3 is complete." echo "Password protection enabled for SSH, Apache, and Asterisk SIP logins." echo "Be sure to update the sender and dest email addresses in /etc/fail2ban/jail.conf" echo "If there is a FAILED message on stopping fail2ban above," echo "Be sure to restart fail2ban: service fail2ban restart" echo "until you receive an OK message on stopping AND starting the service." echo "The following bash command will also tell you whether fail2ban is running:" echo "ps aux | grep fail2ban-server" echo " " ps aux | grep fail2ban-server else echo "This script only works on systems with existing (functional) Fail2Ban 0.6.1 installs." fi