fail2ban.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh
  2. #move to script directory so all relative paths work
  3. cd "$(dirname "$0")"
  4. #includes
  5. . ./config.sh
  6. . ./colors.sh
  7. #send a message
  8. verbose "Installing Fail2ban"
  9. #add the dependencies
  10. apt-get install -y fail2ban rsyslog
  11. #move the filters
  12. cp fail2ban/sip-auth-failure.conf /etc/fail2ban/filter.d/sip-auth-failure.conf
  13. cp fail2ban/sip-auth-challenge.conf /etc/fail2ban/filter.d/sip-auth-challenge.conf
  14. cp fail2ban/auth-challenge-ip.conf /etc/fail2ban/filter.d/auth-challenge-ip.conf
  15. cp fail2ban/freeswitch-ip.conf /etc/fail2ban/filter.d/freeswitch-ip.conf
  16. cp fail2ban/freeswitch.conf /etc/fail2ban/filter.d/freeswitch.conf
  17. cp fail2ban/fusionpbx.conf /etc/fail2ban/filter.d/fusionpbx.conf
  18. cp fail2ban/fusionpbx-mac.conf /etc/fail2ban/filter.d/fusionpbx-mac.conf
  19. cp fail2ban/fusionpbx-404.conf /etc/fail2ban/filter.d/fusionpbx-404.conf
  20. cp fail2ban/nginx-404.conf /etc/fail2ban/filter.d/nginx-404.conf
  21. cp fail2ban/nginx-dos.conf /etc/fail2ban/filter.d/nginx-dos.conf
  22. cp fail2ban/jail.local /etc/fail2ban/jail.local
  23. #update config if source is being used
  24. #if [ .$switch_source = .true ]; then
  25. # sed 's#var/log/freeswitch#usr/local/freeswitch/log#g' -i /etc/fail2ban/jail.local
  26. #fi
  27. #restart fail2ban
  28. /usr/sbin/service fail2ban restart