coredns: DoT (:853) + DoH (:443) listeners with self-signed cert

- New Corefile snippet (common) shared across plain DNS / DoT / DoH so
  zone-loading + forward + cache stay DRY across all three transports
- scripts/generate-certs.sh: openssl-only self-signed RSA cert with SANs
  for localhost / 127.0.0.1 / ::1 / coredns / dns.local. Idempotent —
  skips regeneration if cert is valid >24h ahead; FORCE=1 to rotate.
- Key chmod is 0644 so the CoreDNS container's nonroot user can read it
  via the bind mount. Acceptable for local dev; production should mount
  real certs with proper UID/GID.
- DOT_PORT=8853, DOH_PORT=8443 (avoids Caddy already-on-443 collision)
- Makefile: `make certs`, `make test-tls`
- All three transports verified end-to-end (dig +tls, dig +https,
  curl with raw RFC 8484 wire format)
This commit is contained in:
Ryan Malloy 2026-05-14 01:12:25 -06:00
parent 1f11c314b9
commit 066ba1892a
6 changed files with 111 additions and 18 deletions

8
.env
View file

@ -8,3 +8,11 @@ COREDNS_IMAGE=coredns/coredns:1.11.3
DNS_PORT=1053
METRICS_PORT=9153
HEALTH_PORT=8080
# DoT (DNS-over-TLS, RFC 7858) — IANA port 853. Host port 8853 to
# stay unprivileged.
DOT_PORT=8853
# DoH (DNS-over-HTTPS, RFC 8484) — typically 443. Host port 8443
# because Caddy already owns 443 on this host.
DOH_PORT=8443