Skip to content

Commit

Permalink
trying to make ipv6 actually work
Browse files Browse the repository at this point in the history
  • Loading branch information
rpardini committed Feb 14, 2021
1 parent b9e5c93 commit ce3c77b
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,28 @@ set -Eeuo pipefail
trap "echo TRAPed signal" HUP INT QUIT TERM

#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);"
[ "$conf" = "resolver ;" ] && echo "no nameservers found" && exit 0
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
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
if [ ! -e $confpath ] || [ "$conf" != "$(cat $confpath)" ]
then
echo "Using auto-determined resolver '$conf' via '$confpath'"
echo "$conf" > $confpath
else
echo "Not using resolver config, keep existing '$confpath' -- mounted by user?"
fi

# The list of SAN (Subject Alternative Names) for which we will create a TLS certificate.
Expand Down

0 comments on commit ce3c77b

Please sign in to comment.