# TrutzBox — /etc/default/unbound
#
# Read by TWO consumers:
#   * unbound.service        (EnvironmentFile=-/etc/default/unbound)
#   * /etc/resolvconf/update.d/unbound — the hook the Debian `unbound` package
#     ships; it sources this file and honours USE_RESOLVCONF_FORWARDS.
#
# WHY THIS FILE EXISTS (measured 02.09. + 04.09.2026 on trutzbox-arm, trixie,
# unbound 1.22.0-2+deb13u3):
# NetworkManager runs with rc-manager=resolvconf and calls `resolvconf -u` on
# every DNS update (boot, DHCP renew, WAN/WLAN change). run-parts then runs
# that hook, which collects the nameservers from the resolvconf records and
# DROPS every 127.*/::1 entry. Ours is exactly `nameserver 127.0.0.1` and
# nothing else, so the list comes out empty and the hook ends in
#
#       unbound-control -q forward off
#
# unbound loses the DoT forward zone AT RUNTIME. Nothing on disk changes:
# trutz-forward.conf stays valid, unbound-checkconf is happy, unbound keeps
# running, resolution keeps working, and the UI keeps reporting "encrypted" —
# while the box recurses from the root servers IN CLEARTEXT. Measured on the
# ARM box: 98 plaintext :53 queries per minute to 187 authoritative servers,
# zero connections on :853.
#
# On bookworm the very same hook starts with `#!/bin/sh -e`, and its `egrep`
# returns 1 on the empty result, so dash aborts BEFORE unbound-control ever
# runs. That accident is the only reason the x64 fleet still has working DoT.
# The trixie hook dropped the `-e`, and with it the accident — so the x64
# fleet would lose DoT the moment it is upgraded to trixie. This file settles
# the behaviour explicitly and identically on both releases.
#
# Belt and braces: encrypted-dns.sh has a `repair` action that puts the
# runtime forward zone back if anything else ever clears it (boot guard,
# 4 h default timer, package upgrade).
#
# Do NOT set DAEMON_OPTS here — unbound.service passes it straight to
# `unbound -d -p $DAEMON_OPTS`.
USE_RESOLVCONF_FORWARDS=false
