diff --git a/ipsec/install.sh b/ipsec/install.sh index acda683..706454c 100755 --- a/ipsec/install.sh +++ b/ipsec/install.sh @@ -59,18 +59,6 @@ systemctl enable strongswan service xl2tpd restart service strongswan restart -IPTABLESRESTOR=$(which iptables-restore) -RESTORPRESENTS=$(grep iptables-restore $RCLOCAL) -if [ $? -ne 0 ]; then - if [[ ! -z $IPTABLESRESTOR ]]; then - sed -i -e "/exit 0/d" $RCLOCAL - echo "$IPTABLESRESTOR < $IPTABLES" >> $RCLOCAL - echo "exit 0" >> $RCLOCAL - else - echo "Cannot save iptables-restore from $IPTABLES to $RCLOCAL." - fi -fi - echo echo "Installation script completed!" diff --git a/ipsec/iptables-setup.sh b/ipsec/iptables-setup.sh index 5862f6d..707ba19 100755 --- a/ipsec/iptables-setup.sh +++ b/ipsec/iptables-setup.sh @@ -70,3 +70,15 @@ iptables -A OUTPUT -o ppp+ -j ACCEPT iptables -A INPUT -p tcp --dport 1701 -j ACCEPT iptables-save | awk '($0 !~ /^-A/)||!($0 in a) {a[$0];print}' > $IPTABLES + +IPTABLESRESTOR=$(which iptables-restore) +RESTORPRESENTS=$(grep iptables-restore $RCLOCAL) +if [ $? -ne 0 ]; then + if [[ ! -z $IPTABLESRESTOR ]]; then + sed -i -e "/exit 0/d" $RCLOCAL + echo "$IPTABLESRESTOR < $IPTABLES" >> $RCLOCAL + echo "exit 0" >> $RCLOCAL + else + echo "Cannot save iptables-restore from $IPTABLES to $RCLOCAL." + fi +fi diff --git a/pptp/install.sh b/pptp/install.sh index 1ed3d53..76537f3 100755 --- a/pptp/install.sh +++ b/pptp/install.sh @@ -50,18 +50,6 @@ echo "Starting pptpd..." systemctl enable pptpd service pptpd restart -IPTABLESRESTOR=$(which iptables-restore) -RESTORPRESENTS=$(grep iptables-restore $RCLOCAL) -if [ $? -ne 0 ]; then - if [[ ! -z $IPTABLESRESTOR ]]; then - sed -i -e "/exit 0/d" $RCLOCAL - echo "$IPTABLESRESTOR < $IPTABLES" >> $RCLOCAL - echo "exit 0" >> $RCLOCAL - else - echo "Cannot save iptables-restore from $IPTABLES to $RCLOCAL." - fi -fi - echo echo "Installation script completed!" diff --git a/pptp/iptables-setup.sh b/pptp/iptables-setup.sh index 6954c37..332fd96 100755 --- a/pptp/iptables-setup.sh +++ b/pptp/iptables-setup.sh @@ -72,3 +72,15 @@ iptables -A INPUT -p 47 -j ACCEPT iptables -A OUTPUT -p 47 -j ACCEPT iptables-save | awk '($0 !~ /^-A/)||!($0 in a) {a[$0];print}' > $IPTABLES + +IPTABLESRESTOR=$(which iptables-restore) +RESTORPRESENTS=$(grep iptables-restore $RCLOCAL) +if [ $? -ne 0 ]; then + if [[ ! -z $IPTABLESRESTOR ]]; then + sed -i -e "/exit 0/d" $RCLOCAL + echo "$IPTABLESRESTOR < $IPTABLES" >> $RCLOCAL + echo "exit 0" >> $RCLOCAL + else + echo "Cannot save iptables-restore from $IPTABLES to $RCLOCAL." + fi +fi