ufw.sh 641 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. echo -e '
  3. _ _ _____ __
  4. | | | | __\ \ / /
  5. | |_| | _| \ \/\/ /
  6. \___/|_| \_/\_/
  7. '
  8. echo -e "Installing ufw and setup firewall (allowing only ssh and http)"
  9. . bin/checkroot.sh
  10. sleep 2
  11. # TODO use awall instead of ufw ?
  12. # BUG
  13. # ufw
  14. # Traceback (most recent call last):
  15. # File "/usr/sbin/ufw", line 25, in <module>
  16. # import ufw.frontend
  17. # ModuleNotFoundError: No module named 'ufw'
  18. # ufw
  19. apk add ufw@edgecommunity
  20. ufw allow ssh # knockd will open the ssh port
  21. ufw allow http
  22. ufw allow https
  23. # TODO ask for allowing ssh for some ip
  24. ufw enable
  25. ufw status verbose
  26. echo -e "ufw installed and firwall configured"