diff --git a/openvpn-install.sh b/openvpn-install.sh index 136e7d9..3850328 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -145,6 +145,7 @@ if [[ -e /etc/openvpn/server/server.conf ]]; then fi systemctl disable --now openvpn-server@server.service rm -rf /etc/openvpn/server + rm -f /etc/systemd/system/openvpn-server@server.service.d/disable-limitnproc.conf rm -f /etc/sysctl.d/30-openvpn-forward.conf if [[ "$OS" = 'debian' ]]; then apt-get remove --purge -y openvpn @@ -212,6 +213,12 @@ else echo echo "Okay, that was all I needed. We are ready to set up your OpenVPN server now." read -n1 -r -p "Press any key to continue..." + # If running inside a container, disable LimitNPROC to prevent conflicts + if systemd-detect-virt -cq; then + mkdir /etc/systemd/system/openvpn-server@server.service.d/ 2>/dev/null + echo '[Service] +LimitNPROC=infinity' > /etc/systemd/system/openvpn-server@server.service.d/disable-limitnproc.conf + fi if [[ "$OS" = 'debian' ]]; then apt-get update apt-get install openvpn iptables openssl ca-certificates -y