Skip to content

Harden entry script and run Unbound unprivileged - #1

Merged
TimInTech merged 3 commits into
mainfrom
refactor/hardening
Sep 13, 2026
Merged

TimInTech merged 3 commits into
mainfrom
refactor/hardening

Conversation

@TimInTech

Copy link
Copy Markdown
Owner

Summary

  • Reusable smoke test (tests/smoke.sh): resolution, DNSSEC, restart, optional unprivileged-start checks
  • Entry script hardened with set -euo pipefail and explicit unbound-anchor result handling (1.0.1)
  • Container starts as user unbound; trust anchor lives in the image instead of root-owned /data (1.1.0)

Test plan

  • CI green on every commit (linter, ShellCheck, amd64/aarch64 build, smoke test)
  • tests/smoke.sh --hardened fails on 1.0.0 and passes on 1.1.0
  • Update on Home Assistant: container user, resolver uid, DNS and DNSSEC through Pi-hole, restart

🤖 Generated with Claude Code

https://claude.ai/code/session_01U8kiCNC4Fjf3vUb6HwLegP

Tim Baumann and others added 3 commits September 13, 2026 11:14
tests/smoke.sh runs the image like the Supervisor does (host network,
root-owned /data volume), checks resolution, DNSSEC and a restart, and
can additionally assert an unprivileged start with --hardened. CI uses
the functional mode for now; ShellCheck also covers the new script.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U8kiCNC4Fjf3vUb6HwLegP
Run with set -euo pipefail and evaluate unbound-anchor explicitly:
it returns 1 after creating or updating the anchor and can return 0
on write errors, so the existence of the anchor file now decides
whether the resolver starts. ShellCheck runs pinned (v0.11.0) with the
busybox dialect, which supports pipefail.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U8kiCNC4Fjf3vUb6HwLegP
The container now starts as user unbound. The Supervisor mounts /data
root-owned on a fresh install, so the trust anchor moves into the image
(/var/lib/unbound, owned by unbound) and is refreshed by unbound-anchor
on start; Unbound no longer needs to setuid, chown or bind below 1024.
CI enforces this with the smoke test in --hardened mode.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U8kiCNC4Fjf3vUb6HwLegP
@TimInTech
TimInTech marked this pull request as ready for review September 13, 2026 09:24
@TimInTech
TimInTech merged commit 07ccc26 into main Sep 13, 2026
4 checks passed
@TimInTech
TimInTech deleted the refactor/hardening branch September 13, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant