diff --git a/auto_install/install.sh b/auto_install/install.sh index 81291dc..d90f222 100644 --- a/auto_install/install.sh +++ b/auto_install/install.sh @@ -760,8 +760,7 @@ confNetwork() { $SUDO sed -i 's/IPv4dev/'$IPv4dev'/' /tmp/ufw_add.txt $SUDO sed -i "s/\(DEFAULT_FORWARD_POLICY=\).*/\1\"ACCEPT\"/" /etc/default/ufw $SUDO sed -i -e '/delete these required/r /tmp/ufw_add.txt' -e//N /etc/ufw/before.rules - $SUDO ufw disable - $SUDO ufw enable + $SUDO ufw reload echo "::: UFW configuration completed." fi else @@ -769,13 +768,18 @@ confNetwork() { fi # else configure iptables if [[ $noUFW -eq 1 ]]; then + echo 1 > /tmp/noUFW $SUDO iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o $IPv4dev -j MASQUERADE if [[ $PLAT == "Ubuntu" ]]; then $SUDO iptables-save else $SUDO netfilter-persistent save fi + else + echo 0 > /tmp/noUFW fi + + $SUDO cp /tmp/noUFW /etc/pivpn/NO_UFW } confOVPN() { diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh index d79f672..20b19f1 100644 --- a/scripts/uninstall.sh +++ b/scripts/uninstall.sh @@ -18,6 +18,7 @@ fi INSTALL_USER=$(cat /etc/pivpn/INSTALL_USER) PLAT=$(cat /etc/pivpn/DET_PLATFORM) +NO_UFW=$(cat /etc/pivpn/NO_UFW) # Find the rows and columns rows=$(tput lines) @@ -99,6 +100,12 @@ echo ":::" sed -i '/net.ipv4.ip_forward=1/c\#net.ipv4.ip_forward=1' /etc/sysctl.conf sysctl -p + if [[ $NO_UFW -eq 0 ]]; then + $SUDO sed -i "s/\(DEFAULT_FORWARD_POLICY=\).*/\1\"DROP\"/" /etc/default/ufw + $SUDO sed -i '/START OPENVPN RULES/,/END OPENVPN RULES/ d' /etc/ufw/before.rules + $SUDO ufw reload + fi + echo ":::" printf "::: Finished removing PiVPN from your system.\n" printf "::: Reinstall by simpling running\n:::\n:::\tcurl -L https://install.pivpn.io | bash\n:::\n::: at any time!\n:::\n"