-
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] templating resolvers fails in ipv6 only environments #148
Comments
Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid. |
For ipv6, you'll have to manually update/edit your resolver.conf |
nginx-proxy/nginx-proxy uses the below expression to handle ipv6 resolvers. I was able to patch RESOLVERS=$(awk '$1 == "nameserver" {print ($2 ~ ":")? "["$2"]": $2}' ORS=' ' /etc/resolv.conf | sed 's/ *$//g') Below is a working patch. --- init-nginx.run.orig 2023-09-04 17:43:42.729804394 -0500
+++ init-nginx.run.sh 2023-09-04 17:53:42.569749584 -0500
@@ -38,18 +38,19 @@
# Set resolver, ignore ipv6 addresses
touch /config/nginx/resolver.conf
if ! grep -q 'resolver' /config/nginx/resolver.conf; then
- RESOLVERRAW=$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf)
- for i in ${RESOLVERRAW}; do
- if [[ "$(awk -F ':' '{print NF-1}' <<<"${i}")" -le 2 ]]; then
- RESOLVER="${RESOLVER} ${i}"
- fi
- done
- if [[ -z "${RESOLVER}" ]]; then
- RESOLVER="127.0.0.11"
+ RESOLVERS=$(awk '$1 == "nameserver" {print ($2 ~ ":")? "["$2"]": $2}' ORS=' ' /etc/resolv.conf | sed 's/ *$//g')
+
+ if [[ -z "${RESOLVERS}" ]]; then
+ RESOLVERS="127.0.0.11"
fi
- echo "Setting resolver to ${RESOLVER}"
- RESOLVEROUTPUT="# This file is auto-generated only on first start, based on the container's /etc/resolv.conf file. Feel free to modify it as you wish.\n\nresolver ${RESOLVER} valid=30s;"
- echo -e "${RESOLVEROUTPUT}" >/config/nginx/resolver.conf
+ echo "Setting resolvers to ${RESOLVERS}"
+ RESOLVEROUTPUT="# This file is auto-generated only on first start, based on the container's /etc/resolv.conf file. Feel free to modify it as you wish.\n\n"
+ echo -e "${RESOLVEROUTPUT}" > /config/nginx/resolver.conf
+ for RESOLVER in ${RESOLVERS}; do
+ echo -e "resolver ${RESOLVER} valid=30s;" >> /config/nginx/resolver.conf
+ done
+ echo -e ""
+
fi
# Set worker_processes I can open an PR to implement this if you'd approve it. |
The recommendation doesn't work if an ipv6 resolver with a port is supplied.
results in
I'm not opposed to considering a working solution for ipv6, but if we're going to change what we have it would be best to have a fairly comprehensive replacement. |
This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue is locked due to inactivity |
Is there an existing issue for this?
Current Behavior
Nginx stalls with the message
nginx: [emerg] invalid port in resolver "fdaa::3" in /config/nginx/resolver.conf:3
when/etc/resolv.conf
contains only ipv6 dns servers.Expected Behavior
/config/nginx/resolver.conf
should be templated correctly with the IPv6 DNS servers enclosed in[]
.Steps To Reproduce
Environment
The text was updated successfully, but these errors were encountered: