Skip to content

Commit a8f98a2

Browse files
authored
Merge pull request #127 from linuxserver/resolver
update resolver logic
2 parents 31d9e9a + aa94da0 commit a8f98a2

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
330330

331331
## Versions
332332

333+
* **20.05.21:** - Modify resolver.conf generation to detect and ignore ipv6.
333334
* **14.05.21:** - [Existing users should update:](https://github.com/linuxserver/docker-swag/blob/master/README.md#updating-configs) nginx.conf, ssl.conf, proxy.conf, and the default site-conf - Rework nginx.conf to be inline with alpine upstream and relocate lines from other files. Use linuxserver.io wheel index for pip packages. Switch to using [ffdhe4096](https://ssl-config.mozilla.org/ffdhe4096.txt) for `dhparams.pem` per [RFC7919](https://datatracker.ietf.org/doc/html/rfc7919). Added `worker_processes.conf`, which sets the number of nginx workers, and `resolver.conf`, which sets the dns resolver. Both conf files are auto-generated only on first start and can be user modified later.
334335
* **21.04.21:** - [Existing users should update:](https://github.com/linuxserver/docker-swag/blob/master/README.md#updating-configs) authelia-server.conf and authelia-location.conf - Add remote name/email headers and pass http method.
335336
* **12.04.21:** - Add php7-gmp and php7-pecl-mailparse.

readme-vars.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ app_setup_nginx_reverse_proxy_block: ""
151151

152152
# changelog
153153
changelogs:
154+
- { date: "20.05.21:", desc: "Modify resolver.conf generation to detect and ignore ipv6." }
154155
- { date: "14.05.21:", desc: "[Existing users should update:](https://github.com/linuxserver/docker-swag/blob/master/README.md#updating-configs) nginx.conf, ssl.conf, proxy.conf, and the default site-conf - Rework nginx.conf to be inline with alpine upstream and relocate lines from other files. Use linuxserver.io wheel index for pip packages. Switch to using [ffdhe4096](https://ssl-config.mozilla.org/ffdhe4096.txt) for `dhparams.pem` per [RFC7919](https://datatracker.ietf.org/doc/html/rfc7919). Added `worker_processes.conf`, which sets the number of nginx workers, and `resolver.conf`, which sets the dns resolver. Both conf files are auto-generated only on first start and can be user modified later." }
155156
- { date: "21.04.21:", desc: "[Existing users should update:](https://github.com/linuxserver/docker-swag/blob/master/README.md#updating-configs) authelia-server.conf and authelia-location.conf - Add remote name/email headers and pass http method." }
156157
- { date: "12.04.21:", desc: "Add php7-gmp and php7-pecl-mailparse." }

root/etc/cont-init.d/50-config

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,17 @@ cp /config/fail2ban/jail.local /etc/fail2ban/jail.local
8181
[[ ! -f /config/www/502.html ]] &&
8282
cp /defaults/502.html /config/www/502.html
8383

84-
# Set resolver
84+
# Set resolver, ignore ipv6 addresses
8585
if ! grep -q 'resolver' /config/nginx/resolver.conf; then
86-
RESOLVER=$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf)
86+
RESOLVERRAW=$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf)
87+
for i in ${RESOLVERRAW}; do
88+
if [ $(awk -F ':' '{print NF-1}' <<< ${i}) -le 2 ]; then
89+
RESOLVER="${RESOLVER} ${i}"
90+
fi
91+
done
92+
if [ -z "${RESOLVER}" ]; then
93+
RESOLVER="127.0.0.11"
94+
fi
8795
echo "Setting resolver to ${RESOLVER}"
8896
echo -e "# 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;" > /config/nginx/resolver.conf
8997
fi

0 commit comments

Comments
 (0)