1
0
Fork 0
mirror of https://github.com/sujiba/pihole-unbound-hyperlocal.git synced 2025-07-10 05:45:14 +02:00

migrate to pi-hole v6 and alpine container image

This commit is contained in:
sujiba 2025-03-22 11:30:15 +00:00
parent 385a54f04d
commit 4b181a8a9f
18 changed files with 237 additions and 280 deletions

View file

@ -1,2 +1,2 @@
# signal FTL to adhere to this limit
edns-packet-max=1232
edns-packet-max=1232

View file

@ -1,34 +1,26 @@
# Get the latest Pi-hole version
FROM pihole/pihole:2024.07.0
FROM pihole/pihole:2025.03.0
# Install necessary programs
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
unbound \
# Install necessary programs without repository caching
RUN apk upgrade --no-cache && \
apk add --no-cache \
unbound \
wget
# Additional configs
# unbound
COPY unbound-pihole.conf /etc/unbound/unbound.conf.d/pihole.conf
COPY unbound-pihole.conf /etc/unbound/unbound.conf.d/pihole.conf
# Set edns packet limit for dnsmasq
COPY 99-edns.conf /etc/dnsmasq.d/99-edns.conf
# Download DNS-Root-Zone.
# Create the chroot directory and generate root.key.
# Copy / move files and change owner.
RUN wget -O root.hints https://www.internic.net/domain/named.root && \
mv root.hints /var/lib/unbound/ && \
chown -R unbound:unbound /var/lib/unbound/root.hints
# Download DNS-Root-Zone and move file
RUN wget -S https://www.internic.net/domain/named.root -O /etc/unbound/root.hints
# Remove unnecessary programs
RUN apt-get remove -y \
wget
# Create unbound log dir
RUN install -o unbound -g unbound -Dm755 -d /var/log/unbound
# Unbound startup script
RUN mkdir -p /etc/services.d/unbound
COPY unbound-run /etc/services.d/unbound/run
RUN chmod ug+x /etc/services.d/unbound/run
# Add unbound start up script
COPY --chmod=0755 unbound-entrypoint.sh /usr/bin/unbound-entrypoint.sh
ENTRYPOINT ./s6-init
ENTRYPOINT ["unbound-entrypoint.sh"]

View file

@ -1,20 +0,0 @@
# Build it yourself
https://docs.docker.com/buildx/working-with-buildx/#work-with-builder-instances
```
# This creates a new builder instance with a single node based on your current configuration.
docker buildx create
# To list all available builders, use
docker buildx ls
# To switch between different builders, use
docker buildx use <name>
# After creating a new instance, you can delete it with
docker buildx rm <name>
```
Build it as a multi-platform image:
```
chmod +x build_and_push.sh
./build_and_push.sh
```

View file

@ -1 +1 @@
2024.07.0
2025.03.0

View file

@ -1,2 +0,0 @@
docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 -t sujiba/pihole-unbound-hyperlocal:`cat VERSION` --push .
docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 -t sujiba/pihole-unbound-hyperlocal:latest --push .

View file

@ -0,0 +1,20 @@
#!/bin/sh
# Start unbound
echo " [i] Starting Unbound"
/usr/sbin/unbound -d -c /etc/unbound/unbound.conf.d/pihole.conf &
# Get most recent process id for error checking
UNBOUND_PID=$!
# Wait for a second and check if unbound is running
sleep 1
if [ -d "/proc/$UNBOUND_PID" ];
then
echo " [i] Unbound started successfully."
else
echo " [i] Unbound startup failed."
echo " [i] Take a look at /var/log/unbound/unbound.log"
fi
# Start pi-hole
exec /usr/bin/start.sh

View file

@ -2,7 +2,7 @@ server:
# https://manpages.debian.org/bullseye/unbound/unbound.conf.5.en.html
#
# If no logfile is specified, syslog is used
# logfile: "/var/log/unbound/unbound.log"
logfile: "/var/log/unbound/unbound.log"
verbosity: 0
interface: 127.0.0.1
@ -11,16 +11,27 @@ server:
do-udp: yes
do-tcp: yes
# Maybe set to yes if you have IPv6 connectivity
do-ip6: no
# Maybe set to no if you don't have IPv6 connectivity
do-ip6: yes
# You want to leave this to no unless you have *native* IPv6. With 6to4 and
# Terredo tunnels your web browser should favor IPv4 for the same reasons
prefer-ip6: no
# if given, user privileges are dropped (after binding port),
# and the given username is assumed. Default is user "unbound".
# If you give "" no privileges are dropped.
username: "unbound"
# Use this only when you downloaded the list of primary root servers!
# If you use the default dns-root-data package, unbound will find it automatically
root-hints: "/var/lib/unbound/root.hints"
root-hints: "/etc/unbound/root.hints"
# File with trusted keys for validation. Specify more than one file
# with several entries, one file per entry.
# Zone file format, with DS and DNSKEY entries.
# Note this gets out of date, use auto-trust-anchor-file please.
trust-anchor-file: "/usr/share/dnssec-root/trusted-key.key"
# Trust glue only if it is within the server's authority
harden-glue: yes
@ -65,7 +76,7 @@ server:
# Ensure kernel buffer is large enough to not lose messages in traffic spikes
so-rcvbuf: 1m
# increase cache size to utilize more RAM
# increase cache size to utilize more RAM | msg * 2 = rrset
msg-cache-size: 128m
rrset-cache-size: 256m
@ -84,5 +95,5 @@ server:
private-address: 169.254.0.0/16
private-address: 172.16.0.0/12
private-address: 10.0.0.0/8
#private-address: fd00::/8
#private-address: fe80::/10
private-address: fd00::/8
private-address: fe80::/10

View file

@ -1,24 +0,0 @@
#!/command/with-contenv bash
s6-echo "Starting unbound"
NAME="unbound"
DESC="DNS server"
DAEMON="/usr/sbin/unbound"
PIDFILE="/run/unbound.pid"
HELPER="/usr/lib/unbound/package-helper"
test -x $DAEMON || exit 0
# Override this variable by editing or creating /etc/default/unbound.
DAEMON_OPTS=""
if [ -f /etc/default/unbound ]; then
. /etc/default/unbound
fi
$HELPER chroot_setup
$HELPER root_trust_anchor_update 2>&1 | logger -p daemon.info -t unbound-anchor
$DAEMON -d $DAEMON_OPTS