fusionpbx-install.sh/centos/resources/fail2ban.sh

36 lines
1.0 KiB
Bash
Raw Permalink Normal View History

2017-02-23 17:53:37 +01:00
#!/bin/sh
#move to script directory so all relative paths work
cd "$(dirname "$0")"
2017-04-23 09:03:34 +02:00
#includes
. ./config.sh
2017-02-23 17:53:37 +01:00
. ./colors.sh
2017-04-23 09:03:34 +02:00
#send a message
2017-02-23 17:53:37 +01:00
verbose "Installing Fail2ban"
#add the dependencies
yum -y install fail2ban
#move the filters
cp ./fail2ban/freeswitch-dos.conf /etc/fail2ban/filter.d/freeswitch-dos.conf
cp ./fail2ban/freeswitch-ip.conf /etc/fail2ban/filter.d/freeswitch-ip.conf
cp ./fail2ban/freeswitch-404.conf /etc/fail2ban/filter.d/freeswitch-404.conf
cp ./fail2ban/freeswitch.conf /etc/fail2ban/filter.d/freeswitch.conf
cp ./fail2ban/fusionpbx.conf /etc/fail2ban/filter.d/fusionpbx.conf
cp ./fail2ban/nginx-404.conf /etc/fail2ban/filter.d/nginx-404.conf
cp ./fail2ban/nginx-dos.conf /etc/fail2ban/filter.d/nginx-dos.conf
cp ./fail2ban/jail.local /etc/fail2ban/jail.local
#update config if source is being used
2017-04-23 09:03:34 +02:00
if [ .$switch_source = .true ]; then
sed 's#var/log/freeswitch#usr/local/freeswitch/log#g' -i /etc/fail2ban/jail.local
fi
2017-02-23 17:53:37 +01:00
2017-04-23 09:03:34 +02:00
#restart fail2ban
2017-02-23 17:53:37 +01:00
systemctl restart fail2ban
2017-04-23 09:03:34 +02:00
#send a message
2017-02-23 17:53:37 +01:00
verbose "Fail2ban installed"