CHANGELOG.md 16 KB

Changelog

All notable changes to this project are documented here.

[0.3.3] - 2026-10-23

Closes the findings of the fourth audit of v0.3.2 (commit e4dfe4a): the GPG pipeline now requires a successful GnuPG exit code before checking the signer fingerprint, and a latent DO-bit field bug in test/cd-check.py is fixed.

Fixed (P3)

  • The GPG pipeline ignored GnuPG's return code. With set -eux, a gpg … | grep … | awk … | grep … pipeline's exit status is that of the last grep; a matching VALIDSIG fingerprint was therefore enough to proceed even if GnuPG itself reported an error. VALIDSIG only means cryptographically valid and can appear alongside expired/revoked-key warnings. Now GnuPG runs as a separate command (its exit code is checked by &&), the status output is stored to a file, and only then is that file checked for the expected signer fingerprint — so a non-zero GnuPG exit (e.g. expired/revoked key, missing public key) fails the build. (Both the unbound and ldns source stages.)
  • test/cd-check.py had the DO bit in the wrong OPT field. The 0x8000 was in the 2-byte CLASS field instead of the OPT record's 4-byte EXTENDED FLAGS field, so the DO bit was not set (verified: AD stayed 0). Fixed to struct.pack(">HHIH", 41, 0, 0x8000, 0) — matching dns-check.py and how unbound interprets the DO bit (verified: AD=1). The file is not used by the current counter-test (which disables the validator via module-config: iterator), so this is a latent bug, not a behavioral change.

[0.3.2] - 2026-10-23

Closes the findings of the third audit of v0.3.1 (commit 678fdbf): the DNSSEC negative test now proves signature rejection (not just a SERVFAIL), probe exit codes distinguish timeouts from execution errors, the GPG signer check uses machine-readable --status-fd output, and the cosign digest comes from the push result.

Fixed (P2)

  • The DNSSEC negative test did not reliably prove rejection of invalid signatures. The old static responder served one packet for every query (only the transaction ID was patched), so a SERVFAIL could come from a failed DNSKEY fetch rather than a signature rejection; and a zone with no parent DS is not per se a validation failure (RFC 4035 5.2 — a proven unsigned delegation is insecure). Now the test uses a controlled zone broken.example with an explicit trust anchor (the zone DNSKEY), so validation is well-defined. It asserts three things:
    1. valid zone → NOERROR + AD (the signature validates);
    2. broken zone (A data modified, same RRSIG) → SERVFAIL (the signature is rejected);
    3. broken zone with validation off (module-config: iterator) → NOERROR — the counter-test that separates signature rejection from a generic resolution failure: the broken answer resolves fine, yet its signature is rejected. The responder now serves the zone DNSKEY (with its RRSIG) so unbound can prime the trust anchor, and selects the A vs. DNSKEY packet by query name. New file: test/cd-check.py.

Fixed (P3)

  • Arbitrary execution errors were classified as "timeout". The probe evaluation treated every non-zero/non-one exit code (e.g. a Docker start error, exit 125) as NOT VERIFIED. Now only exit code 2 is a timeout (NOT VERIFIED); any other unexpected code is reported as an execution error and fails the run, so a broken probe can no longer masquerade as a network hiccup.

Changed

  • GPG signer binding uses --status-fd. The build now extracts the signer fingerprint from GnuPG's machine-readable status output ([GNUPG:] VALIDSIG <fpr> …) instead of parsing the human-readable using … key <fpr> line — more robust against GnuPG locale/version changes.
  • Cosign digest from the push result. build.sh now takes the digest from the docker push output (digest: sha256:…) rather than .RepoDigests[0], which with multiple entries need not be the reference just published. The signature is bound to the exact pushed digest.

[0.3.1] - 2026-10-23

Closes the remaining findings of the post-audit acceptance review of v0.3.0 (commit def097d): test isolation, probe semantics, the DNSSEC negative test, GPG signer binding, and the cosign signing path.

Fixed (P1)

  • Tests could delete a production resolver + its anchor. The cleanup ran docker rm -f unbound and docker compose down --volumes against the fixed project unbound-sec, and the build tagged unbound-sec:latest — all of which a live deployment of the same template on the same daemon would lose. Now: the template has no fixed container_name (named after the compose project), the test runs under a dedicated project unbound-sec-test with a test-image override (test/compose.test.yml pins unbound-sec:test), and cleanup removes only the resources the test created. The production tag unbound-sec:latest is no longer touched by the test run.

Fixed (P2)

  • Security probes passed on real failures. Timeouts and explicit FAIL results of the DNSSEC and CHAOS probes were only warnings — a leaked identity would not have failed the run. The probes now use a three-state exit code: 0=pass, 1=content deviation, 2=timeout. Content deviations fail the run; timeouts are reported as NOT VERIFIED (visible in the result line) and do not mask a real finding.
  • No DNSSEC negative test. Added a controlled zone broken.example served by a static responder: a well-formed RRSIG whose DNSKEY cannot be anchored in the trust chain (no parent DS). The test asserts SERVFAIL (without CD) for www.broken.example A with DO. This catches regressions such as val-permissive-mode: yes, which would keep validating good answers while letting broken ones through. New files: test/make-broken-zone.py, test/broken-zone-responder.py.

