fixes for fail2ban (#10)

export the command line variables so sub scripts can use them
use sed to update log path is source is used
simplify freeswitch rules to use protocol=all
general tidy up of spacing in files
This commit is contained in:
Mafoo
2016-05-28 19:09:45 +01:00
committed by FusionPBX
parent af853ed018
commit bf5a253f65
6 changed files with 61 additions and 134 deletions

View File

@@ -1,22 +1,27 @@
#!/bin/sh
#initialize variable encase we are called directly
[ -z $USE_FREESWITCH_SOURCE ] && USE_FREESWITCH_SOURCE=false
#send a message
echo "Install Fail2ban"
#add the dependencies
apt-get install -y --force-yes fail2ban
apt-get install -y --force-yes fail2ban
#move the filters
cp resources/fail2ban/fusionpbx.conf /etc/fail2ban/filter.d/fusionpbx.conf
cp resources/fail2ban/freeswitch-dos.conf /etc/fail2ban/filter.d/freeswitch-dos.conf
cp resources/fail2ban/freeswitch-ip.conf /etc/fail2ban/filter.d/freeswitch-ip.conf
cp resources/fail2ban/freeswitch.conf /etc/fail2ban/filter.d/freeswitch.conf
cp resources/fail2ban/fusionpbx.conf /etc/fail2ban/filter.d/fusionpbx.conf
cp resources/fail2ban/nginx-404.conf /etc/fail2ban/filter.d/nginx-404.conf
cp resources/fail2ban/nginx-dos.conf /etc/fail2ban/filter.d/nginx-dos.conf
cp resources/fail2ban/jail.local /etc/fail2ban/jail.local
#move the template
cp resources/fail2ban/jail.package /etc/fail2ban/jail.package
cp resources/fail2ban/jail.source /etc/fail2ban/jail.source
#active the filters
cp resources/fail2ban/jail.package /etc/fail2ban/jail.local
#update config if source is being used
if [ $USE_FREESWITCH_SOURCE = true ]; then
sed 's#var/log/freeswitch#usr/local/freeswitch/log#g' -i /etc/fail2ban/jail.local
fi
#restart fail2ban
#systemd