From 1c79a9603b0eb54cea2248ee0005453655ae5fca Mon Sep 17 00:00:00 2001 From: Nyr Date: Fri, 6 Sep 2019 02:44:17 +0200 Subject: [PATCH] Fix LimitNPROC in containers See #206 for context. --- openvpn-install.sh | 7 +++++++ 1 file changed, 7 insertions(+) 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