mirror of
https://github.com/pivpn/pivpn.git
synced 2025-02-01 01:09:47 +00:00
Support reverting UFW changes on uninstall
This commit is contained in:
parent
a432e187b9
commit
3916acf665
2 changed files with 13 additions and 2 deletions
|
@ -760,8 +760,7 @@ confNetwork() {
|
||||||
$SUDO sed -i 's/IPv4dev/'$IPv4dev'/' /tmp/ufw_add.txt
|
$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 "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 sed -i -e '/delete these required/r /tmp/ufw_add.txt' -e//N /etc/ufw/before.rules
|
||||||
$SUDO ufw disable
|
$SUDO ufw reload
|
||||||
$SUDO ufw enable
|
|
||||||
echo "::: UFW configuration completed."
|
echo "::: UFW configuration completed."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -769,13 +768,18 @@ confNetwork() {
|
||||||
fi
|
fi
|
||||||
# else configure iptables
|
# else configure iptables
|
||||||
if [[ $noUFW -eq 1 ]]; then
|
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
|
$SUDO iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o $IPv4dev -j MASQUERADE
|
||||||
if [[ $PLAT == "Ubuntu" ]]; then
|
if [[ $PLAT == "Ubuntu" ]]; then
|
||||||
$SUDO iptables-save
|
$SUDO iptables-save
|
||||||
else
|
else
|
||||||
$SUDO netfilter-persistent save
|
$SUDO netfilter-persistent save
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo 0 > /tmp/noUFW
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
$SUDO cp /tmp/noUFW /etc/pivpn/NO_UFW
|
||||||
}
|
}
|
||||||
|
|
||||||
confOVPN() {
|
confOVPN() {
|
||||||
|
|
|
@ -18,6 +18,7 @@ fi
|
||||||
|
|
||||||
INSTALL_USER=$(cat /etc/pivpn/INSTALL_USER)
|
INSTALL_USER=$(cat /etc/pivpn/INSTALL_USER)
|
||||||
PLAT=$(cat /etc/pivpn/DET_PLATFORM)
|
PLAT=$(cat /etc/pivpn/DET_PLATFORM)
|
||||||
|
NO_UFW=$(cat /etc/pivpn/NO_UFW)
|
||||||
|
|
||||||
# Find the rows and columns
|
# Find the rows and columns
|
||||||
rows=$(tput lines)
|
rows=$(tput lines)
|
||||||
|
@ -99,6 +100,12 @@ echo ":::"
|
||||||
sed -i '/net.ipv4.ip_forward=1/c\#net.ipv4.ip_forward=1' /etc/sysctl.conf
|
sed -i '/net.ipv4.ip_forward=1/c\#net.ipv4.ip_forward=1' /etc/sysctl.conf
|
||||||
sysctl -p
|
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 ":::"
|
echo ":::"
|
||||||
printf "::: Finished removing PiVPN from your system.\n"
|
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"
|
printf "::: Reinstall by simpling running\n:::\n:::\tcurl -L https://install.pivpn.io | bash\n:::\n::: at any time!\n:::\n"
|
||||||
|
|
Loading…
Add table
Reference in a new issue