# Deviations from vanilla Unbound 1.26.2 Complete reference of everything this project changes relative to stock Unbound 1.26.2 (NLnet Labs). All stock defaults below were verified against the 1.26.2 source (`util/config_file.c`, `daemon/acl_list.c`, `configure.ac`) on 2026-10-23 — not from memory. Three levels: (1) build/compile, (2) runtime configuration (`config/unbound.conf`), (3) container packaging. ## 1. Build / compile deviations Vanilla `./configure` with no options vs. our Dockerfile build stage: | Flag | Vanilla default | unbound-sec | Why | |---|---|---|---| | `--with-username` | `unbound` (daemon drops to user "unbound" at startup) | `""` (no built-in user) | Container user model (Docker `USER unbound`, uid 1500) replaces it; avoids setuid inside the container | | `--with-chroot-dir` | same as run-dir | `""` (no chroot) | Containers are the isolation boundary; no nested chroot | | `--with-run-dir` | dir part of the config file (`/etc/unbound` for stock layout) | `/var/run/unbound` | explicit, writable run-dir (tmpfs in hardened mode) | | `--with-pidfile` | `run-dir/unbound.pid` | `/var/run/unbound/unbound.pid` | explicit | | `--with-ssl` | off | on (`/usr`) | DoT support (server-side TLS on 5053, TLS upstream) | | `--with-libevent` | off (own epoll loop) | on (`/usr`) | event library from Alpine, consistent with other crazy-max-style builds | | `--with-libhiredis` | off → cachedb module off | on → `--enable-cachedb` | Redis auxiliary cache available (drop-in compatible with crazymax) | | `--with-libexpat` | off (fails build if missing in this version) | on | required by `unbound-anchor` (RFC5011/XML); expat 2.9.0, no open CVEs | | `--enable-event-api` | off | on | experimental pluggable event API header installed (parity) | | `--enable-subnet` | off | on | EDNS Client Subnet support (no extra runtime dependency; adopted from klutchell/mvance/madnuttah images) | | `--enable-tfo-server` | off | on | TCP Fast Open for DNS over TCP (no extra dependency) | | `--enable-tfo-client` | off | on | TCP Fast Open for outgoing queries (no extra dependency) | | `--enable-pie` | off (autodetected) | on | Position-Independent Executable, explicit (adopted from madnuttah) | | `--enable-relro-now` | partial RELRO | full RELRO (bind now) | explicit full relocation binding at load time (adopted from madnuttah) | | `--disable-shared` | shared libs | static | no extra runtime .so dependencies | | `--disable-rpath` | on | off | deterministic linking | | `--disable-flto` | on | off | faster build, negligible runtime difference | Not compiled (vanilla default = off, kept off): DNS-over-QUIC (`--with-quic`, would pull libuv/libnghttp2), DNSCrypt (would pull libsodium), DNSTAP (would pull libprotobuf-c), GeoIP, Python control scripts, libcurl (unbound-anchor uses raw OpenSSL, no curl needed), DoH server mode (`--with-libnghttp2`, would re-add the nghttp2 stack that was deliberately removed). Supply chain (adopted from klutchell + madnuttah images): - source tarballs are verified by **SHA256** (pinned in the Dockerfile) **and GPG signature** (NLnet Labs releases key G2, `nlnetlabs.nl/downloads/keys/releases-g2.asc`) before extraction. The release key's **fingerprint is pinned** (`GNUPG_FINGERPRINT` ARG) and the build **binds the signature to that key**: it extracts the signer's fingerprint from the `gpg --verify` output and requires it to match — so a key file containing the real key plus a foreign key, or a foreign signature, fails the build. - base images are **pinned by digest** (`alpine:3.24@sha256:71e9b7ba…`, `tonistiigi/xx:1.9.0@sha256:c64defb9…`) → reproducible builds Result (verified via `unbound -V` in the built image): `Linked modules: dns64 cachedb subnetcache respip validator iterator`, `TCP Fastopen feature available`, `libevent 2.1.13-stable`, `OpenSSL 3.5.9`. Added on top of Unbound (not part of it): - ldns 1.9.2 with `drill` — used by the image healthcheck - Alpine runtime packages: ca-certificates (DoT cert bundle), dnssec-root (root trust anchor), expat, hiredis, libevent, libpcap, openssl ## 2. Configuration deviations (`config/unbound.conf`) Stock unbound runs with `verbosity 1, port 53, all interfaces, loopback-only ACL, no private-address list, no trust anchor, no TLS, daemonized`. Our base config changes: | Setting | Vanilla default | unbound-sec | Why | |---|---|---|---| | `interface` | all addresses @ 53 | `0.0.0.0@5053` | unprivileged port, drop-in compatible with crazymax/unbound | | `do-ip6` | yes | no | container network is IPv4; shrinks address space | | `do-daemonize` | yes | no | container runs the process in the foreground | | `so-sndbuf` | 4 MB (`4*1024*1024`) | 0 (kernel default) | avoids the "send buffer not granted" warning in containers without raised kernel limits (crazy-max made the same change) | | `access-control` | `127.0.0.0/8 allow` (+ `::1` if do-ip6) | RFC1918 (`10/8`, `172.16/12`, `192.168/16`) + `127/8` | LAN resolver; tighten via `/config` drop-in for larger exposures | | `private-address` | (none) | RFC1918 + `169.254.0.0/16` | internal ranges never leak into answers (vanilla would) | | `module-config` | `validator iterator` | `validator cachedb iterator` | cachedb module active (Redis auxiliary cache on demand) | | `statistics-interval` | 0 (off) | 600 | periodic stats to log | | `statistics-cumulative` | no | yes | stats accumulate across intervals | | `hide-identity` | no | yes | CHAOS `id.server` query returns nothing | | `hide-version` | no | yes | CHAOS `version.server` query returns nothing | | `identity` | (none) | `unbound-sec` | used only when `hide-identity: no` (tested) | | `directory` | run-dir | `/etc/unbound` | config location | | `pidfile` | `run-dir/unbound.pid` | `/run/unbound/unbound.pid` | writable tmpfs in hardened mode | | trust anchor | **none** (validator runs, but nothing is anchored) | `auto-trust-anchor-file: /run/unbound/root.key` (from `dnssec-root` package, copied by entrypoint) | real DNSSEC validation out of the box; RFC5011 rollover works on the writable run-dir | | `tls-cert-bundle` | (none) | `/etc/ssl/certs/ca-certificates.crt` | TLS upstream verification + DoT | | `include` | (none) | `/config/*.conf` (**top-level**, not inside `server:`) | drop-in override mechanism (crazy-max compatible); top-level so drop-ins may use both `server:` settings and top-level keywords (`forward-zone`, `local-zone`, …) | Unchanged from vanilla (explicitly set for clarity): `verbosity: 1`, `do-ip4: yes`, `do-udp: yes`, `do-tcp: yes`, `serve-expired-reply-ttl: 0`, `logfile: ""`. ## 3. Container packaging (vanilla Unbound has none of this) - Alpine 3.24 base, multi-stage xx cross-compile, multi-arch capable - non-root user `unbound` (uid/gid 1500), zero effective capabilities, no SUID binaries in the image - entrypoint: copy static root anchor to writable run-dir, `unbound-checkconf` fail-fast, `exec unbound -d` - healthcheck: `drill -p 5053 unbound.net @127.0.0.1` (30 s interval) - `VOLUME /config`, `EXPOSE 5053/tcp 5053/udp` - hardened compose template: `read_only` root fs, tmpfs `/tmp` + `/run/unbound` (uid/gid 1500), `no-new-privileges`, `cap_drop ALL` - cosign keyless signing via `build.sh` (optional) ## What was deliberately NOT changed - Query behavior stays vanilla: no ratelimits, no prefetch tuning, no `local-zone`/`local-data`, no EDNS changes — a drop-in replacement, not a re-tuned resolver. (ECS/TFO are compiled in but inactive by default; opt in via config when needed.) - `access-control` stays as wide as crazy-max's (RFC1918), to keep migration a one-line change.