Fixed (P3)

  • GPG fingerprint check did not bind the signature to the key. A key file containing the real release key plus a foreign key passed the fingerprint presence check, and gpg --verify could accept a foreign signature. The build now extracts the signer's fingerprint from the gpg --verify output (using … key <FPR> line) and requires it to equal the pinned GNUPG_FINGERPRINT — binding the signature to the expected key (both the unbound and ldns source stages).
  • Optional cosign signing path was broken. cosign sign carried verification-only flags (--certificate-identity-regexp, --certificate-oidc-issuer-regexp) and signed before the image was pushed. build.sh now pushes REGISTRY_IMAGE first, resolves the exact pushed digest, and signs that digest; the identity conditions are documented on the cosign verify side.

Changed

  • Drop-in include moved to top level. The base config's include: "/config/*.conf" was inside the server: block, so drop-ins could only use server: keywords — top-level keywords like forward-zone were ignored. The include is now top-level, so drop-ins may use both server: settings and top-level keywords. (This is what makes the DNSSEC negative test's forward-zone drop-in work.)
  • Negative test is self-contained. The responder and the test unbound run on a dedicated network (ubsec-negnet), not the shared test network, so they are unaffected by the other test containers. The responder's IP is read from its own log (it prints its container IP) with a docker inspect fallback — more reliable than host-side docker inspect, which can be empty while a container is starting on a slow WSL daemon. Any stale .broken-zone.bin (a directory left by a previous mount of a missing file) is removed before zone generation.
  • No # syntax=docker/dockerfile:1 directive. It forced BuildKit to pull the docker/dockerfile:1 frontend image on every build, which failed on offline/WSL builds even with all base images cached. The Dockerfile uses no advanced syntax features, so the built-in frontend suffices and the build now works fully offline from the local image cache.

[0.3.0] - 2026-10-23

Fixes the findings of the external security audit of 2026-10-23 (commit 0fb485d): P1 (recursive include) and all P2 items, plus the P3 items.

