From 182c43316ff9acd8ac46c6d548deda166893e213 Mon Sep 17 00:00:00 2001 From: Henry N Date: Mon, 27 Apr 2020 18:04:18 +0200 Subject: [PATCH] feat(install): get system IPv6 resolvers if enabled (#599) --- openvpn-install.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index 27bb1c1..72122b0 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -780,8 +780,11 @@ ifconfig-pool-persist ipp.txt" >>/etc/openvpn/server.conf RESOLVCONF='/etc/resolv.conf' fi # Obtain the resolvers from resolv.conf and use them for OpenVPN - grep -v '#' $RESOLVCONF | grep 'nameserver' | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | while read -r line; do - echo "push \"dhcp-option DNS $line\"" >>/etc/openvpn/server.conf + sed -ne 's/^nameserver[[:space:]]\+\([^[:space:]]\+\).*$/\1/p' $RESOLVCONF | while read -r line; do + # Copy, if it's a IPv4 |or| if IPv6 is enabled, IPv4/IPv6 does not matter + if [[ $line =~ ^[0-9.]*$ ]] || [[ $IPV6_SUPPORT == 'y' ]]; then + echo "push \"dhcp-option DNS $line\"" >>/etc/openvpn/server.conf + fi done ;; 2) # Self-hosted DNS resolver (Unbound)