mvance/unbound was last rebuilt 668 days ago. Replaced with
madnuttah/unbound (14 days): distroless, runs unprivileged as non-root,
listens on 5335 by default — exactly the "upstream behind a blocker"
shape — and publishes clean semver tags. klutchell/unbound is equally
fresh but defaults to port 53 (fighting Pi-hole/AdGuard for it) and its
tag namespace is CI build soup.
The shipped config was worse than the stale image. It was not a
recursive resolver at all:
interface: 0.0.0.0@53
forward-addr: 10.100.0.3@53 # "Local AdGuard" — a hardcoded IP
forward-addr: 9.9.9.9@853
So it listened on 53 (conflicting with any blocker on the same host),
forwarded to Quad9 — surrendering the "nobody sees my queries" property
that is the only reason to run Unbound in front of a blocker — and
pointed at AdGuard, inverting the dependency: AdGuard should point HERE.
Replaced with a drop-in at conf.d/libreportal.conf. The image's own
unbound.conf ends with `include-toplevel: conf.d/*.conf`, so ours ADDS
to a working recursive config the image author maintains rather than
replacing it — upstream keeps owning the parts that change between
Unbound releases. It contributes access-control (private ranges allow,
everything else REFUSE, so this can never become an open resolver for
amplification attacks), DNSSEC hardening, rebinding protection, and
cache sizing suited to a small VPS. Forwarding is included commented
out, with the trade stated rather than silently chosen.
Ports corrected to 5335:5335 — the old mapping assumed an image
listening on 53 internally. Added the libreportal.category/title labels
the app was missing (no traefik labels: it has no web interface).
Install hook copies the drop-in and repairs a stub directory first, the
same trap that kept Nextcloud's nginx from starting.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
75 lines
3.1 KiB
Plaintext
75 lines
3.1 KiB
Plaintext
# LibrePortal drop-in for Unbound.
|
|
#
|
|
# Loaded by the image's own unbound.conf via
|
|
# include-toplevel: "/usr/local/unbound/conf.d/*.conf"
|
|
# so this ADDS to the upstream defaults rather than replacing them. That
|
|
# matters: the base config is a working recursive resolver maintained by the
|
|
# image author, and anything we replace wholesale we would then own forever.
|
|
#
|
|
# Recursive by design. Unbound here talks to the root and authoritative
|
|
# servers directly, so no third-party resolver ever sees your queries — that is
|
|
# the entire reason to run it in front of a blocker. If you would rather forward
|
|
# to an encrypted upstream instead, see the forward-zone block at the bottom.
|
|
|
|
server:
|
|
# Listen on all interfaces INSIDE the container; Docker decides what is
|
|
# exposed. The image already runs unprivileged on 5335, which is why this
|
|
# can sit alongside Pi-hole or AdGuard without fighting over port 53.
|
|
interface: 0.0.0.0@5335
|
|
|
|
# Answer only for private networks. Docker's own bridge ranges are included
|
|
# because a query from Pi-hole arrives via the docker gateway, not from the
|
|
# blocker's own address. Everything else is refused: an open resolver on a
|
|
# public IP gets conscripted into DNS amplification attacks within hours.
|
|
access-control: 127.0.0.0/8 allow
|
|
access-control: 10.0.0.0/8 allow
|
|
access-control: 172.16.0.0/12 allow
|
|
access-control: 192.168.0.0/16 allow
|
|
access-control: 0.0.0.0/0 refuse
|
|
|
|
# Validate DNSSEC and refuse to answer if validation fails.
|
|
harden-dnssec-stripped: yes
|
|
harden-glue: yes
|
|
harden-below-nxdomain: yes
|
|
harden-referral-path: yes
|
|
|
|
# Do not leak anything about the resolver or the queries it has seen.
|
|
hide-identity: yes
|
|
hide-version: yes
|
|
qname-minimisation: yes
|
|
rrset-roundrobin: yes
|
|
|
|
# Modest, predictable footprint — this commonly runs on a small VPS
|
|
# alongside everything else, so it is deliberately not tuned for a
|
|
# thousand-client network.
|
|
num-threads: 1
|
|
msg-cache-size: 32m
|
|
rrset-cache-size: 64m
|
|
cache-min-ttl: 300
|
|
cache-max-ttl: 86400
|
|
prefetch: yes
|
|
serve-expired: yes
|
|
|
|
# Private addresses must never be returned for public names (DNS rebinding).
|
|
private-address: 10.0.0.0/8
|
|
private-address: 172.16.0.0/12
|
|
private-address: 192.168.0.0/16
|
|
private-address: 169.254.0.0/16
|
|
private-address: fd00::/8
|
|
private-address: fe80::/10
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# OPTIONAL: forward instead of recurse.
|
|
#
|
|
# Uncommenting this turns Unbound from a recursive resolver into an encrypted
|
|
# forwarder — queries go to Quad9 over TLS rather than to the root servers.
|
|
# That is a real trade: you gain a filtered, fast upstream and you give up the
|
|
# "nobody sees my queries" property that is the point of recursion. Pick one
|
|
# deliberately; do not run both expecting the benefits of each.
|
|
# ---------------------------------------------------------------------------
|
|
#forward-zone:
|
|
# name: "."
|
|
# forward-tls-upstream: yes
|
|
# forward-addr: 9.9.9.9@853#dns.quad9.net
|
|
# forward-addr: 149.112.112.112@853#dns.quad9.net
|