| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- # Hardened run template for unbound-sec
- #
- # Security options enabled here:
- # - read_only root filesystem (writable paths via tmpfs)
- # - no-new-privileges (process can't gain privileges via setuid/setgid)
- # - cap_drop ALL (non-root user: no capabilities anyway)
- # - CPU/memory/PID limits (abusive recursive lookups are bounded)
- #
- # Network: NO ports are published. The resolver is meant to run inside a
- # shared Docker network that its clients join (e.g. the Pi-hole network).
- # If you need LAN access, publish on a specific host address only:
- # ports:
- # - "192.168.0.1:5053:5053/udp"
- # - "192.168.0.1:5053:5053/tcp"
- #
- # Usage: docker compose up -d
- name: unbound-sec
- volumes:
- unbound_anchor:
- services:
- unbound:
- image: unbound-sec:latest
- container_name: unbound
- volumes:
- # Drop-ins only: *.conf files here are included by the base config.
- # Kept separate from config/ (the base config source) so the base
- # config is not inside /config — that would be a recursive include.
- # The directory starts empty; add e.g. forward-records.conf.
- - "./conf.d:/config:ro"
- # RFC5011 root trust anchor: persistent across restarts. Initialized
- # once by the entrypoint (from the dnssec-root package); afterwards
- # unbound maintains the file itself (learned keys, rollover state).
- # Named volume -> initialized with the image's /var/unbound ownership
- # (uid 1500), so the non-root user can write to it.
- - "unbound_anchor:/var/unbound"
- read_only: true
- tmpfs:
- - /tmp
- - "/run/unbound:uid=1500,gid=1500"
- security_opt:
- - no-new-privileges:true
- cap_drop:
- - ALL
- deploy:
- resources:
- limits:
- cpus: "1.0"
- memory: 512M
- pids: 100
- restart: always
|