firewall.sh 680 B

1234567891011121314151617181920212223242526
  1. #!/bin/sh
  2. echo -e '\033[35m
  3. ______________ _______ _____ __ __
  4. / ____/ _/ __ \/ ____/ | / / | / / / /
  5. / /_ / // /_/ / __/ | | /| / / /| | / / / /
  6. / __/ _/ // _, _/ /___ | |/ |/ / ___ |/ /___/ /___
  7. /_/ /___/_/ |_/_____/ |__/|__/_/ |_/_____/_____/
  8. \033[0m'
  9. echo -e "\033[35;1mInstalling ufw and setup firewall (allowing only ssh and http) \033[0m"
  10. . checkroot.sh
  11. sleep 2
  12. # TODO use awall instead of ufw ?
  13. # ufw
  14. apk add ufw
  15. ufw allow ssh # knockd will open the ssh port
  16. ufw allow http
  17. ufw allow https
  18. # TODO ask for allowing ssh for some ip
  19. ufw enable
  20. ufw status verbose
  21. echo -e "\033[92;1mufw installed and firwall configured\033[Om"