fail2ban.sh 657 B

1234567891011121314151617181920212223242526
  1. #!/bin/sh
  2. # TODO check if root
  3. echo -e '\033[35m
  4. ______ _ _____ __
  5. / ____/___ _(_) /__ \ / /_ ____ _____
  6. / /_ / __ `/ / /__/ // __ \/ __ `/ __ \
  7. / __/ / /_/ / / // __// /_/ / /_/ / / / /
  8. /_/ \__,_/_/_//____/_.___/\__,_/_/ /_/
  9. \033[0m'
  10. echo -e "\033[35;1mInstalling fall2ban \033[0m"
  11. if [ "$EUID" -ne 0 ]; then
  12. echo "Please run as root"
  13. exit
  14. fi
  15. sleep 2
  16. apt-get --yes install fail2ban
  17. cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
  18. # ToDo ask for email and configure jail.local with it
  19. touch /var/log/auth.log
  20. systemctl enable fail2ban
  21. systemctl restart fail2ban
  22. echo -e "\033[92;1mfail2ban installed and configured\033[Om"