Get DNS-IPv6 from current system resolvers

Allow IPv4 and IPv6 to get from resolv.conf.
Filter out commets by grepping "nameserver" from beginning of line. No additional comment filter need.
Replace multiple grep with single sed.
This commit is contained in:
Henry N 2020-03-31 00:40:09 +02:00 committed by GitHub
parent 44105eb060
commit 4ddf640a79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -754,7 +754,7 @@ 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
sed -ne 's/^nameserver[[:space:]]\+\([^[:space:]]\+\).*$/\1/p' $RESOLVCONF | while read -r line; do
echo "push \"dhcp-option DNS $line\"" >> /etc/openvpn/server.conf
done
;;