# syntax=docker/dockerfile:1 # # unbound-sec: security-hardened Unbound Docker image (crazymax/unbound replacement) # # Security deltas vs. crazymax/unbound: # - Unbound 1.26.2 (security release; fixes CVE-2026-97206, CVE-2026-96405, # CVE-2026-109125, CVE-2026-50106, CVE-2026-35501) # - no dns-root-hints package -> no curl/nghttp2/zlib/c-ares/brotli in runtime # (fixes CVE-2026-58055, CVE-2026-85091; unbound has root servers built in) # - current Alpine 3.24 expat 2.9.0 (fixes CVE-2026-77214, CVE-2026-93990, # CVE-2026-102633) # - shadow package removed after user creation -> no SUID-root binaries # - hide-identity / hide-version enabled (no version leak via CHAOS queries) ARG UNBOUND_VERSION=1.26.2 ARG LDNS_VERSION=1.9.2 ARG XX_VERSION=1.9.0 ARG ALPINE_VERSION=3.24 FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx FROM --platform=$BUILDPLATFORM alpine:${ALPINE_VERSION} AS base COPY --from=xx / / RUN apk --update --no-cache add binutils clang curl file make pkgconf tar tree xz FROM base AS base-build ENV XX_CC_PREFER_LINKER=ld ARG TARGETPLATFORM RUN xx-apk --no-cache add gcc g++ expat-dev hiredis hiredis-dev libevent-dev libcap libpcap-dev openssl-dev perl \ && xx-clang --setup-target-triple FROM base AS unbound-src WORKDIR /src/unbound ARG UNBOUND_VERSION RUN curl -sSL "https://unbound.net/downloads/unbound-${UNBOUND_VERSION}.tar.gz" | tar xz --strip 1 FROM base AS ldns-src WORKDIR /src/ldns ARG LDNS_VERSION RUN curl -sSL "https://nlnetlabs.nl/downloads/ldns/ldns-${LDNS_VERSION}.tar.gz" | tar xz --strip 1 FROM base-build AS unbound-build WORKDIR /src/unbound RUN --mount=type=bind,from=unbound-src,source=/src/unbound,target=.,rw <