Skip to content

Commit 17f6ef8

Browse files
authored
Merge pull request pi-hole#837 from pi-hole/dev
Release 5.8 - "Third time's the charm" edition
2 parents 68ad7b0 + c9a3ac0 commit 17f6ef8

File tree

8 files changed

+64
-28
lines changed

8 files changed

+64
-28
lines changed

.github/workflows/test-and-build.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
ARCH: [amd64, armhf, arm64]
23+
ARCH: [amd64, armhf, arm64, i386]
2424
DEBIAN_VERSION: [stretch, buster, bullseye]
2525
env:
2626
ARCH: ${{matrix.ARCH}}

README.md

+10-22
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,6 @@ services:
4040

4141
[Here is an equivalent docker run script](https://github.com/pi-hole/docker-pi-hole/blob/master/docker_run.sh).
4242

43-
## Upgrade Notices:
44-
45-
### Docker Pi-Hole v4.2.2
46-
47-
- ServerIP no longer a required environment variable **unless you run network 'host' mode**! Feel free to remove it unless you need it to customize lighttpd
48-
- --cap-add NET_ADMIN no longer required unless using DHCP, leaving in examples for consistency
49-
50-
### Docker Pi-Hole v4.1.1+
51-
52-
Starting with the v4.1.1 release your Pi-hole container may encounter issues starting the DNS service unless ran with the following setting:
53-
54-
- `--dns=127.0.0.1 --dns=1.1.1.1` The second server can be any DNS IP of your choosing, but the **first dns must be 127.0.0.1**
55-
- A WARNING stating "Misconfigured DNS in /etc/resolv.conf" may show in docker logs without this.
56-
- 4.1 required --cap-add NET_ADMIN until 4.2.1-1
57-
58-
These are the raw [docker run cli](https://docs.docker.com/engine/reference/commandline/cli/) versions of the commands. We provide no official support for docker GUIs but the community forums may be able to help if you do not see a place for these settings. Remember, always consult your manual too!
59-
6043
## Overview
6144

6245
#### Renamed from `diginc/pi-hole` to `pihole/pihole`
@@ -84,8 +67,6 @@ Volumes are recommended for persisting data across container re-creations for up
8467

8568
You can customize where to store persistent data by setting the `PIHOLE_BASE` environment variable when invoking `docker_run.sh` (e.g. `PIHOLE_BASE=/opt/pihole-storage ./docker_run.sh`). If `PIHOLE_BASE` is not set, files are stored in your current directory when you invoke the script.
8669

87-
Port 443 is to provide a sinkhole for ads that use SSL. If only port 80 is used, then blocked HTTPS queries will fail to connect to port 443 and may cause long loading times. Rejecting 443 on your firewall can also serve this same purpose. Ubuntu firewall example: `sudo ufw reject https`
88-
8970
**Automatic Ad List Updates** - since the 3.0+ release, `cron` is baked into the container and will grab the newest versions of your lists and flush your logs. **Set your TZ** environment variable to make sure the midnight log rotation syncs up with your timezone's midnight.
9071

9172
## Running DHCP from Docker Pi-Hole
@@ -121,6 +102,14 @@ There are other environment variables if you want to customize various things in
121102
| `WEBUIBOXEDLAYOUT: <boxed\|traditional>`<br/>*Optional Default: boxed* | Use boxed layout (helpful when working on large screens)
122103
| `SKIPGRAVITYONBOOT`: <Not Set\|1><br/> *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.
123104
| `QUERY_LOGGING: <"true"\|"false">`<br/> *Optional* *Default: "true"* | Enable query logging or not.
105+
| `DHCP_ACTIVE: <"true"\|"false">`<br/> *Optional* *Default: "false"* | Enable DHCP server. Static DHCP leases can be configured with a custom `/etc/dnsmasq.d/04-pihole-static-dhcp.conf`
106+
| `DHCP_START: <Start IP>`<br/> *Optional* *Default: Not Set* | Start of the range of IP addresses to hand out by the DHCP server (mandatory if DHCP server is enabled).
107+
| `DHCP_END: <End IP>`<br/> *Optional* *Default: Not Set* | End of the range of IP addresses to hand out by the DHCP server (mandatory if DHCP server is enabled).
108+
| `DHCP_ROUTER: <Router's IP>`<br/> *Optional* *Default: Not Set* | Router (gateway) IP address sent by the DHCP server (mandatory if DHCP server is enabled).
109+
| `DHCP_LEASETIME: <hours>`<br/> *Optional* *Default: 24* | DHCP lease time in hours.
110+
| `PIHOLE_DOMAIN: <domain>`<br/> *Optional* *Default: lan* | Domain name sent by the DHCP server.
111+
| `DHCP_IPv6: <"true"\|"false">`<br/> *Optional* *Default: "false"* | Enable DHCP server IPv6 support (SLAAC + RA).
112+
| `DHCP_rapid_commit <"true"\|"false">`<br/> *Optional* *Default: "false"* | Enable DHCPv4 rapid commit (fast address assignment).
124113

125114
## Deprecated environment variables:
126115
While these may still work, they are likely to be removed in a future version. Where applicible, alternative variable names are indicated. Please review the table above for usage of the alternative variables
@@ -146,7 +135,7 @@ Here is a rundown of other arguments for your docker-compose / docker run.
146135
| `-v $(pwd)/etc-dnsmasq.d:/etc/dnsmasq.d`<br/> **Recommended** | Volumes for your dnsmasq configs help persist changes across docker image updates
147136
| `--net=host`<br/> *Optional* | Alternative to `-p <port>:<port>` arguments (Cannot be used at same time as -p) if you don't run any other web application. DHCP runs best with --net=host, otherwise your router must support dhcp-relay settings.
148137
| `--cap-add=NET_ADMIN`<br/> *Recommended* | Commonly added capability for DHCP, see [Note on Capabilities](#note-on-capabilities) below for other capabilities.
149-
| `--dns=127.0.0.1`<br/> *Recommended* | Sets your container's resolve settings to localhost so it can resolve DHCP hostnames from Pi-hole's DNSMasq, also fixes common resolution errors on container restart.
138+
| `--dns=127.0.0.1`<br/> *Optional* | Sets your container's resolve settings to localhost so it can resolve DHCP hostnames from Pi-hole's DNSMasq, may fix resolution errors on container restart.
150139
| `--dns=1.1.1.1`<br/> *Optional* | Sets a backup server of your choosing in case DNSMasq has problems starting
151140
| `--env-file .env` <br/> *Optional* | File to store environment variables for docker replacing `-e key=value` settings. Here for convenience
152141

@@ -158,8 +147,7 @@ Here is a rundown of other arguments for your docker-compose / docker run.
158147
* Port conflicts? Stop your server's existing DNS / Web services.
159148
* Don't forget to stop your services from auto-starting again after you reboot
160149
* Ubuntu users see below for more detailed information
161-
* Port 80 is highly recommended because if you have another site/service using port 80 by default then the ads may not transform into blank ads correctly. To make sure docker-pi-hole plays nicely with an existing webserver you run you'll probably need a reverse proxy webserver config if you don't have one already. Pi-hole must be the default web app on the proxy e.g. if you go to your host by IP instead of domain then Pi-hole is served out instead of any other sites hosted by the proxy. This is the '[default_server](http://nginx.org/en/docs/http/ngx_http_core_module.html#listen)' in nginx or ['_default_' virtual host](https://httpd.apache.org/docs/2.4/vhosts/examples.html#default) in Apache and is taken advantage of so any undefined ad domain can be directed to your webserver and get a 'blocked' response instead of ads.
162-
* You can still map other ports to Pi-hole port 80 using docker's port forwarding like this `-p 8080:80`, but again the ads won't render properly. Changing the inner port 80 shouldn't be required unless you run docker host networking mode.
150+
* You can map other ports to Pi-hole port 80 using docker's port forwarding like this `-p 8080:80` if you are using the default blocking mode. If you are using the legacy IP blocking mode, you should not remap this port.
163151
* [Here is an example of running with jwilder/proxy](https://github.com/pi-hole/docker-pi-hole/blob/master/docker-compose-jwilder-proxy.yml) (an nginx auto-configuring docker reverse proxy for docker) on my port 80 with Pi-hole on another port. Pi-hole needs to be `DEFAULT_HOST` env in jwilder/proxy and you need to set the matching `VIRTUAL_HOST` for the Pi-hole's container. Please read jwilder/proxy readme for more info if you have trouble.
164152

165153
### Installing on Ubuntu

bash_functions.sh

+17-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ setup_web_password() {
248248

249249
setup_ipv4_ipv6() {
250250
local ip_versions="IPv4 and IPv6"
251-
if [ "$IPv6" != "True" ] ; then
251+
if [ "${IPv6,,}" != "true" ] ; then
252252
ip_versions="IPv4"
253253
sed -i '/use-ipv6.pl/ d' /etc/lighttpd/lighttpd.conf
254254
fi;
@@ -333,3 +333,19 @@ setup_admin_email() {
333333
pihole -a -e "$EMAIL"
334334
fi
335335
}
336+
337+
setup_dhcp() {
338+
if [ -z "${DHCP_START}" ] || [ -z "${DHCP_END}" ] || [ -z "${DHCP_ROUTER}" ]; then
339+
echo "ERROR: Won't enable DHCP server because mandatory Environment variables are missing: DHCP_START, DHCP_END and/or DHCP_ROUTER"
340+
change_setting "DHCP_ACTIVE" "false"
341+
else
342+
change_setting "DHCP_ACTIVE" "${DHCP_ACTIVE}"
343+
change_setting "DHCP_START" "${DHCP_START}"
344+
change_setting "DHCP_END" "${DHCP_END}"
345+
change_setting "DHCP_ROUTER" "${DHCP_ROUTER}"
346+
change_setting "DHCP_LEASETIME" "${DHCP_LEASETIME}"
347+
change_setting "PIHOLE_DOMAIN" "${PIHOLE_DOMAIN}"
348+
change_setting "DHCP_IPv6" "${DHCP_IPv6}"
349+
change_setting "DHCP_rapid_commit" "${DHCP_rapid_commit}"
350+
fi
351+
}

build.yml

+9
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,12 @@ services:
4747
PIHOLE_BASE: multiarch/debian-debootstrap:arm64-${DEBIAN_VERSION:-buster}-slim
4848
PIHOLE_ARCH: arm64
4949
S6_ARCH: aarch64
50+
i386:
51+
image: pihole:${PIHOLE_VERSION}-i386-${DEBIAN_VERSION:-buster}
52+
build:
53+
context: .
54+
args:
55+
<<: *common-args
56+
PIHOLE_BASE: multiarch/debian-debootstrap:i386-${DEBIAN_VERSION:-buster}-slim
57+
PIHOLE_ARCH: i386
58+
S6_ARCH: x86

gh-actions-deploy.sh

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ declare -A annotate_map=(
5353
["armel"]="--arch arm --variant v6"
5454
["armhf"]="--arch arm --variant v7"
5555
["arm64"]="--arch arm64 --variant v8"
56+
["i386"]="--arch 386"
5657
)
5758

5859
mkdir -p ~/.docker

s6/debian-root/etc/cont-init.d/20-start.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ if [ -n "$PYTEST" ]; then
1515
sed -i 's/^gravity_spinup$/#gravity_spinup # DISABLED FOR PYTEST/g' "$(which gravity.sh)"
1616
fi
1717
if [ -z "$SKIPGRAVITYONBOOT" ]; then
18-
gravity.sh
18+
echo '@reboot root PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updateGravity >/var/log/pihole_updateGravity.log || cat /var/log/pihole_updateGravity.log' > /etc/cron.d/gravity-on-boot
1919
else
2020
echo " Skipping Gravity Database Update."
21+
[ ! -e /etc/cron.d/gravity-on-boot ] || rm /etc/cron.d/gravity-on-boot &>/dev/null
2122
fi
2223

2324
# Kill dnsmasq because s6 won't like it if it's running when s6 services start

start.sh

+23-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ export ADMIN_EMAIL
3030
export WEBUIBOXEDLAYOUT
3131
export QUERY_LOGGING
3232
export PIHOLE_DNS_
33+
export DHCP_ACTIVE
34+
export DHCP_START
35+
export DHCP_END
36+
export DHCP_ROUTER
37+
export DHCP_LEASETIME
38+
export PIHOLE_DOMAIN
39+
export DHCP_IPv6
40+
export DHCP_rapid_commit
3341

3442
export adlistFile='/etc/pihole/adlists.list'
3543

@@ -99,10 +107,21 @@ if [ -n "${PIHOLE_DNS_}" ]; then
99107
# Split into an array (delimited by ;)
100108
PIHOLE_DNS_ARR=(${PIHOLE_DNS_//;/ })
101109
count=1
110+
valid_entries=0
102111
for i in "${PIHOLE_DNS_ARR[@]}"; do
103-
change_setting "PIHOLE_DNS_$count" "$i"
104-
((count=count+1))
112+
if valid_ip "$i" || valid_ip6 "$i" ; then
113+
change_setting "PIHOLE_DNS_$count" "$i"
114+
((count=count+1))
115+
((valid_entries=valid_entries+1))
116+
else
117+
echo "Invalid IP detected in PIHOLE_DNS_: ${i}"
118+
fi
105119
done
120+
121+
if [ $valid_entries -eq 0 ]; then
122+
echo "No Valid IPs dectected in PIHOLE_DNS_. Aborting"
123+
exit 1
124+
fi
106125
else
107126
# Environment variable has not been set, but there may be existing values in an existing setupVars.conf
108127
# if this is the case, we do not want to overwrite these with the defaults of 8.8.8.8 and 8.8.4.4
@@ -118,6 +137,8 @@ else
118137
fi
119138
fi
120139

140+
[[ -n "${DHCP_ACTIVE}" && ${DHCP_ACTIVE} == "true" ]] && echo "Setting DHCP server" && setup_dhcp
141+
121142
setup_web_port "$WEB_PORT"
122143
setup_web_password "$WEBPASSWORD"
123144
setup_temp_unit "$TEMPERATUREUNIT"

test/conftest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def DockerPersist(request, persist_test_args, persist_args, persist_image, persi
9191
def entrypoint():
9292
return ''
9393

94-
@pytest.fixture(params=['amd64', 'armhf', 'arm64', 'armel'])
94+
@pytest.fixture(params=['amd64', 'armhf', 'arm64', 'armel', 'i386'])
9595
def arch(request):
9696
return request.param
9797

0 commit comments

Comments
 (0)