From 5aee112442bae96ac7d09cd81a4b9ede35df36cd Mon Sep 17 00:00:00 2001 From: Henry N Date: Thu, 2 Apr 2020 00:29:30 +0200 Subject: [PATCH] only IPv4 from resolve.conf, if IPv6 disabled Do not copy IPv6 DNS from resolve.conf, if IPV6_SUPPORT is not enabled. --- openvpn-install.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index de1531a..c7a8631 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -755,7 +755,9 @@ ifconfig-pool-persist ipp.txt" >> /etc/openvpn/server.conf fi # Obtain the resolvers from resolv.conf and use them for OpenVPN sed -ne 's/^nameserver[[:space:]]\+\([^[:space:]]\+\).*$/\1/p' $RESOLVCONF | while read -r line; do - echo "push \"dhcp-option DNS $line\"" >> /etc/openvpn/server.conf + if [[ "$line" =~ ^[0-9.]*$ ]] || [[ "$IPV6_SUPPORT" == 'y' ]]; then + echo "push \"dhcp-option DNS $line\"" >> /etc/openvpn/server.conf + fi done ;; 2)