Fixes for UFW

This commit is contained in:
Kaladin Light 2016-05-15 23:36:40 -04:00
parent f0d92ab8df
commit 0fbc99e0b7
2 changed files with 8 additions and 0 deletions

View file

@ -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

View file

@ -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