From efbe7739d3a5e4e975a3dd15aba8359eb0ac0c45 Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Fri, 9 Sep 2022 08:53:03 -0500 Subject: [PATCH] Improve setup - When uninstalling the VPN, disable IP forwarding. --- openvpn-install.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openvpn-install.sh b/openvpn-install.sh index d355c22..b40f4d6 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -702,6 +702,11 @@ else systemctl disable --now openvpn-server@server.service rm -f /etc/systemd/system/openvpn-server@server.service.d/disable-limitnproc.conf rm -f /etc/sysctl.d/99-openvpn-forward.conf /etc/sysctl.d/99-openvpn-optimize.conf + if [ ! -f /usr/bin/wg-quick ] && [ ! -f /usr/sbin/ipsec ] \ + && [ ! -f /usr/local/sbin/ipsec ]; then + echo 0 > /proc/sys/net/ipv4/ip_forward + echo 0 > /proc/sys/net/ipv6/conf/all/forwarding + fi if [[ "$os" = "debian" || "$os" = "ubuntu" ]]; then ( set -x