This commit is contained in:
Mateusz Gruszczyński committed 2026-11-22 14:21:54 +01:00
commit fa432bebda
189 files changed
+26219

No files matched your search

+94
View File
@@ -0,0 +1,94 @@
# Changelog
All notable changes follow [Keep a Changelog](https://keepachangelog.com/) and SemVer.
## [Unreleased]
### Changed
- **Defaults**: hybrid mode listening on `0.0.0.0:53` and `[::1]:53`; recursion allowed for `192.168.0.0/16`, `10.0.0.0/8`, `127.0.0.1/32`, `::1/128`; the installed `/etc/easydns/config.yaml` is a ready hybrid node (previous example moved to `config/hybrid.yaml`).
- **Data directory** of packages, systemd unit and container: `/etc/easydns/data` (was `/var/lib/easydns`). Purging the package no longer deletes it.
- **Zone `file:` paths are relative to `data_dir`** (`file: zones/example.com.zone` → `/etc/easydns/data/zones/example.com.zone`); old configs with paths relative to the config directory still load. Secondary copies default to `<data_dir>/zones/secondary/`.
- **TSIG keys are optional everywhere**: examples, docs and `zone create` use IP ACLs; `check-config` no longer warns about secondaries without TSIG or update keys without an ACL.
- **API** default listener `127.0.0.1:9953` (was 8080). The server creates a local admin token (`<data_dir>/control.token`, 0640) that the CLI reads automatically – no key to generate or pass locally (`api.local_token`).
- DoH server rewritten on hyper: **HTTP/2** and HTTP/1.1 (ALPN), h2c behind a proxy, 100 streams per connection, body size/time limits.
- `[::]` listeners are IPv6-only (as in BIND), so `0.0.0.0:53` and `[::]:53` can be configured together; TCP listeners use SO_REUSEADDR.
- The server CLI is now `easydns` (short alias `edns`) instead of `mydns`.
- UDP: N sockets per listen address with SO_REUSEPORT (`server.udp_sockets`, default one per CPU, max 16), each with its own receive loop; `server.max_inflight` is now one server-wide limit. Socket buffers of 1 MiB are requested.
- Cache split into 16 independently locked shards; records are copied outside the lock.
- Rate limiter: client buckets in 16 shards, lock-free global limit (GCRA).
- **Default `rate_limit.global_qps` is now 0 (no server-wide cap)**; it was 100 000, which limited every server to 100 k QPS. Set it explicitly to keep a cap.
- Reload reports `server.udp_sockets`/`max_inflight` changes as requiring a restart.
### Added
- **Encoded-answer cache** (`cache.answer_entries`, default 20 000; `cache.answer_max_age`): repeated queries are answered by copying stored response bytes (ID, question case and TTLs patched); UDP hits are served inline in the receive loop. Key includes the client profile (view, recursion ACL, block-list exemption, client-specific forward rules, transport); TSIG queries are never cached; zone changes, expiry, reloads and cache flushes invalidate it immediately. Measured: 2.2× less server CPU per query for repeated names and for cached forwarder answers, 1.65× for a realistic authoritative mix. Metrics `dns_answer_cache_*`.
- Batched UDP receive/send on Linux (`recvmmsg`/`sendmmsg`, 32 packets per call) through `nix`'s safe wrappers; other systems keep one call per packet.
- Resolver **prefetch** (`cache.prefetch`, default on): popular entries are refreshed in the background shortly before expiry (recursion and forwarding); metric `dns_cache_prefetches_total`.
- `scripts/bench-vs-bind.sh`: EasyDNS vs BIND on the same machine and cores with dnsperf (zone, query mix and report generated).
- `easydns zone create` (alias of `zones create`): minimal valid zone (SOA, NS, glue, apex addresses) in `<data_dir>/zones/` plus its `zones.d/` definition; `--allow-transfer`, `--notify`, `--allow-update`, `--dry-run`, `--reload`.
- RFC 2136 without keys: `update_acl` (alias `allow_update`) alone authorises updates by source address (BIND `allow-update { IPs; }`).
- `update_policy`: BIND `update-policy` rules (`grant|deny <key> name|subdomain|wildcard|zonesub|self|selfsub [name] [types]`), as strings or mappings; first match decides.
- BIND key files (`key "…" { algorithm …; secret "…"; };`) can be included unchanged; default config includes `keys.d/*.conf`.
- Persistent encrypted upstreams: DoT connection pool and multiplexed HTTP/2 DoH client (HTTP/1.1 fallback); `upstreams.tls_ca_file` for private CAs.
- TLS certificates (DoT/DoH) are re-read within 60 s after the files change; a broken pair is rejected and the old one kept.
- `edoh --http2`.
- Docs: step-by-step DNSSEC guide (key, signing, checks, DS/DNSKEY for the registrar, verification, rollover, safe disabling) in `docs/dnssec.md`; DNSSEC keys kept under `/etc/easydns/data/keys/`.
- Docs: `docs/secure-dns.md` (DoT/DoH server and secure forwarder), RFC 2136 section with a BIND translation in `docs/primary.md`, default installation layout.
- Tests: update policy + BIND key file + IP-only updates, BIND key parser, update rule parser, zone create, DoH HTTP/2 with 50 concurrent queries, DoT pool reuse, secure forwarder over DoT and DoH, certificate reload.
- Coalescing of identical in-flight resolutions (forwarder and recursion): concurrent cache misses for the same question share one upstream query.
- Tests: socket group, coalescing (burst of 40 → 1 upstream query, cancelled leader), cache sharding and concurrency, rate limiter bounds.
- `.gitignore` covering build output, packages, runtime state, secrets, editors and OS files.
- `include:` in the configuration: zone definitions, keys, ACLs and forward zones in separate files (`zones.d/*.yaml`).
- Docs: zone transfer variants (with/without TSIG), operations guide (master, name resolution), performance estimates vs BIND.
- `scripts/build-deb.sh` + `deploy/docker/Dockerfile.deb`: .deb packages built in Docker into `dist/`.
- `dev.sh`: developer runner (dev node, secondary, DNSSEC variant, queries, API, checks, e2e).
- `docs/migration-from-bind.md`, `docs/spec-gaps.md`.
### Fixed
- Upgrades: secondary zone copies kept by older versions in `<data_dir>/secondary/` are moved to `<data_dir>/zones/secondary/` on start, so `file: null` secondaries keep serving from their local copy instead of transferring again.
- Package upgrade restarts a running server only after the new version accepted the configuration (checked as the `easydns` user); previously the old binary kept running until a manual restart.
- Zone `file:` paths with `..` relative to `data_dir` failed while the data directory did not exist yet; paths are now normalised lexically.
- `easydns dnssec keygen`: key directory created 0700 and key file created 0600 from the start (it was briefly readable before `chmod`); when run as root both are owned by the data directory's owner (`easydns`), so the service can read the key.
- One-shot commands and tools no longer panic when their output pipe is closed early (`easydns … | head`); they exit with status 141 like classic Unix tools.
- DoT listener: TCP_NODELAY was not set, so every new DoT connection waited ~40 ms on delayed ACKs during the TLS handshake (measured 44 ms → 0.5 ms).
- DoH: a request announcing an oversized body could keep the connection waiting; it is now rejected at once (413) and the connection closed.
- `0.0.0.0:53` together with `[::]:53` failed with "address in use" on Linux.
## [0.1.0] – 2026-11-21
First functionally complete release of all mandatory roles.
### Added
- Workspace with crates `dns-core`, `dns-config`, `dns-authoritative`, `dns-recursive`,
`dns-forwarder`, `dns-cache`, `dns-policy`, `dns-server`, `dns-api`, `dns-metrics`,
`dns-cli` (`easydns`) and `dns-tools`.
- Primary: BIND zone files, wildcard (RFC 4592), delegations and glue, empty non-terminals,
CNAME chains, AXFR, IXFR with persistent journal and AXFR-style fallback, NOTIFY with
retries, TSIG (RFC 8945, multi-message), transfer ACLs, RFC 2136 dynamic updates with
TSIG + ACL and audit log, atomic zone publication, serial strategies (increment/unixtime/date).
- Secondary: initial AXFR, IXFR with AXFR fallback, NOTIFY handling with ACL/TSIG, SOA
REFRESH/RETRY/EXPIRE timers, RFC 1982 serial arithmetic, persistent snapshot with atomic
replace, restart recovery, SERVFAIL after EXPIRE, transfer history.
- Recursive resolver: iterative resolution from root hints, bailiwick filtering, glueless
delegations, QNAME minimisation with fallback, budgets (queries, depth, CNAME chain,
deadline), server RTT tracking/back-off, RFC 2308 negative caching, serve-stale (opt-in).
- DNSSEC: online signing of primary zones (NSEC chain, Ed25519/ECDSA P-256/P-384, KSK/ZSK/CSK,
automatic re-signing, persisted signed zone), validating resolver (chain of trust from the
IANA root KSKs or configured anchors, NSEC and NSEC3 denial proofs, CD bit, AD bit).
- Forwarder: pools with round-robin/fastest/failover/random/priority, circuit breaker,
health checks, UDP/TCP/DoT/DoH upstreams, conditional forwarding per domain/client.
- Hybrid routing with per-route cache namespaces, split-horizon views, local-only names
(RFC 6761/6303), block/allow lists (exact, suffix, wildcard, bounded regex, hosts format).
- DoT and DoH (GET/POST) listeners; per-client and global rate limiting with RRL-style slip.
- REST API `/api/v1` with bearer tokens (admin/read-only), ETag/If-Match, pagination,
audit trail, OpenAPI document; `/metrics` in Prometheus format; hot reload with rollback
(SIGHUP or API); configuration precedence CLI > ENV > file > defaults.
- Tools: ed/easydig, eh/easyhost, ens/easynslookup, etrace, ednssec, eptr, ezone, econf,
ebench, ewhois, edoh, edot, ediff; shell completions and man page for `easydns`.
- Zone file pre-processor for DNSKEY/RRSIG/NSEC/NSEC3/NSEC3PARAM and RFC 3597 generic types.
- Deployment: Dockerfile, compose, hardened systemd unit, nfpm (.deb/.rpm) packaging,
install script with name-collision checks, CI workflow (fmt, clippy, tests, ARM64, musl,
macOS/Windows tools, cargo-deny), fuzz targets and a stable robustness test.