firewall.init 613 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh
  2. #PKG iptables
  3. #INIT 45
  4. . /etc/rc.conf
  5. case $1 in
  6. autostop) ;;
  7. autostart)
  8. test x"${firewall:-NO}" = x"NO" && exit 0
  9. test x"$firewall" = x"DAEMON" && test -x /bin/mksh && exec mksh -T- $0 start
  10. exec sh $0 start
  11. ;;
  12. start)
  13. . /etc/firewall.conf
  14. ;;
  15. stop)
  16. ### Clear tables
  17. iptables -F
  18. iptables -X
  19. iptables -t nat -F
  20. iptables -t nat -X
  21. iptables -P INPUT ACCEPT
  22. iptables -P FORWARD ACCEPT
  23. iptables -P OUTPUT ACCEPT
  24. iptables -t nat -P PREROUTING ACCEPT
  25. iptables -t nat -P POSTROUTING ACCEPT
  26. ;;
  27. restart)
  28. sh $0 stop
  29. sh $0 start
  30. ;;
  31. *)
  32. echo "Usage: $0 {start | stop | restart}"
  33. ;;
  34. esac
  35. exit $?