From 5d503b48cb414026c268069b273aef2ce6708b0f Mon Sep 17 00:00:00 2001 From: Steve Kamerman Date: Thu, 19 Oct 2017 20:58:34 -0400 Subject: [PATCH] Added support for IPv6 DNS servers in resolver generation (issue #938) --- docker-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 2afd5bf..7e7a312 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -18,8 +18,8 @@ fi # Note: if $DHPARAM_BITS is not defined, generate-dhparam.sh will use 2048 as a default /app/generate-dhparam.sh $DHPARAM_BITS -# Compute the DNS resolvers for use in the templates -export RESOLVERS=$(awk '$1 == "nameserver" {print $2}' ORS=' ' /etc/resolv.conf | sed 's/ *$//g') +# Compute the DNS resolvers for use in the templates - if the IP contains ":", it's IPv6 and must be enclosed in [] +export RESOLVERS=$(awk '$1 == "nameserver" {print ($2 ~ ":")? "["$2"]": $2}' ORS=' ' /etc/resolv.conf | sed 's/ *$//g') if [ "x$RESOLVERS" = "x" ]; then echo "Warning: unable to determine DNS resolvers for nginx" >&2 unset RESOLVERS