Tidak Ada Deskripsi

Bob 32de976950 test: fix DNSSEC/identity probes (raw CHAOS query, host paths, tmpfs uid/gid); verify 19/19 green, 0 CVEs 1 bulan lalu
config c78f6f6c30 unbound-sec 0.1.0: hardened Unbound 1.26.2 image, drop-in replacement for crazymax/unbound 1 bulan lalu
test 32de976950 test: fix DNSSEC/identity probes (raw CHAOS query, host paths, tmpfs uid/gid); verify 19/19 green, 0 CVEs 1 bulan lalu
.dockerignore c78f6f6c30 unbound-sec 0.1.0: hardened Unbound 1.26.2 image, drop-in replacement for crazymax/unbound 1 bulan lalu
.gitignore 32de976950 test: fix DNSSEC/identity probes (raw CHAOS query, host paths, tmpfs uid/gid); verify 19/19 green, 0 CVEs 1 bulan lalu
CHANGELOG.md 32de976950 test: fix DNSSEC/identity probes (raw CHAOS query, host paths, tmpfs uid/gid); verify 19/19 green, 0 CVEs 1 bulan lalu
Dockerfile c78f6f6c30 unbound-sec 0.1.0: hardened Unbound 1.26.2 image, drop-in replacement for crazymax/unbound 1 bulan lalu
README.md 32de976950 test: fix DNSSEC/identity probes (raw CHAOS query, host paths, tmpfs uid/gid); verify 19/19 green, 0 CVEs 1 bulan lalu
build.sh c78f6f6c30 unbound-sec 0.1.0: hardened Unbound 1.26.2 image, drop-in replacement for crazymax/unbound 1 bulan lalu
docker-compose.yml 32de976950 test: fix DNSSEC/identity probes (raw CHAOS query, host paths, tmpfs uid/gid); verify 19/19 green, 0 CVEs 1 bulan lalu
entrypoint.sh 32de976950 test: fix DNSSEC/identity probes (raw CHAOS query, host paths, tmpfs uid/gid); verify 19/19 green, 0 CVEs 1 bulan lalu

README.md

unbound-sec

Security-hardened Docker image for Unbound (validating, recursive, caching DNS resolver). Direct drop-in replacement for crazymax/unbound — same port, same /config drop-in mechanism, same healthcheck — with the security findings from the 10/2026 audit of crazymax/unbound:latest fixed.

Why this project

Audit results for crazymax/unbound:latest (Unbound 1.26.1, Alpine 3.24.1, built 2026-09-17):

Finding Severity Fix in this project
Unbound 1.26.1 behind security release 1.26.2 (CVE-2026-96405 Medium DoS, CVE-2026-109125 Medium, CVE-2026-50106 Medium, CVE-2026-35501 Low, CVE-2026-97206 High) Med/High Build Unbound 1.26.2 (CVE-2026-97206 not reachable anyway: DoQ not compiled)
expat 2.8.4: CVE-2026-77214, CVE-2026-93990 (High), CVE-2026-102633 (Medium) High Current Alpine 3.24 expat 2.9.0
nghttp2 1.69.0: CVE-2026-58055 (Medium) Medium curl-stack removed (see below)
zlib 1.3.2: CVE-2026-85091 (Medium) Medium zlib gone with curl-stack
No cosign signatures on image Info build.sh signs with cosign (keyless, GitHub OIDC)
SUID-root binaries (shadow package: passwd, chsh, chfn, chage, expiry, gpasswd) Low shadow removed after user creation — no SUID binaries
NoNewPrivs not set, writable root fs Low compose template: no-new-privileges, read_only + tmpfs
Identity/version leak via CHAOS queries Info hide-identity, hide-version

Key attack-surface reduction: the dns-root-hints package (used by no one in this image — Unbound has root servers built in) pulls in curl, nghttp2, zlib, c-ares, brotli and friends. It is dropped, so the runtime image carries none of that stack.

Features

  • Unbound 1.26.2 compiled from source on Alpine 3.24 (multi-stage, xx cross-compile)
  • ldns 1.9.2 with drill (used by the healthcheck)
  • Non-root user unbound (uid/gid 1500), zero effective capabilities
  • DNSSEC out of the box: root trust anchor from dnssec-root package, auto-trust-anchor-file in writable run-dir (RFC5011 rollover works with read-only root fs)
  • DoT capable (tls-cert-bundle set)
  • cachedb module compiled in (optional Redis auxiliary cache, same as crazymax)
  • Healthcheck: drill -p 5053 unbound.net @127.0.0.1
  • Port 5053/tcp+udp, volume /config (drop-in *.conf include) — identical to crazymax/unbound

Build

./build.sh            # build + cosign keyless sign (GHCR/Hub) — see below
# or plain:
docker build -t unbound-sec:latest .

Run (hardened template)

docker compose up -d

The compose template enables: read_only root fs, tmpfs for /tmp and /run/unbound, no-new-privileges, cap_drop: ALL.

Minimal (no hardening flags, still non-root):

docker run -d -p 5053:5053/udp -p 5053:5053/tcp -v ./config:/config:ro unbound-sec:latest

Configuration

Drop any *.conf file into /config — it is included by the base config (lexicographic order). Examples:

# /config/forward-records.conf — DoT forwarding
forward-zone:
  name: "."
  forward-tls-upstream: yes
  forward-addr: 1.1.1.1@853
  forward-addr: 1.0.0.1@853

# /config/cachedb.conf — Redis auxiliary cache
cachedb:
  backend: "redis"
  secret-seed: "default"
  redis-server-host: redis
  redis-server-port: 6379

Config changes require a container restart. Full reference: unbound.conf(5).

Tests

The whole test suite runs inside Docker (runner = docker:cli container with the socket mounted; all assertions target containers):

./test/run.sh

Covers: build, healthcheck, version pin, DNS resolution, DNSSEC AD-bit verification (raw DO-bit queries), non-root uid, CapEff=0, no SUID binaries, read-only root fs, no-new-privileges, seccomp, hide-identity (with control container proving the identity is revealed when the flag is off), drop-in include (accept + reject), attack surface (no curl, no shadow).

Migrate from crazymax/unbound

- image: crazymax/unbound:latest
+ image: unbound-sec:latest

Port, volume, healthcheck and drop-in config are identical. Add the hardening options from docker-compose.yml (read_only, tmpfs, no-new-privileges, cap_drop).

Signing

build.sh signs the image with cosign in keyless mode (GitHub OIDC token). Verify:

cosign verify --certificate-identity-regexp "https://token.actions.githubusercontent.com" \
  --certificate-oidc-issuer-regexp "https://token.actions.githubusercontent.com" \
  --certificate-github-workflow-repository <owner>/unbound-sec <image>

License

MIT