diff --git a/auto_install/install.sh b/auto_install/install.sh index f324d24..f046bd8 100644 --- a/auto_install/install.sh +++ b/auto_install/install.sh @@ -495,6 +495,9 @@ setCustomPort() { fi fi done + # write out the port + echo ${PORT} > /tmp/INSTALL_PORT + $SUDO cp /tmp/INSTALL_PORT /etc/pivpn/INSTALL_PORT } setClientDNS() { @@ -771,6 +774,8 @@ 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 allow ${PORT}/udp + $SUDO ufw allow from 10.8.0.0/24 $SUDO ufw reload echo "::: UFW configuration completed." fi diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh index 20b19f1..4b50e62 100644 --- a/scripts/uninstall.sh +++ b/scripts/uninstall.sh @@ -19,6 +19,7 @@ fi INSTALL_USER=$(cat /etc/pivpn/INSTALL_USER) PLAT=$(cat /etc/pivpn/DET_PLATFORM) NO_UFW=$(cat /etc/pivpn/NO_UFW) +PORT=$(cat /etc/pivpn/INSTALL_PORT) # Find the rows and columns rows=$(tput lines) @@ -103,6 +104,8 @@ echo ":::" 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 delete allow from 10.8.0.0/24 >/dev/null + $SUDO ufw delete allow ${PORT}/udp >/dev/null $SUDO ufw reload fi