Fixed (P1)

  • Recursive config include in the compose template. ./config (containing the base unbound.conf) was mounted to /config, which the base config includes via /config/*.conf — the base config included itself. Drop-ins now live in a separate ./conf.d/ directory mounted to /config; the base config stays baked in at /etc/unbound/. New regression test: the test suite starts the container with the ACTUAL docker-compose.yml (old fixture-based tests couldn't see this bug).

Fixed (P2)

  • RFC5011 anchor state lost on every restart. cp -f reset the root trust anchor to the package state on every start (and it lived on tmpfs in the template). The anchor now lives in a persistent, writable /var/unbound (named volume in the compose template) and is initialized from the dnssec-root package only if no state file exists yet. Learned keys and rollover state survive restarts. New test: anchor content + mtime unchanged across a container restart, AD=1 before and after.
  • Compose template published DNS on all host addresses. ports removed; the template is for a shared internal network (e.g. Pi-hole). LAN access is an explicit opt-in via a comment example publishing on a specific host address.
  • DoT examples without a certificate identity. forward-addr examples now pin the TLS name: 1.1.1.1@853#cloudflare-dns.com (without it, any CA-signed certificate on the path would be accepted).
  • Tests did not prove DNSSEC validation. The AD-bit probe now builds a correct EDNS-0 query (DO bit in the OPT record's EXTFLAGS field, arcount=1); the old probe's 0x0020 was the header AD bit, not DO. Deterministic checks: signed zone + DO -> NOERROR + answers + AD=1; same zone without DO -> AD=0; repeat for stability. The "unsigned zone -> AD=0" check is implemented via the no-DO variant because no stable unsigned public zone is guaranteed (zones get signed over time; dnssec-failed.org timed out during verification).

Added (P3 + audit "weitere Bewertung")

  • private-address extended: 127.0.0.0/8, ::1/128, fc00::/7, fe80::/10 (DNS-rebinding; the old list covered only RFC1918 + link-local IPv4).
  • Resource limits in the compose template: 1 CPU, 512 MB, 100 PIDs (abusive recursive lookups are bounded).
  • GPG release key fingerprint 2310…DF45 pinned in the Dockerfile (ARG GNUPG_FINGERPRINT): the imported key must carry it, otherwise the build fails — the signature now anchors to an independently verified identity, not just to the downloaded key.
  • README: reproducibility claim corrected (APK packages come from the mutable Alpine repository — sources + base images are pinned, the package set is not); cosign verify example fixed (certificate identity = workflow URL, issuer = token endpoint — separate fields).

Verified

  • Full test suite: 27 -> 31 assertions (new: anchor persistence, compose-template start).

[0.2.0] - 2026-10-23

Added (adopted from comparison with mvance/klutchell/madnuttah unbound images)

  • Supply chain: source tarballs (unbound + ldns) verified by SHA256 (pinned in Dockerfile) and GPG signature (NLnet Labs releases key G2) before extraction.
  • Base images pinned by digest (alpine:3.24, tonistiigi/xx:1.9.0) → reproducible builds.
  • Binary hardening: --enable-pie --enable-relro-now.
  • --enable-subnet (EDNS Client Subnet, inactive by default — opt in via config) and --enable-tfo-server --enable-tfo-client (TCP Fast Open).
  • Test suite extended: 19 → 27 assertions (GPG/SHA256 build-log evidence with per-run cache-bust, PIE via ELF e_type of the final binary, compiled feature flags via unbound -V configure line).
  • README: comparison table of the relevant unbound images on Docker Hub, adopted vs. deliberately skipped improvements (DNSCrypt/libsodium, DoH/ nghttp2, DNSTAP/protobuf-c, distroless final stage).

Verified

  • A/B drop-in test (test/ab-dropin.sh): v0.1.0 vs. v0.2.0 side by side with identical config — 7/7: identical resolution, identical DNSSEC AD-bit behavior, identical CHAOS/hide-identity behavior, identical contract (uid 1500, port 5053, healthcheck, /config volume). v0.2.0 is a pure drop-in for v0.1.0: only Dockerfile (build-time integrity, hardening, feature flags) and tests/docs changed; config/, entrypoint.sh, docker-compose.yml are untouched.

Docs

  • README: "References (inspiration, not code)" section — provenance of the adopted ideas (crazymax, mvance, klutchell, madnuttah) with licenses (MIT/MIT/BSD-3/MIT); no verbatim code copied, attribution not legally required, listed for transparency.

Fixed

  • Plain docker build (without --build-arg CACHEBUST) failed with /bin/sh: CACHEBUST: parameter not set because ARG CACHEBUST had no default and the src stages run with set -u. Now ARG CACHEBUST="" — plain builds work, the test suite keeps passing a timestamp to force fresh integrity verification.
  • Source downloads in both src stages now use curl --retry 3 --retry-delay 2 --retry-all-errors --max-time …: build-host DNS can be flaky (observed 2026-10-23: WSL/Windows resolver intermittently failing on nlnetlabs.nl while public resolvers answered in ~30 ms), which aborted builds with curl: (6) Could not resolve host.

[0.1.0] - 2026-10-23

Added

  • Initial project: security-hardened Unbound Docker image as drop-in replacement for crazymax/unbound.
  • Unbound 1.26.2 from source (security release 2026-10-21) on Alpine 3.24, multi-stage xx cross-compile build, multi-arch capable.
  • ldns 1.9.2 with drill for the healthcheck.
  • Non-root user (uid/gid 1500), zero effective capabilities.
  • Base config with DNSSEC root anchor, DoT cert bundle, cachedb module, /config/*.conf drop-in include, hide-identity/hide-version.
  • Hardened docker compose template: read-only root fs, tmpfs, no-new-privileges, cap_drop ALL.
  • Test suite (runs fully inside Docker): build, healthcheck, version, DNS, DNSSEC AD-bit, uid, CapEff, SUID scan, read-only fs, NoNewPrivs, seccomp, hide-identity, drop-in include accept/reject, attack surface.
  • build.sh with cosign keyless signing.

Security fixes (vs. crazymax/unbound:latest audit, 2026-10-22/23)

  • CVE-2026-96405 (Medium, DoS): fixed by Unbound 1.26.2
  • CVE-2026-109125 (Medium, cache poisoning side channel): fixed by 1.26.2
  • CVE-2026-50106 (Medium, DNSSEC island bypass): fixed by 1.26.2
  • CVE-2026-35501 (Low, NSEC island bypass): fixed by 1.26.2
  • CVE-2026-97206 (High, DoQ UAF): fixed by 1.26.2; not reachable in this image anyway (QUIC not compiled)
  • CVE-2026-77214 / CVE-2026-93990 / CVE-2026-102633 (expat): fixed by Alpine 3.24 expat 2.9.0
  • CVE-2026-58055 (nghttp2) + CVE-2026-85091 (zlib): library stack removed (dns-root-hints dropped; Unbound has root servers built in)
  • SUID-root binaries removed (shadow package dropped from runtime)

Verified

  • Trivy 0.76.1 scan of the built image: 0 CVEs (CRITICAL/HIGH/MEDIUM/LOW), vs. 4 HIGH + 4 MEDIUM for crazymax/unbound:latest
  • Full test suite: 19/19 passed (build, healthcheck, version 1.26.2, DNS, DNSSEC AD-bit, uid 1500, CapEff=0, no SUID, read-only root fs, tmpfs run-dir, NoNewPrivs, seccomp, hide-identity + control, drop-in include accept/reject, no curl, no shadow)
  • Image size: 70.4 MB vs. 93.8 MB (crazymax/unbound)