From e7bfad630156d487868ee74a583fea055de8e276 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 30 Nov 2020 21:46:50 +0000 Subject: [PATCH] Introduce new REV_SERVER environment variables. Deprecate CONDITIONAL_FORWARDING ones, but maintain backward compatibility Signed-off-by: Adam Warner --- README.md | 18 ++++++++++++++---- start.sh | 20 ++++++++++++++++---- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index eaebd04..a03017f 100644 --- a/README.md +++ b/README.md @@ -107,10 +107,10 @@ There are other environment variables if you want to customize various things in | `DNSSEC: <"true"\|"false">`
*Optional* *Default: "false"* | Enable DNSSEC support | `DNS_BOGUS_PRIV: <"true"\|"false">`
*Optional* *Default: "true"* | Enable forwarding of reverse lookups for private ranges | `DNS_FQDN_REQUIRED: <"true"\|"false">`
*Optional* *Default: true* | Never forward non-FQDNs -| `CONDITIONAL_FORWARDING: <"true"\|"false">`
*Optional* *Default: "false"* | Enable DNS conditional forwarding for device name resolution -| `CONDITIONAL_FORWARDING_IP: `
*Optional* | If conditional forwarding is enabled, set the IP of the local network router -| `CONDITIONAL_FORWARDING_DOMAIN: `
*Optional* | If conditional forwarding is enabled, set the domain of the local network router -| `CONDITIONAL_FORWARDING_REVERSE: `
*Optional* | If conditional forwarding is enabled, set the reverse DNS of the local network router (e.g. `0.168.192.in-addr.arpa`) +| `REV_SERVER: <"true"\|"false">`
*Optional* *Default: "false"* | Enable DNS conditional forwarding for device name resolution +| `REV_SERVER_DOMAIN: `
*Optional* | If conditional forwarding is enabled, set the domain of the local network router +| `REV_SERVER_TARGET: `
*Optional* | If conditional forwarding is enabled, set the IP of the local network router +| `REV_SERVER_CIDR: `
*Optional* | If conditional forwarding is enabled, set the reverse DNS zone (e.g. `192.168.0.0/24`) | `ServerIP: `
**Recommended** | **--net=host mode requires** Set to your server's LAN IP, used by web block modes and lighttpd bind address | `ServerIPv6: `
*Required if using IPv6* | **If you have a v6 network** set to your server's LAN IPv6 to block IPv6 ads fully | `VIRTUAL_HOST: `
*Optional* *Default: $ServerIP* | What your web server 'virtual host' is, accessing admin through this Hostname/IP allows you to make changes to the whitelist / blacklists in addition to the default 'http://pi.hole/admin/' address @@ -123,6 +123,16 @@ There are other environment variables if you want to customize various things in | `WEBUIBOXEDLAYOUT: `
*Optional Default: boxed* | Use boxed layout (helpful when working on large screens) | `SKIPGRAVITYONBOOT`:
*Optional Default: Not Set* | Use this option to skip updating the Gravity Database when booting up the container. By default this environment variable is not set so the Gravity Database will be updated when the container starts up. Setting this environment variable to 1 (or anything) will cause the Gravity Database to not be updated when container starts up. +## Deprecated environment variables: +While these may still work, they are likely to be removed in a future version. Where applicible, alternative variable names are indicated + +| Docker Environment Var. | Description | Replaced By | +| ----------------------- | ----------- | ----------- | +| `CONDITIONAL_FORWARDING: <"true"\|"false">`
*Optional* *Default: "false"* | Enable DNS conditional forwarding for device name resolution | `REV_SERVER`| +| `CONDITIONAL_FORWARDING_IP: `
*Optional* | If conditional forwarding is enabled, set the IP of the local network router | `REV_SERVER_TARGET` | +| `CONDITIONAL_FORWARDING_DOMAIN: `
*Optional* | If conditional forwarding is enabled, set the domain of the local network router | `REV_SERVER_DOMAIN` | +| `CONDITIONAL_FORWARDING_REVERSE: `
*Optional* | If conditional forwarding is enabled, set the reverse DNS of the local network router (e.g. `0.168.192.in-addr.arpa`) | `REV_SERVER_CIDR` | + To use these env vars in docker run format style them like: `-e DNS1=1.1.1.1` Here is a rundown of other arguments for your docker-compose / docker run. diff --git a/start.sh b/start.sh index 16b8c79..9e7429f 100755 --- a/start.sh +++ b/start.sh @@ -17,6 +17,10 @@ export INTERFACE export DNSMASQ_LISTENING_BEHAVIOUR="$DNSMASQ_LISTENING" export IPv6 export WEB_PORT +export REV_SERVER +export REV_SERVER_DOMAIN +export REV_SERVER_TARGET +export REV_SERVER_CIDR export CONDITIONAL_FORWARDING export CONDITIONAL_FORWARDING_IP export CONDITIONAL_FORWARDING_DOMAIN @@ -61,10 +65,18 @@ change_setting "IPV6_ADDRESS" "$ServerIPv6" change_setting "DNS_BOGUS_PRIV" "$DNS_BOGUS_PRIV" change_setting "DNS_FQDN_REQUIRED" "$DNS_FQDN_REQUIRED" change_setting "DNSSEC" "$DNSSEC" -change_setting "CONDITIONAL_FORWARDING" "$CONDITIONAL_FORWARDING" -change_setting "CONDITIONAL_FORWARDING_IP" "$CONDITIONAL_FORWARDING_IP" -change_setting "CONDITIONAL_FORWARDING_DOMAIN" "$CONDITIONAL_FORWARDING_DOMAIN" -change_setting "CONDITIONAL_FORWARDING_REVERSE" "$CONDITIONAL_FORWARDING_REVERSE" +change_setting "REV_SERVER"="$REV_SERVER" +change_setting "REV_SERVER_DOMAIN"="$REV_SERVER_DOMAIN" +change_setting "REV_SERVER_TARGET"="$REV_SERVER_TARGET" +change_setting "REV_SERVER_CIDR"="$REV_SERVER_CIDR" +if [ -z "$REV_SERVER" ];then + # If the REV_SERVER* variables are set, then there is no need to add these. + # If it is not set, then adding these variables is fine, and they will be converted by the Pi-hole install script + change_setting "CONDITIONAL_FORWARDING" "$CONDITIONAL_FORWARDING" + change_setting "CONDITIONAL_FORWARDING_IP" "$CONDITIONAL_FORWARDING_IP" + change_setting "CONDITIONAL_FORWARDING_DOMAIN" "$CONDITIONAL_FORWARDING_DOMAIN" + change_setting "CONDITIONAL_FORWARDING_REVERSE" "$CONDITIONAL_FORWARDING_REVERSE" +fi setup_web_port "$WEB_PORT" setup_web_password "$WEBPASSWORD" setup_temp_unit "$TEMPERATUREUNIT"