Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- ### BEGIN INIT INFO
- # Provides: init_firewall
- # Required-Start: $local_fs
- # Should-Start:
- # Required-Stop: $local_fs
- # Should-Stop:
- # X-Start-Before: $network
- # X-Start-After: $network
- # Default-Start: S
- # Default-Stop: 0 6
- # Short-Description: iptables based firewall
- ### END INIT INFO
- case "1" in
- 'start')
- iptables-restore > /usr/local/sbin/config_firewall
- ip6tables-restore > /usr/local/sbin/config_firewall
- echo "Starting Firewall"
- RETVAL=$?
- ;;
- 'stop')
- iptables-save > /usr/local/sbin/config_firewall
- ip6tables-save > /usr/local/sbin/config_fierwall
- RETVAL=$?
- ;;
- 'clean')
- #nettoie le parefeu aux valeurs ci-dessous.
- ####IPv4####
- iptables -t filter -F
- iptables -t nat -F
- iptables -t mangle -F
- iptables -t filter -P INPUT ACCEPT
- iptables -t filter -P OUTPUT ACCEPT
- iptables -t filter -P FORWARD ACCEPT
- iptables -t nat -P PREROUTING ACCEPT
- iptables -t nat -P POSTROUTING ACCEPT
- iptables -t nat -P INPUT ACCEPT
- iptables -t nat -P FORWARD ACCEPT
- iptables -t raw -P OUTPUT ACCEPT
- iptables -t raw -P PREROUTING ACCEPT
- ####IPv6####
- ip6tables -t filter -F
- ip6tables -t nat -F
- ip6tables -t mangle -F
- ip6tables -t raw -F
- ip6tables -t filter -P INPUT ACCEPT
- ip6tables -t filter -P OUTPUT ACCEPT
- ip6tables -t filter -P FORWARD ACCEPT
- ip6tables -t nat -P PREROUTING ACCEPT
- ip6tables -t nat -P POSTROUTING ACCEPT
- ip6tables -t nat -P OUTPUT ACCEPT
- ip6tables -t nat -P FORWARD ACCEPT
- ip6tables -t nat -P INPUT ACCEPT
- ip6tables -t raw -P OUTPUT ACCEPT
- ip6tables -t raw -P PREROUTING ACCEPT
- RETVAL=$?
- ;;
- 'restart')
- $0 stop && $0 start
- RETVAL=$?
- ;;
- *)
- echo"Usage: $0 {start | stop | restart | clean }"
- RETVAL=1
- ;;
- esac
- exit $RETVAL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement