2016-04-29 21:24:22 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
2017-01-15 09:15:53 +01:00
|
|
|
#move to script directory so all relative paths work
|
2017-02-08 06:44:35 +01:00
|
|
|
cd "$(dirname "$0")"
|
2017-01-15 09:15:53 +01:00
|
|
|
|
2017-03-04 20:58:08 +01:00
|
|
|
#includes
|
2017-03-04 20:50:13 +01:00
|
|
|
. ./config.sh
|
2017-02-08 06:44:35 +01:00
|
|
|
. ./colors.sh
|
2016-05-28 20:09:45 +02:00
|
|
|
|
2016-04-29 21:24:22 +02:00
|
|
|
#send a message
|
2017-02-08 06:44:35 +01:00
|
|
|
verbose "Installing Fail2ban"
|
2016-04-29 21:24:22 +02:00
|
|
|
|
|
|
|
|
#add the dependencies
|
2016-05-28 20:09:45 +02:00
|
|
|
apt-get install -y --force-yes fail2ban
|
2016-04-29 21:24:22 +02:00
|
|
|
|
|
|
|
|
#move the filters
|
2017-02-09 16:24:37 +01:00
|
|
|
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
|
2016-04-29 21:24:22 +02:00
|
|
|
|
2016-05-28 20:09:45 +02:00
|
|
|
#update config if source is being used
|
2017-03-04 21:47:01 +01:00
|
|
|
if [ .$switch_source = .true ]; then
|
2016-05-28 20:09:45 +02:00
|
|
|
sed 's#var/log/freeswitch#usr/local/freeswitch/log#g' -i /etc/fail2ban/jail.local
|
|
|
|
|
fi
|
2016-04-29 21:24:22 +02:00
|
|
|
|
|
|
|
|
#restart fail2ban
|
|
|
|
|
#systemd
|
|
|
|
|
/bin/systemctl restart fail2ban
|
|
|
|
|
|
|
|
|
|
#init.d
|
|
|
|
|
#/usr/sbin/service fail2ban restart
|