fail2ban.sh 1.0 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. yum -y install fail2ban
  11. #move the filters
  12. cp ./fail2ban/freeswitch-dos.conf /etc/fail2ban/filter.d/freeswitch-dos.conf
  13. cp ./fail2ban/freeswitch-ip.conf /etc/fail2ban/filter.d/freeswitch-ip.conf
  14. cp ./fail2ban/freeswitch-404.conf /etc/fail2ban/filter.d/freeswitch-404.conf
  15. cp ./fail2ban/freeswitch.conf /etc/fail2ban/filter.d/freeswitch.conf
  16. cp ./fail2ban/fusionpbx.conf /etc/fail2ban/filter.d/fusionpbx.conf
  17. cp ./fail2ban/nginx-404.conf /etc/fail2ban/filter.d/nginx-404.conf
  18. cp ./fail2ban/nginx-dos.conf /etc/fail2ban/filter.d/nginx-dos.conf
  19. cp ./fail2ban/jail.local /etc/fail2ban/jail.local
  20. #update config if source is being used
  21. if [ .$switch_source = .true ]; then
  22. sed 's#var/log/freeswitch#usr/local/freeswitch/log#g' -i /etc/fail2ban/jail.local
  23. fi
  24. #restart fail2ban
  25. systemctl restart fail2ban
  26. #send a message
  27. verbose "Fail2ban installed"