From 1af242f7733d69ba99534feee54cfd248f8483c2 Mon Sep 17 00:00:00 2001 From: Tomasz Janowski Date: Sun, 28 Oct 2018 16:43:55 +1100 Subject: [PATCH] Don't insert duplicate ip addresses to the openvpn config file A new set of ip addresses is appended on every restart of the container which eventually results in openvpn error "Maximum number of 'remote' options (64) exceeded." --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 2d9484ad..7b3a683a 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -91,7 +91,7 @@ printf "\n * Adding IP addresses of $PIADOMAIN to /openvpn-$PROTOCOL-$ENCRYPTION for ip in $VPNIPS do printf "\n remote $ip $PORT" - echo "remote $ip $PORT" >> "/openvpn-$PROTOCOL-$ENCRYPTION/$REGION.ovpn" + grep "remote $ip $PORT" "/openvpn-$PROTOCOL-$ENCRYPTION/$REGION.ovpn" || echo "remote $ip $PORT" >> "/openvpn-$PROTOCOL-$ENCRYPTION/$REGION.ovpn" done printf "\n * Deleting all iptables rules..." iptables --flush