trying to make ipv6 actually work

pull/79/merge 0.6.3
Ricardo Pardini 2021-02-14 14:18:38 +01:00
parent b9e5c932ce
commit ce3c77b62a
No known key found for this signature in database
GPG Key ID: 3D38CA12A66C5D02
1 changed files with 18 additions and 2 deletions

View File

@ -4,12 +4,28 @@ set -Eeuo pipefail
trap "echo TRAPed signal" HUP INT QUIT TERM trap "echo TRAPed signal" HUP INT QUIT TERM
#configure nginx DNS settings to match host, why must we do that nginx? #configure nginx DNS settings to match host, why must we do that nginx?
conf="resolver $(/usr/bin/awk 'BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf);" export RESOLVERS=$(awk '$1 == "nameserver" {print ($2 ~ ":")? "["$2"]": $2}' ORS=' ' /etc/resolv.conf | sed 's/ *$//g')
[ "$conf" = "resolver ;" ] && echo "no nameservers found" && exit 0 if [ "x$RESOLVERS" = "x" ]; then
echo "Warning: unable to determine DNS resolvers for nginx" >&2
exit 66
fi
echo "DEBUG, determined RESOLVERS from /etc/resolv.conf: '$RESOLVERS'"
conf=""
for ONE_RESOLVER in ${RESOLVERS}; do
echo "Possible resolver: $ONE_RESOLVER"
conf="resolver $ONE_RESOLVER; "
done
echo "Final chosen resolver: $conf"
confpath=/etc/nginx/resolvers.conf confpath=/etc/nginx/resolvers.conf
if [ ! -e $confpath ] || [ "$conf" != "$(cat $confpath)" ] if [ ! -e $confpath ] || [ "$conf" != "$(cat $confpath)" ]
then then
echo "Using auto-determined resolver '$conf' via '$confpath'"
echo "$conf" > $confpath echo "$conf" > $confpath
else
echo "Not using resolver config, keep existing '$confpath' -- mounted by user?"
fi fi
# The list of SAN (Subject Alternative Names) for which we will create a TLS certificate. # The list of SAN (Subject Alternative Names) for which we will create a TLS certificate.