fix(pihole): repair Unbound DNS-over-TLS (DoT) forwarding config (#15654)

When the optional Unbound install is chosen with DoT forwarding, the script
truncated (>) /etc/unbound/unbound.conf.d/pi-hole.conf and rewrote it starting
with an indented "tls-cert-bundle:" option that has no "server:" section header.
unbound-checkconf rejects this ("syntax error, is there no section start"), so
"systemctl restart unbound" exits 1 and the install aborts (line 153). The
overwrite also dropped the interface/port 5335 settings Pi-hole forwards to.

Append (>>) the DoT additions to the existing recursive server block instead,
under a proper "server:" section (unbound merges multiple server: clauses), so
the tls-cert-bundle and forward-zone are valid and the resolver keeps listening
on 127.0.0.1:5335. Recursive (non-DoT) mode is unchanged.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
TowyTowy 2026-07-09 03:28:40 +02:00 committed by GitHub
parent f1adfc32d3
commit bfab0dd034
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -119,7 +119,8 @@ edns-packet-max=1232
EOF
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
cat <<EOF >/etc/unbound/unbound.conf.d/pi-hole.conf
cat <<EOF >>/etc/unbound/unbound.conf.d/pi-hole.conf
server:
tls-cert-bundle: "/etc/ssl/certs/ca-certificates.crt"
forward-zone:
name: "."