firewall.sh 689 B

1234567891011121314151617181920212223242526
  1. #!/bin/sh
  2. # TODO check if root
  3. echo '\033[35m
  4. ______________ _______ _____ __ __
  5. / ____/ _/ __ \/ ____/ | / / | / / / /
  6. / /_ / // /_/ / __/ | | /| / / /| | / / / /
  7. / __/ _/ // _, _/ /___ | |/ |/ / ___ |/ /___/ /___
  8. /_/ /___/_/ |_/_____/ |__/|__/_/ |_/_____/_____/
  9. \033[0m'
  10. echo "\033[35;1mInstalling ufw and setup firewall (allowing only ssh and http) \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 --force-yes install ufw
  17. # ufw allow ssh # knockd will open the ssh port
  18. ufw allow http
  19. ufw allow https
  20. ufw enable
  21. ufw status verbose
  22. echo "\033[92;1mufw installed and firwall configured\033[Om"