firewall.init 535 B

1234567891011121314151617181920212223242526272829303132333435
  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. exec sh $0 start
  10. ;;
  11. start)
  12. . /etc/firewall.conf
  13. ;;
  14. stop)
  15. ### Clear tables
  16. iptables -F
  17. iptables -X
  18. iptables -t nat -F
  19. iptables -t nat -X
  20. iptables -P INPUT ACCEPT
  21. iptables -P FORWARD ACCEPT
  22. iptables -P OUTPUT ACCEPT
  23. iptables -t nat -P PREROUTING ACCEPT
  24. iptables -t nat -P POSTROUTING ACCEPT
  25. ;;
  26. restart)
  27. sh $0 stop
  28. sh $0 start
  29. ;;
  30. *)
  31. echo "Usage: $0 {start | stop | restart}"
  32. ;;
  33. esac
  34. exit $?