From b796a6685e7b7d0fe053897753b27598e7d126fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Sun, 22 Nov 2026 14:50:16 +0100 Subject: [PATCH] v0.1.1 --- CHANGELOG.md | 14 +++- Cargo.lock | 24 +++--- Cargo.toml | 5 +- KNOWN_ISSUES.md | 16 +++- README.md | 114 ++++++++++++++++++--------- crates/dns-core/src/zonefile.rs | 117 ++++++++++++++++++++++++++++ crates/dns-core/src/zonefile_ext.rs | 30 +++++-- deploy/packaging/debian/control | 4 +- deploy/packaging/nfpm.yaml | 7 +- deploy/systemd/easydns.service | 2 +- docs/deployment.md | 61 ++++++++++++--- docs/operations.md | 10 +-- docs/performance.md | 24 +++--- docs/spec-gaps.md | 111 +++++++++++++------------- docs/testing.md | 4 +- 15 files changed, 390 insertions(+), 153 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index be36bd9..e76fff8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,10 @@ All notable changes follow [Keep a Changelog](https://keepachangelog.com/) and SemVer. -## [Unreleased] +## [0.1.1] – 2026-11-22 + +First public release. Packages (DEB, RPM for RHEL, RPM for SUSE; amd64) are published on +https://repo.linuxiarz.pl; source: https://git.linuxiarz.pl/gru/EasyDNS. ### Changed @@ -55,10 +58,17 @@ All notable changes follow [Keep a Changelog](https://keepachangelog.com/) and S - 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. +- Zone files: a `$TTL` directive in the middle of a file was ignored for following records that had no TTL of their own (they kept the previous record's TTL). Files written by BIND (`rndc sync`, `named-compilezone`) change `$TTL` per block, so migrated zones could be served with wrong TTLs. Records now get the `$TTL` in force at their line (RFC 2308), or the last explicit TTL when the file has no `$TTL`. +- Zone files written after a dynamic update or an API change lost the quoting of TXT and HINFO data (`v=spf1 … -all` became separate strings, DKIM keys were split), and SVCB/HTTPS records got a trailing comma. Character strings are now always quoted and escaped; written files are re-read in tests for every record type. +- A bare `@` in record data (`www CNAME @`, `MX 10 @`) was rejected; it now means the current origin, as in BIND. + +### Packaging + +- Built and signed by repo.linuxiarz.pl for Debian/Ubuntu, RHEL/Alma/Rocky and SUSE: `/usr/bin/easydns` + the EasyDNS Tools, `easydns.service`, block list timer, `/etc/easydns/{config.yaml,root.hints}` as configuration files, examples in `/usr/share/doc/easydns/examples/`. The service is not started on install (port 53 is often in use); on upgrade a running server is restarted only after the new version accepts its configuration. ## [0.1.0] – 2026-11-21 -First functionally complete release of all mandatory roles. +Internal preview, not published. ### Added diff --git a/Cargo.lock b/Cargo.lock index 5cbc769..828b6bc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -359,7 +359,7 @@ dependencies = [ [[package]] name = "dns-api" -version = "0.1.0" +version = "0.1.1" dependencies = [ "axum", "data-encoding", @@ -380,7 +380,7 @@ dependencies = [ [[package]] name = "dns-authoritative" -version = "0.1.0" +version = "0.1.1" dependencies = [ "data-encoding", "dns-config", @@ -396,7 +396,7 @@ dependencies = [ [[package]] name = "dns-cache" -version = "0.1.0" +version = "0.1.1" dependencies = [ "dns-config", "dns-core", @@ -406,7 +406,7 @@ dependencies = [ [[package]] name = "dns-cli" -version = "0.1.0" +version = "0.1.1" dependencies = [ "clap", "clap_complete", @@ -425,7 +425,7 @@ dependencies = [ [[package]] name = "dns-config" -version = "0.1.0" +version = "0.1.1" dependencies = [ "dns-core", "ipnet", @@ -437,7 +437,7 @@ dependencies = [ [[package]] name = "dns-core" -version = "0.1.0" +version = "0.1.1" dependencies = [ "bytes", "data-encoding", @@ -459,7 +459,7 @@ dependencies = [ [[package]] name = "dns-forwarder" -version = "0.1.0" +version = "0.1.1" dependencies = [ "dns-config", "dns-core", @@ -472,7 +472,7 @@ dependencies = [ [[package]] name = "dns-metrics" -version = "0.1.0" +version = "0.1.1" dependencies = [ "tracing", "tracing-subscriber", @@ -480,7 +480,7 @@ dependencies = [ [[package]] name = "dns-policy" -version = "0.1.0" +version = "0.1.1" dependencies = [ "dns-config", "dns-core", @@ -491,7 +491,7 @@ dependencies = [ [[package]] name = "dns-recursive" -version = "0.1.0" +version = "0.1.1" dependencies = [ "dns-authoritative", "dns-cache", @@ -505,7 +505,7 @@ dependencies = [ [[package]] name = "dns-server" -version = "0.1.0" +version = "0.1.1" dependencies = [ "bytes", "data-encoding", @@ -534,7 +534,7 @@ dependencies = [ [[package]] name = "dns-tools" -version = "0.1.0" +version = "0.1.1" dependencies = [ "clap", "data-encoding", diff --git a/Cargo.toml b/Cargo.toml index c5b0a1e..7720d9d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,11 +3,12 @@ resolver = "3" members = ["crates/*"] [workspace.package] -version = "0.1.0" +version = "0.1.1" edition = "2024" rust-version = "1.85" license = "MIT" -repository = "https://example.invalid/easydns" +repository = "https://git.linuxiarz.pl/gru/EasyDNS" +homepage = "https://repo.linuxiarz.pl" authors = ["EasyDNS contributors"] [workspace.dependencies] diff --git a/KNOWN_ISSUES.md b/KNOWN_ISSUES.md index 483cdf0..19c6abd 100644 --- a/KNOWN_ISSUES.md +++ b/KNOWN_ISSUES.md @@ -42,7 +42,15 @@ Items that are **not** implemented are listed explicitly; none of them is faked - Batched `recvmmsg`/`sendmmsg` showed no measurable gain at the low batch sizes the test generator produces; its benefit under real heavy load is expected, not measured. - With `logging.query_log: true` the encoded-answer cache is bypassed (every query is logged), so query logging costs the full per-query path. - Load figures in docs/testing.md come from a 2-vCPU container and are indicative only. -- .deb packages are built with `scripts/build-deb.sh` (Docker); this script, the Docker image, - the CI workflow and ARM64/macOS/Windows builds were not executed in the development - environment of this release. `scripts/e2e.sh` (comparison with BIND tools) was not run either. -- Full list with references to the specification: docs/spec-gaps.md. +- Packages are published for amd64 only (repo.linuxiarz.pl); the Docker image, the CI workflow + and ARM64/musl/macOS/Windows builds are untested. `scripts/e2e.sh` (comparison with BIND tools) + has not been run. +- The default `listen: ["0.0.0.0:53", "[::1]:53"]` fails with "Address already in use" while + systemd-resolved's stub listens on `127.0.0.53:53` (or any other DNS server holds port 53); + see docs/deployment.md ("Port 53 and systemd-resolved"). +- A zone file is rewritten in EasyDNS's own canonical format after a dynamic update or an API + change (absolute names, one record per line, comments not kept). The data is identical; + keep the original if you rely on its layout or comments. +- Non-ASCII bytes in TXT data that are not valid UTF-8 are written as `\DDD` escapes and may be + read back incorrectly by the zone parser (values above 127); valid UTF-8 is written as is. +- Full list of missing and partial features: docs/spec-gaps.md. diff --git a/README.md b/README.md index f8d8154..55648c2 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,13 @@ resolver**, a **Forwarder** and any **Hybrid** combination of them – and comes **EasyDNS Tools**, practical replacements for `dig`, `host`, `nslookup`, `delv`, `named-checkzone`, `named-checkconf` and `dnsperf`. -> Migration from BIND: [docs/migration-from-bind.md](docs/migration-from-bind.md) · Specification gaps: [docs/spec-gaps.md](docs/spec-gaps.md) +> Migration from BIND: [docs/migration-from-bind.md](docs/migration-from-bind.md) · Feature status and gaps: [docs/spec-gaps.md](docs/spec-gaps.md) -## Project status: 0.1.0 – beta, not yet production-certified +## Project status: 0.1.1 – first public release, beta -All mandatory roles from the specification are implemented and covered by automated +All DNS roles listed below are implemented and covered by automated tests (unit, integration with real servers on loopback, DNSSEC chains, DoT/DoH, API, CLI, -robustness – 97 test cases, `cargo clippy -D warnings` clean). **It has not yet been +robustness – 102 test cases, `cargo clippy -D warnings` clean). **It has not yet been verified in production conditions.** Before it can be called production-ready, the items in [Production readiness](#production-readiness) must be completed. Until then use it: @@ -25,6 +25,7 @@ in [Production readiness](#production-readiness) must be completed. Until then u ## Features ### Authoritative – Primary (master) + * BIND-format zone files (`$ORIGIN`, `$TTL`, `$INCLUDE`, parentheses, all common types, DNSKEY/RRSIG/NSEC/NSEC3 and RFC 3597 `\#` generic records) * validation on load: SOA/NS at apex, CNAME conflicts, out-of-zone data, duplicates; lint @@ -45,6 +46,7 @@ in [Production readiness](#production-readiness) must be completed. Until then u automatic re-signing, stable signatures across restarts, `easydns dnssec keygen|ds` ### Authoritative – Secondary (slave) + * any number of zones, several primaries per zone with failover * initial AXFR, IXFR with AXFR fallback, NOTIFY (ACL and/or TSIG) * SOA REFRESH / RETRY / EXPIRE; after EXPIRE the zone answers SERVFAIL, never stale data @@ -53,6 +55,7 @@ in [Production readiness](#production-readiness) must be completed. Until then u * status per zone (serial, source, last/next refresh, expiry, last error) in CLI, API, metrics ### Recursive resolver + * real iteration from the root hints – no upstream resolver needed * bailiwick checks, random IDs and source ports, glueless delegations, CNAME chains * QNAME minimisation (RFC 9156), EDNS(0), UDP→TCP fallback, budgets and timeouts @@ -62,6 +65,7 @@ in [Production readiness](#production-readiness) must be completed. Until then u * recursion only for allowed clients (default: `192.168.0.0/16`, `10.0.0.0/8`, loopback) – no open resolver ### Forwarder and hybrid routing + * upstreams over UDP, TCP, **DoT** (pooled persistent connections) and **DoH** (persistent, multiplexed **HTTP/2**); private CAs; strategies round-robin, fastest, failover, random, priority; health checks and circuit breaker; identical concurrent queries coalesced @@ -71,6 +75,7 @@ in [Production readiness](#production-readiness) must be completed. Until then u * split-horizon **views**, block/allow lists (exact, suffix, wildcard, regex, hosts files) ### Transport and security + * UDP/TCP (SO_REUSEPORT socket group per core), **DNS-over-TLS** and **DNS-over-HTTPS** (GET/POST, **HTTP/2** and HTTP/1.1, h2c behind a proxy) listeners on rustls; certificates reloaded automatically after renewal – guide: [docs/secure-dns.md](docs/secure-dns.md) @@ -80,6 +85,7 @@ in [Production readiness](#production-readiness) must be completed. Until then u malformed packets, hardened systemd unit and non-root container ### Operations + * `config.yaml` (YAML/JSON) with **`include:`** for zone files (`zones.d/*.yaml`), offline validation with file/line errors, precedence CLI > ENV > file * **hot reload** (SIGHUP / CLI / API) with automatic rollback on errors @@ -91,12 +97,14 @@ in [Production readiness](#production-readiness) must be completed. Until then u block lists, root hints, DNSSEC keys, completions, man page – works locally **without generating or passing an API key** (local control token, API on `127.0.0.1:9953`) * one directory for everything: `/etc/easydns` (config, `zones.d/`, `keys.d/`, `data/zones/`) -* packaging: `.deb` built in Docker (`scripts/build-deb.sh`), Dockerfile + compose, - systemd units, install script, developer runner `dev.sh` +* packages for Debian/Ubuntu, RHEL/Alma/Rocky and SUSE from + [repo.linuxiarz.pl](https://repo.linuxiarz.pl), Dockerfile + compose, systemd units, + install script, developer runner `dev.sh` ### EasyDNS Tools + | Short | Long | Replaces | -|---|---|---| +| --- | --- | --- | | `ed` | `easydig` | dig (+short, +trace, +dnssec, +tcp, -x, -y TSIG, AXFR, --json/--yaml, --watch, --compare, --benchmark) | | `eh` | `easyhost` | host | | `ens` | `easynslookup` | nslookup (incl. interactive mode) | @@ -112,20 +120,52 @@ in [Production readiness](#production-readiness) must be completed. Until then u Short names are installed only when they do not collide with existing commands. +## Installation + +Signed packages (amd64) are built from this repository and published on +**[repo.linuxiarz.pl](https://repo.linuxiarz.pl)**. Source code: +[git.linuxiarz.pl/gru/EasyDNS](https://git.linuxiarz.pl/gru/EasyDNS). + +```bash +# Debian / Ubuntu +curl -fsSL https://repo.linuxiarz.pl/repo-key.gpg | sudo gpg --dearmor --yes -o /usr/share/keyrings/linuxiarz.gpg +echo "deb [signed-by=/usr/share/keyrings/linuxiarz.gpg] https://repo.linuxiarz.pl/apt stable main" \ + | sudo tee /etc/apt/sources.list.d/linuxiarz.list +sudo apt update && sudo apt install easydns + +# RHEL / Alma / Rocky +sudo rpm --import https://repo.linuxiarz.pl/repo-key.gpg +sudo curl -fsSL -o /etc/yum.repos.d/linuxiarz.repo https://repo.linuxiarz.pl/linuxiarz.repo +sudo dnf install easydns + +# SUSE / openSUSE +sudo rpm --import https://repo.linuxiarz.pl/repo-key.gpg +sudo zypper addrepo --refresh --gpgcheck https://repo.linuxiarz.pl/suse/x86_64/ linuxiarz +sudo zypper install easydns +``` + +Updates come with the normal `apt upgrade` / `dnf upgrade` / `zypper update`; your +`/etc/easydns` is kept, and a running server is restarted only if the new version accepts +its configuration ([upgrading](docs/deployment.md#upgrading)). Other ways to install +(source, Docker, tarball): [docs/deployment.md](docs/deployment.md). + ## Quick start ```bash -# development (from source, debug build, throw-away state in .dev/) +sudo easydns zone create example.com --ns ns1.example.com=192.0.2.10 --ip 192.0.2.80 +sudo easydns check-config +sudo systemctl enable --now easydns # hybrid: your zones + recursion for the LAN +sudo easydns status # no API key needed +``` + +Port 53 must be free: on hosts with systemd-resolved turn its stub listener off or listen on +concrete addresses ([how](docs/deployment.md#port-53-and-systemd-resolved)); stop dnsmasq or +BIND first. Development from source: + +```bash ./dev.sh run # DNS 127.0.0.1:5353, API :9953, metrics :9090 ./dev.sh q www.example.com # query it with easydig ./dev.sh api /status - -# package -scripts/build-deb.sh --test # .deb built in Docker → dist/ -sudo apt install ./dist/easydns_0.1.0-1_amd64.deb -sudo easydns zone create example.com --ns ns1.example.com=192.0.2.10 --ip 192.0.2.80 -sudo systemctl enable --now easydns # hybrid: your zones + recursion for the LAN -sudo easydns status # no API key needed ``` The installed default ([config/config.yaml](config/config.yaml)): hybrid mode, @@ -142,48 +182,50 @@ TSIG key; keys are optional extras. EasyDNS will be declared production-ready (1.0) when all of the following are done and documented in [docs/testing.md](docs/testing.md): -- [ ] `scripts/e2e.sh` passes against real BIND tools (`dig`, `host`, `nslookup`) -- [ ] interoperability: BIND/Knot/PowerDNS primary → EasyDNS secondary and +* [ ] `scripts/e2e.sh` passes against real BIND tools (`dig`, `host`, `nslookup`) +* [ ] interoperability: BIND/Knot/PowerDNS primary → EasyDNS secondary and EasyDNS primary → BIND secondary (AXFR, IXFR, NOTIFY, TSIG, signed zones) -- [ ] validating resolver tested on the real Internet (DNSSEC test domains, broken chains) -- [ ] 72-hour soak test at sustained load: no growth of memory, tasks or file descriptors -- [ ] `cargo fuzz` campaign (≥ 24 h per target) without findings -- [ ] `.deb` built and installed on Debian 12 / Ubuntu 22.04 & 24.04, amd64 and arm64; +* [ ] validating resolver tested on the real Internet (DNSSEC test domains, broken chains) +* [ ] 72-hour soak test at sustained load: no growth of memory, tasks or file descriptors +* [ ] `cargo fuzz` campaign (≥ 24 h per target) without findings +* [ ] packages installed on Debian 12 / Ubuntu 22.04 & 24.04 / Rocky 9 / openSUSE, amd64 and arm64; systemd hardening verified; upgrade and rollback tested -- [ ] CI running (fmt, clippy, tests, cargo-deny, ARM64, musl) -- [ ] external security review of the parser, TSIG and the API -- [ ] at least one month as an additional secondary / partial resolver in a real network +* [ ] CI running (fmt, clippy, tests, cargo-deny, ARM64, musl) +* [ ] external security review of the parser, TSIG and the API +* [ ] at least one month as an additional secondary / partial resolver in a real network ## Roadmap -**0.2 – verification and hardening** (the list above), plus fixes found on the way. +**0.X – verification and hardening** (the list above), plus fixes found on the way. + +**0.X – performance** ([measurements and estimates vs BIND](docs/performance.md)) -**0.3 – performance** ([estimates vs BIND](docs/performance.md)) -* ✅ done (Unreleased): SO_REUSEPORT socket group per core, sharded cache and rate limiter, query coalescing -* ✅ done (Unreleased): encoded-answer cache with inline UDP fast path (2.2× / 1.65× less CPU per query), - batched `recvmmsg`/`sendmmsg` on Linux, resolver prefetch * multi-core benchmark against BIND: `scripts/bench-vs-bind.sh` (to be run on 8+ cores) * cache-miss path: allocation-free parsing, pre-encoded RRsets * compact zone storage for large zones (faster loading, less memory) * resolver: aggressive NSEC/NSEC3 (RFC 8198) -**0.4 – DNS features** +**0.X – DNS features** + * NSEC3 signing, automated key rollover (ZSK/KSK), CDS/CDNSKEY, RFC 5011 trust anchors * DNAME, `$GENERATE`, Ed448 * RPZ (response policy zones), per-subnet and per-record-type policies, response RRL -* ✅ done (Unreleased): `update-policy`-style DDNS rules, IP-only updates, BIND key files * UPDATE forwarding from secondaries; reading BIND `zone { … }` statements directly * per-view recursion/forwarding policy, catalog zones (RFC 9432) for provisioning secondaries -**0.5 – transports and operations** -* ✅ done (Unreleased): DoH over HTTP/2 (server and client), persistent DoT/DoH upstream - connections, automatic certificate reload +**0.X – transports and operations** + * DNS-over-QUIC (RFC 9250), DoH3, upstream certificate pinning * API: token management endpoints, JWT/mTLS, users; UNIX socket for the CLI * persistent cache, built-in block list scheduler, backup/restore commands -* message translations (i18n), man pages for every tool, `.rpm` packages +* message translations (i18n), man pages for every tool, arm64 packages + +What 0.1.1 already contains (SO_REUSEPORT socket groups, the encoded-answer cache, +prefetch, `update-policy` rules, DoH over HTTP/2, pooled DoT/DoH upstreams, ...) is listed in +the [changelog](CHANGELOG.md). **Later** + * web panel (separate project, on top of the REST API) * database backends (PostgreSQL/SQLite) for very large or multi-tenant deployments * clustering helpers (multi-primary with catalog zones), anycast health integration @@ -251,7 +293,7 @@ restricted permissions, runs unprivileged with `CAP_NET_BIND_SERVICE`. Details: [security](docs/security.md) · [api](docs/api.md) · [cli-tools](docs/cli-tools.md) · [monitoring](docs/monitoring.md) · [deployment](docs/deployment.md) · [troubleshooting](docs/troubleshooting.md) · [testing](docs/testing.md) · -[**migration from BIND**](docs/migration-from-bind.md) · [spec gaps](docs/spec-gaps.md) · +[**migration from BIND**](docs/migration-from-bind.md) · [feature status](docs/spec-gaps.md) · [**operations: master & resolution**](docs/operations.md) · [**zone transfer variants**](docs/zone-transfer-variants.md) · [**performance vs BIND (estimates)**](docs/performance.md) · [**encrypted DNS: DoT/DoH**](docs/secure-dns.md) diff --git a/crates/dns-core/src/zonefile.rs b/crates/dns-core/src/zonefile.rs index 3117601..4c61091 100644 --- a/crates/dns-core/src/zonefile.rs +++ b/crates/dns-core/src/zonefile.rs @@ -66,6 +66,15 @@ pub fn emit(origin: &Name, records: &[Record]) -> String { for r in recs { let data = match &r.data { RData::Unknown { .. } => crate::zonefile_ext::generic_rdata(&r.data).unwrap_or_default(), + // hickory's Display joins TXT strings without quotes, which does not parse back + RData::TXT(t) => t.txt_data.iter().map(|s| quote_character_string(s)).collect::>().join(" "), + RData::HINFO(h) => format!("{} {}", quote_character_string(&h.cpu), quote_character_string(&h.os)), + // hickory prints SvcParam lists with a trailing comma (`alpn=h3,h2,`), which + // other software (e.g. BIND reading a file written here) rejects + RData::SVCB(_) | RData::HTTPS(_) => { + let d = r.data.to_string(); + d.split(' ').map(|p| p.strip_suffix(',').unwrap_or(p)).collect::>().join(" ") + } d => d.to_string(), }; let t = match r.record_type() { @@ -77,6 +86,42 @@ pub fn emit(origin: &Name, records: &[Record]) -> String { s } +/// RFC 1035 §5.1 in quotes: `"` and `\\` escaped, control bytes as +/// `\DDD`. Valid UTF-8 text is written as is (the zone parser reads it back byte-exact; +/// it would misread `\DDD` escapes above 127). +fn quote_character_string(s: &[u8]) -> String { + let mut o = String::with_capacity(s.len() + 2); + o.push('"'); + match std::str::from_utf8(s) { + Ok(text) => { + for c in text.chars() { + match c { + '"' | '\\' => { + o.push('\\'); + o.push(c); + } + c if (c as u32) < 0x20 || c as u32 == 0x7f => o.push_str(&format!("\\{:03}", c as u32)), + c => o.push(c), + } + } + } + Err(_) => { + for &b in s { + match b { + b'"' | b'\\' => { + o.push('\\'); + o.push(b as char); + } + 0x20..=0x7e => o.push(b as char), + _ => o.push_str(&format!("\\{b:03}")), + } + } + } + } + o.push('"'); + o +} + /// Atomically write `contents` to `path` (temp file + fsync + rename + dir fsync). pub fn atomic_write(path: &Path, contents: &[u8]) -> CoreResult<()> { use std::io::Write; @@ -150,9 +195,81 @@ y IN A \# 4 c0000201 assert!(recs.iter().any(|r| r.name.to_string() == "y.example." && r.data.to_string() == "192.0.2.1")); } + #[test] + fn ttl_directive_changes_apply_to_following_records() { + // BIND `named-compilezone -s relative` output: `$TTL` changes mid-file and + // owner-less lines; each record must get the `$TTL` in force at its line. + let origin = Name::from_ascii("example.org.").unwrap(); + let text = "$ORIGIN .\n$TTL 3600\nexample.org IN SOA ns hm 1 2 3 4 5\n$TTL 600\n\ + \t\tNS ns1.example.net.\n$TTL 60\n\t\tA 192.0.2.1\n$ORIGIN example.org.\n\ + www 300 A 192.0.2.2\n\tAAAA 2001:db8::2\n"; + let recs = parse_str(text, &origin, None).unwrap(); + let ttl = |t: RecordType, n: &str| recs.iter().find(|r| r.record_type() == t && r.name.to_string() == n).unwrap().ttl; + assert_eq!(ttl(RecordType::SOA, "example.org."), 3600); + assert_eq!(ttl(RecordType::NS, "example.org."), 600); + assert_eq!(ttl(RecordType::A, "example.org."), 60); + assert_eq!(ttl(RecordType::A, "www.example.org."), 300); + assert_eq!(ttl(RecordType::AAAA, "www.example.org."), 60); + } + + #[test] + fn ttl_without_directive_follows_last_explicit_ttl() { + let origin = Name::from_ascii("example.org.").unwrap(); + let text = "@ 900 IN SOA ns hm 1 2 3 4 5\n IN NS ns1.example.net.\nwww A 192.0.2.1\n"; + let recs = parse_str(text, &origin, None).unwrap(); + assert!(recs.iter().all(|r| r.ttl == 900)); + } + #[test] fn parse_error_is_reported() { let origin = Name::from_ascii("example.com.").unwrap(); assert!(parse_str("@ IN A not-an-ip\n", &origin, None).is_err()); } } + +#[cfg(test)] +#[allow(clippy::unwrap_used)] +mod roundtrip_tests { + use super::*; + + fn roundtrip(src: &str, origin: &str) { + let origin = Name::from_ascii(origin).unwrap(); + let mut a = parse_str(src, &origin, None).unwrap(); + let text = emit(&origin, &a); + let mut b = parse_str(&text, &origin, None).unwrap_or_else(|e| panic!("emitted zone does not parse: {e}\n{text}")); + let key = |r: &Record| format!("{} {} {:?}", r.name, r.record_type(), r.data); + a.sort_by_key(key); + b.sort_by_key(key); + assert!(!text.contains(", ") && !text.contains(",\n"), "trailing comma in SvcParams:\n{text}"); + let only_a: Vec<_> = a.iter().filter(|r| !b.contains(r)).collect(); + let only_b: Vec<_> = b.iter().filter(|r| !a.contains(r)).collect(); + assert!(only_a.is_empty() && only_b.is_empty(), "round trip changed records:\nbefore: {only_a:?}\nafter: {only_b:?}\n{text}"); + } + + #[test] + fn txt_strings_survive_writing() { + roundtrip( + "$TTL 300\n@ SOA ns hm 1 1 1 1 1\n@ NS ns\n@ TXT \"v=spf1 include:_spf.example.net -all\"\n\ + @ TXT \"a\" \"b c\"\nx TXT \"quote \\\"inside\\\" and ; semicolon \\\\ backslash\"\n\ + y TXT \"zażółć gęślą jaźń \\009tab\"\nz TXT \"\"\n\ + dkim._domainkey TXT \"v=DKIM1; k=rsa; \" \"p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA\"\n", + "example.com.", + ); + } + + #[test] + fn other_types_survive_writing() { + roundtrip( + "$TTL 300\n@ SOA ns hm 1 1 1 1 1\n@ NS ns\nns A 192.0.2.1\nns AAAA 2001:db8::1\n@ MX 10 mail\nmail A 192.0.2.2\n\ + www CNAME @\nalias MX 5 @\n_sip._tcp SRV 10 60 5060 sip\nsip A 192.0.2.3\n@ CAA 0 issue \"letsencrypt.org\"\n\ + @ CAA 128 iodef \"mailto:security@example.com\"\nh HINFO \"Intel x86\" \"Linux 6.1\"\n\ + @ NAPTR 100 10 \"U\" \"E2U+sip\" \"!^.*$!sip:info@example.com!\" .\n\ + @ SSHFP 4 2 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\n\ + _443._tcp TLSA 3 1 1 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\n\ + @ HTTPS 1 . alpn=h2,h3 ipv4hint=192.0.2.1,192.0.2.2\nsvc SVCB 1 web.example.com. port=8443\n\ + sub NS ns.sub\nns.sub A 192.0.2.9\nsub DS 12345 13 2 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF\n\ + 4.2.0.192.in-addr.arpa. PTR host.example.com.\n", + "example.com.", + ); + } +} diff --git a/crates/dns-core/src/zonefile_ext.rs b/crates/dns-core/src/zonefile_ext.rs index dfcb333..495940a 100644 --- a/crates/dns-core/src/zonefile_ext.rs +++ b/crates/dns-core/src/zonefile_ext.rs @@ -244,7 +244,10 @@ pub fn extract(text: &str, origin: &Name, default_ttl: u32) -> CoreResult<(Strin let mut origin = origin.clone(); let mut ttl = default_ttl; let mut last_owner: Option = None; - let mut last_ttl: Option = None; + // RFC 2308 / BIND: after a `$TTL` directive, records without a TTL get the + // current `$TTL`; before any `$TTL`, the last explicitly given TTL (RFC 1035). + let mut has_ttl_directive = false; + let mut last_explicit_ttl: Option = None; let mut pass = String::with_capacity(text.len()); let mut extra = Vec::new(); for (ws, toks) in logical_lines(text) { @@ -259,6 +262,7 @@ pub fn extract(text: &str, origin: &Name, default_ttl: u32) -> CoreResult<(Strin "$TTL" => { if let Some(t) = toks.get(1) { ttl = crate::proto::serialize::txt::parse_ttl(t).map_err(|e| CoreError::ZoneFile(e.to_string()))?; + has_ttl_directive = true; } } _ => {} @@ -291,9 +295,15 @@ pub fn extract(text: &str, origin: &Name, default_ttl: u32) -> CoreResult<(Strin let tu = tname.to_ascii_uppercase(); let rd = &toks[i + 1..]; let generic_syntax = rd.first().is_some_and(|t| t == "\\#"); - let record_ttl = rec_ttl.or(if ws { last_ttl } else { None }).unwrap_or(ttl); + let record_ttl = match rec_ttl { + Some(t) => { + last_explicit_ttl = Some(t); + t + } + None if has_ttl_directive => ttl, + None => last_explicit_ttl.unwrap_or(ttl), + }; last_owner = Some(owner.clone()); - last_ttl = Some(record_ttl); let rtype_generic = tu.strip_prefix("TYPE").and_then(|n| n.parse::().ok()).map(RecordType::from); if SPECIAL.contains(&tu.as_str()) || generic_syntax || rtype_generic.is_some() { let data = if generic_syntax { @@ -312,9 +322,17 @@ pub fn extract(text: &str, origin: &Name, default_ttl: u32) -> CoreResult<(Strin extra.push(r); continue; } - // pass through with explicit owner/TTL/class - pass.push_str(&format!("{owner} {record_ttl} {class} ")); - pass.push_str(&toks[i..].join(" ")); + // pass through with explicit owner/TTL/class; a bare `@` in the data (BIND: + // `www CNAME @`, `MX 10 @`) means the current origin, which the parser lacks + pass.push_str(&format!("{owner} {record_ttl} {class} {tname}")); + for t in rd { + pass.push(' '); + if t == "@" { + pass.push_str(&origin.to_string()); + } else { + pass.push_str(t); + } + } pass.push('\n'); } Ok((pass, extra)) diff --git a/deploy/packaging/debian/control b/deploy/packaging/debian/control index db07a03..18c15fc 100644 --- a/deploy/packaging/debian/control +++ b/deploy/packaging/debian/control @@ -1,12 +1,12 @@ Package: easydns Version: @VERSION@ Architecture: @ARCH@ -Maintainer: EasyDNS maintainers +Maintainer: linuxiarz.pl Installed-Size: @SIZE@ Depends: libc6 (>= 2.34), ca-certificates, adduser Section: net Priority: optional -Homepage: https://example.invalid/easydns +Homepage: https://git.linuxiarz.pl/gru/EasyDNS Description: DNS server: primary, secondary, recursive, forwarder, hybrid EasyDNS is an authoritative (primary/secondary with AXFR/IXFR, NOTIFY, TSIG, DNSSEC signing), recursive (iterative, DNSSEC-validating), forwarding and hybrid diff --git a/deploy/packaging/nfpm.yaml b/deploy/packaging/nfpm.yaml index 43548e3..8ac608e 100644 --- a/deploy/packaging/nfpm.yaml +++ b/deploy/packaging/nfpm.yaml @@ -1,11 +1,12 @@ # Build .deb and .rpm with nfpm (https://nfpm.goreleaser.com): -# ARCH=amd64 VERSION=0.1.0 nfpm pkg -f deploy/packaging/nfpm.yaml -p deb -# ARCH=arm64 VERSION=0.1.0 nfpm pkg -f deploy/packaging/nfpm.yaml -p rpm +# ARCH=amd64 VERSION=0.1.1 nfpm pkg -f deploy/packaging/nfpm.yaml -p deb +# ARCH=arm64 VERSION=0.1.1 nfpm pkg -f deploy/packaging/nfpm.yaml -p rpm name: easydns arch: "${ARCH}" platform: linux version: "${VERSION}" -maintainer: "EasyDNS maintainers" +maintainer: "linuxiarz.pl " +homepage: "https://git.linuxiarz.pl/gru/EasyDNS" description: | EasyDNS: authoritative (primary/secondary), recursive, forwarding and hybrid DNS server with DoT/DoH, DNSSEC and the EasyDNS Tools (easydig, easyhost, ...). diff --git a/deploy/systemd/easydns.service b/deploy/systemd/easydns.service index 43786e0..2c16c58 100644 --- a/deploy/systemd/easydns.service +++ b/deploy/systemd/easydns.service @@ -1,6 +1,6 @@ [Unit] Description=EasyDNS server -Documentation=https://example.invalid/easydns/docs +Documentation=https://git.linuxiarz.pl/gru/EasyDNS/src/branch/master/docs After=network-online.target Wants=network-online.target diff --git a/docs/deployment.md b/docs/deployment.md index 2aa2801..34c62a7 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -1,9 +1,33 @@ # Deployment -## After installing the .deb package +## Installing from repo.linuxiarz.pl + +Signed packages for Debian/Ubuntu, RHEL/Alma/Rocky and SUSE (amd64) are built from +https://git.linuxiarz.pl/gru/EasyDNS and published on https://repo.linuxiarz.pl. + +```bash +# Debian / Ubuntu +curl -fsSL https://repo.linuxiarz.pl/repo-key.gpg | sudo gpg --dearmor --yes -o /usr/share/keyrings/linuxiarz.gpg +echo "deb [signed-by=/usr/share/keyrings/linuxiarz.gpg] https://repo.linuxiarz.pl/apt stable main" \ + | sudo tee /etc/apt/sources.list.d/linuxiarz.list +sudo apt update && sudo apt install easydns + +# RHEL / Alma / Rocky +sudo rpm --import https://repo.linuxiarz.pl/repo-key.gpg +sudo curl -fsSL -o /etc/yum.repos.d/linuxiarz.repo https://repo.linuxiarz.pl/linuxiarz.repo +sudo dnf install easydns + +# SUSE / openSUSE +sudo rpm --import https://repo.linuxiarz.pl/repo-key.gpg +sudo zypper addrepo --refresh --gpgcheck https://repo.linuxiarz.pl/suse/x86_64/ linuxiarz +sudo zypper install easydns +``` + +## After installing the package + +The service is not started automatically (port 53 is often in use, see below). ```bash -sudo apt install ./dist/easydns_0.1.0-1_amd64.deb sudo easydns zone create example.com --ns ns1.example.com=192.0.2.10 --ip 192.0.2.80 sudo systemctl enable --now easydns sudo easydns status # no key to generate or pass @@ -12,20 +36,38 @@ easydig @127.0.0.1 example.com SOA +short The package installs the default hybrid configuration (`/etc/easydns/config.yaml`: `0.0.0.0:53` + `[::1]:53`, recursion for `192.168.0.0/16`, `10.0.0.0/8`, `127.0.0.1`), creates `/etc/easydns/{zones.d,keys.d,data/zones}` and the `easydns` user. Layout: -[configuration.md](configuration.md#default-installation-layout). On hosts where -systemd-resolved occupies `127.0.0.53:53` there is no conflict (different address); if -another DNS server listens on `0.0.0.0:53`, stop it or change `server.listen`. +[configuration.md](configuration.md#default-installation-layout). Example configurations +are in `/usr/share/doc/easydns/examples/`. + +### Port 53 and systemd-resolved + +The default `0.0.0.0:53` cannot be bound while another service holds any address on port 53 – +including the `127.0.0.53:53` stub of systemd-resolved (Ubuntu, Fedora, some Debian +installs); the server then stops with `Address already in use`. Either turn the stub off and +let the host use EasyDNS: + +```bash +sudo install -d /etc/systemd/resolved.conf.d +printf '[Resolve]\nDNSStubListener=no\nDNS=127.0.0.1\n' | sudo tee /etc/systemd/resolved.conf.d/easydns.conf +sudo systemctl restart systemd-resolved +sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf +``` + +or list concrete addresses in `server.listen` (for example `["192.0.2.53:53", "127.0.0.1:53"]`), +which do not collide with `127.0.0.53`. dnsmasq, BIND or Unbound on port 53 must be stopped +or moved the same way. Check what holds the port: `sudo ss -lntup 'sport = :53'`. ## Upgrading the package (keeping your configuration) ```bash sudo tar czf /root/easydns-backup-$(date +%F).tgz /etc/easydns # config, zones, keys, data -scripts/build-deb.sh # → dist/easydns__.deb -sudo apt install -o Dpkg::Options::=--force-confold ./dist/easydns_*_amd64.deb +sudo apt update && sudo apt install -o Dpkg::Options::=--force-confold easydns +# RHEL: sudo dnf upgrade easydns SUSE: sudo zypper update easydns ``` * `/etc/easydns/config.yaml` and `root.hints` are conffiles: `--force-confold` keeps your version without asking; the new default is saved next to it as `config.yaml.dpkg-dist` - (without the option dpkg asks – answer **N** to keep yours). + (without the option dpkg asks – answer **N** to keep yours). RPM keeps a modified file and + writes the new default as `config.yaml.rpmnew`. * Files in `zones.d/`, `keys.d/` and `data/` are never touched by the package. * A running server is restarted only if the new version accepts the configuration (`easydns check-config` as the `easydns` user); otherwise the old version keeps @@ -63,8 +105,9 @@ and keep `/etc/easydns/data` on a volume. Multi-arch: 9090 metrics on loopback by default. Do not expose the API, metrics or recursion to the Internet without explicit ACLs and TLS (reverse proxy). -## Packages and archives +## Building packages yourself +The official packages come from repo.linuxiarz.pl (see above). To build locally: `scripts/build-deb.sh [--arch amd64,arm64] [--debian bookworm] [--revision N] [--test]` builds `dist/easydns_-_.deb` entirely inside Docker (`deploy/docker/Dockerfile.deb`, control/maintainer scripts in `deploy/packaging/debian/`); `--test` installs the package in a diff --git a/docs/operations.md b/docs/operations.md index 19b7345..9caa9ef 100644 --- a/docs/operations.md +++ b/docs/operations.md @@ -127,11 +127,11 @@ For each query the server walks this decision list (first match wins): Query `www.example.com A` with an empty cache: ``` -client ──► EasyDNS - ├─► root server (from root hints) "com" ? → referral to com NS + glue - ├─► com server "example.com" ? → referral to example.com NS - └─► example.com server "www.example.com A" → answer (AA) -client ◄── answer (RA=1, AA=0), cached for its TTL +client --> EasyDNS + ├-> root server (from root hints) "com" ? → referral to com NS + glue + ├-> com server "example.com" ? → referral to example.com NS + └-> example.com server "www.example.com A" → answer (AA) +client <-- answer (RA=1, AA=0), cached for its TTL ``` * With **QNAME minimisation** the root only learns `com`, the TLD only `example.com`. * Every response is checked: only records inside the zone of the server that sent them are diff --git a/docs/performance.md b/docs/performance.md index 5e9e72d..cecca73 100644 --- a/docs/performance.md +++ b/docs/performance.md @@ -18,7 +18,7 @@ throughput at low core counts is typically higher than this average. ## Estimated throughput – authoritative, small zone, UDP -| Cores | BIND 9.20 (estimate) | EasyDNS 0.1 (estimate) | EasyDNS / BIND | +| Cores | BIND 9.20 (estimate) | EasyDNS 0.1.0 (estimate) | EasyDNS / BIND | |---|---|---|---| | 1 | 40–70 k QPS | 30–45 k QPS | ~65–75 % | | 2 | 80–130 k | 60–90 k (55 k measured with the load generator sharing the CPUs) | ~70 % | @@ -31,10 +31,10 @@ Why EasyDNS keeps up on small machines but falls behind on large ones: * answers are built per query (no pre-rendered wire answers); * no `recvmmsg`/`sendmmsg` batching (one system call per packet). -The table above describes 0.1.0. See "Changes after 0.1.0" for what has been removed +The table above describes 0.1.0. See "Changes in 0.1.1" for what has been removed from this list and what was measured. -## Changes after 0.1.0 (Unreleased) +## Changes in 0.1.1 | Change | Effect | |---|---| @@ -51,14 +51,14 @@ Measured on the same 2-vCPU container as before (load generator sharing the CPUs | Build | QPS | p99 | RSS | |---|---|---|---| | 0.1.0 | 55 800 – 56 800 | 1.76 – 1.86 ms | 12.0 MB | -| Unreleased, `udp_sockets: 1` | 56 000 – 57 200 | 1.70 – 1.82 ms | 12.7 MB | -| Unreleased, `udp_sockets: 0` (2 sockets) | 59 400 – 60 100 | 1.74 – 1.76 ms | 12.3 MB | +| 0.1.1, `udp_sockets: 1` | 56 000 – 57 200 | 1.70 – 1.82 ms | 12.7 MB | +| 0.1.1, `udp_sockets: 0` (2 sockets) | 59 400 – 60 100 | 1.74 – 1.76 ms | 12.3 MB | That is about +6 % on 2 vCPUs. The changes target many-core machines, which this container cannot show; the multi-core gain is **expected, not measured**. Revised estimates for authoritative UDP (to be confirmed with dnsperf on real hardware): -| Cores | EasyDNS 0.1 (estimate) | Unreleased (estimate) | vs BIND 9.20 | +| Cores | EasyDNS 0.1.0 (estimate) | 0.1.1 (estimate) | vs BIND 9.20 | |---|---|---|---| | 1–2 | 30–90 k | 30–95 k | ~70 % | | 4 | 100–150 k | 120–180 k | ~70 % | @@ -75,7 +75,7 @@ client prefixes in total). Coalescing holds one small waiter per waiting query, At typical real-world loads (a few thousand QPS per server) both are far below their limits; latency at low load is similar (sub-millisecond on a LAN). -## Round 2 (Unreleased): encoded-answer cache, batched UDP, prefetch +## Round 2 (0.1.1): encoded-answer cache, batched UDP, prefetch | Change | What it does | |---|---| @@ -128,16 +128,16 @@ answer cache off. | Workload | Comparison | Reason | |---|---|---| -| Recursive, **cache hit** | 0.1: ~50–70 % of BIND on 1–4 cores, falling behind on more cores. Unreleased: sharded cache, expected to scale with cores | 0.1 had a single-lock cache | -| Recursive, **cache miss** | latency similar (dominated by network RTT); EasyDNS sends more upstream queries (0.1: ~10–30 %; coalescing now removes duplicates for identical concurrent questions) | no prefetch, no aggressive NSEC use (RFC 8198), simpler server selection; coalescing covers whole client questions, not the resolver's internal NS-address lookups | +| Recursive, **cache hit** | 0.1.0: ~50–70 % of BIND on 1–4 cores, falling behind on more cores. 0.1.1: sharded cache, expected to scale with cores | 0.1 had a single-lock cache | +| Recursive, **cache miss** | latency similar (dominated by network RTT); EasyDNS sends more upstream queries (0.1.0: ~10–30 %; coalescing now removes duplicates for identical concurrent questions) | no prefetch, no aggressive NSEC use (RFC 8198), simpler server selection; coalescing covers whole client questions, not the resolver's internal NS-address lookups | | DNSSEC validation | similar per-signature cost (ring); EasyDNS caches zone key states 300 s | key cache with fixed TTL | | Zone transfers (AXFR/IXFR) | comparable for small and medium zones | 16 KiB messages, journal-based IXFR on both sides | | Large zones (≥ 1 M records): load time | EasyDNS ~2–4× slower | text parser + per-record allocation | | Large zones: memory | EasyDNS ~2–3× BIND (≈ 300–500 B/record vs ≈ 150–250 B) | `Record` objects with owned names in hash maps (BIND 9.20: qp-trie) | | Idle memory | EasyDNS ~10–20 MB, BIND ~30–80 MB | small runtime, no preallocated pools | -| DoT | comparable per connection | rustls; TCP_NODELAY fixed (Unreleased: new connection 44 ms → 0.5 ms on loopback) | -| DoH | comparable (Unreleased) | HTTP/2 multiplexing like BIND; 0.1.0 had HTTP/1.1 only | -| Encrypted forwarding (DoT/DoH upstreams) | Unreleased: persistent connections – 0.06 ms (DoT) / 0.13 ms (DoH h2) per query on loopback vs ~0.5 ms with a handshake per query | see [secure-dns.md](secure-dns.md) | +| DoT | comparable per connection | rustls; TCP_NODELAY fixed (0.1.1: new connection 44 ms → 0.5 ms on loopback) | +| DoH | comparable (0.1.1) | HTTP/2 multiplexing like BIND; 0.1.0 had HTTP/1.1 only | +| Encrypted forwarding (DoT/DoH upstreams) | 0.1.1: persistent connections – 0.06 ms (DoT) / 0.13 ms (DoH h2) per query on loopback vs ~0.5 ms with a handshake per query | see [secure-dns.md](secure-dns.md) | | Reload of one changed zone | faster in EasyDNS | only changed zones are re-published (atomic pointer swap); BIND `rndc reload` re-reads all zones | ## Planned improvements (by expected impact) diff --git a/docs/spec-gaps.md b/docs/spec-gaps.md index 12ff3a7..7c152cd 100644 --- a/docs/spec-gaps.md +++ b/docs/spec-gaps.md @@ -1,65 +1,62 @@ -# Specification 1.0 compliance – what is missing (0.1.0 + Unreleased changes, updated 2026-11-22) +# Feature status and known gaps (0.1.1) -Legend: ❌ missing, ⚠️ partial, 🧪 implemented but not verified by running it. -Everything not listed here is implemented and covered by tests (see `docs/testing.md`). +What EasyDNS 0.1.1 does not do yet, does only partly, or has not been verified outside the +automated tests. Everything not listed here is implemented and covered by tests +(see [testing.md](testing.md)). Planned work is in the README roadmap. + +Status: **missing** – not implemented; **partial** – implemented with the limits described; +**untested** – implemented, but not verified by running it in a real environment; +**done** – listed here because it was a gap in an earlier version. ## Features -| § | Requirement | Status | Details | +| Area | Feature | Status | Details | |---|---|---|---| -| 3.1 | multiple listeners with socket re-use, socket limits | ✅ | UDP socket group per address with SO_REUSEPORT (`server.udp_sockets`); one TCP listener per address | -| 3.2 | DNAME | ❌ | not supported by the zone parser or the resolver | -| 3.2 | RFC 3597 | ✅ | in zone files and on the wire | -| 4 | DNSSEC on the primary | ⚠️ | online signing with NSEC; **no NSEC3 signing**; manual key rollover (add/remove key file + reload); no automated KSK/ZSK rollover schedule, no CDS/CDNSKEY | -| 4 | `$GENERATE` in zone files | ❌ | expand beforehand (`named-compilezone`) | -| 5 | secondary forwarding UPDATE to the primary | ❌ | a secondary answers NOTIMP to UPDATE | -| 6 | DNSSEC: automated trust anchor updates (RFC 5011) | ❌ | built-in anchors (KSK-2017, KSK-2024) or a file; updates are manual | -| 6 | DNSSEC: Ed448 | ❌ | zones signed only with Ed448 validate as *insecure* | -| 6 | coalescing of identical in-flight queries | ✅ | client questions are coalesced per route (forwarder pool / recursion); internal resolver lookups are not | -| 7 | conditional forwarding per record type | ❌ | per domain/suffix and per client only | -| 9 | persistent cache across restarts (optional) | ❌ | | -| 9 | separate cache for DNSSEC results | ⚠️ | validated answers use a separate cache key (`dnssec=true`); the validator's zone key cache has a fixed 300 s TTL | -| 10 | block list update schedule | ⚠️ | `easydns blocklists update` + systemd timer; no in-process scheduler | -| 10 | rules by record type | ❌ | blocking works by name and client, not by type | -| 10 | per-client/per-subnet policies | ⚠️ | exemptions (`exempt_clients`) and views for zones; no different block lists per subnet | -| 10 | RPZ | ❌ | not explicitly required; conversion is described in `migration-from-bind.md` | -| 11.2 | DoH over HTTP/2 | ✅ | server: HTTP/2 + HTTP/1.1 (ALPN), h2c behind a proxy; client: persistent multiplexed HTTP/2 with HTTP/1.1 fallback; DoT client pooled | -| 11.3 | DoQ / DoH3 | ❌ (as specified) | architecture prepared, not implemented | -| 12 | response rate limiting (RRL) | ⚠️ | per client (/32, /56) + global with "slip"; no RRL per (qname, response) | -| 12 | memory control | ⚠️ | limits on cache entries, connections, in-flight queries and sizes; no hard RSS limit | -| 12 | API auth: token revocation/rotation | ⚠️ | via configuration change + reload; no endpoint; no JWT/mTLS (optional) | -| 12 | hiding domain names in logs | ⚠️ | client IPs are anonymised; names in the query log are not masked (the query log is off by default) | -| 13 | modular configuration (include) | ✅ | `include: ["zones.d/*.yaml"]` – zones, keys, ACLs, forward zones in separate files (nesting, globs) | -| 13 | hot reload of listeners / TLS / cache size | ⚠️ | need a restart – reported in `restart_required` | -| 14 | users with roles | ⚠️ | tokens with admin/read-only roles; no user accounts | -| 14 | `/api/...` aliases | – | intentionally only `/api/v1` | -| 15 | web panel | ❌ (by decision) | out of scope for the first versions; no `web/` directory | -| 16 | Grafana dashboard export | ✅ | `deploy/grafana/easydns.json` (not tested in Grafana 🧪) | -| 17 | CLI name | ✅ | `easydns` (short `edns`) instead of `mydns` – changed on request | -| 17 | `easydns` over a secure socket | ⚠️ | HTTP API on loopback only; no UNIX socket | -| 18 | man pages and completions for the `e*` tools | ⚠️ | man page + completions only for `easydns`; the tools have `--help` | -| 18.1 | `ed`: `ixfr=SERIAL` syntax, several queries per invocation, `+multiline` | ❌ | `+multiline` is accepted and ignored | -| 18.3 | full nslookup compatibility in `ens` | ⚠️ | the most common arguments and interactive commands | -| 18.10 | install via Cargo, `.deb`, `.rpm`, archives | 🧪 | `cargo install --path crates/dns-cli` works; `.deb` – `scripts/build-deb.sh` (Docker) **not run** in this environment; `.rpm` – nfpm configuration only | -| 19 | `web/`, `benches/`, `tests/` at the repository root | ⚠️ | tests live in `crates/*/tests`, benchmarking is `easybench` + `docs/testing.md`; `benches/` has only a README | -| – | message translations (i18n) | ❌ | messages are English only | +| Listeners | several listeners with socket re-use | done | UDP socket group per address with SO_REUSEPORT (`server.udp_sockets`); one TCP listener per address | +| Zone data | DNAME | missing | not supported by the zone parser or the resolver | +| Zone data | `$GENERATE` in zone files | missing | expand beforehand (`named-compilezone`) | +| Zone data | RFC 3597 unknown types | done | in zone files and on the wire | +| Primary | DNSSEC signing | partial | online signing with NSEC; no NSEC3 signing; manual key rollover (add/remove key file + reload); no automated KSK/ZSK schedule, no CDS/CDNSKEY | +| Secondary | forwarding UPDATE to the primary | missing | a secondary answers NOTIMP to UPDATE | +| Resolver | automated trust anchor updates (RFC 5011) | missing | built-in anchors (KSK-2017, KSK-2024) or a file; updates are manual | +| Resolver | Ed448 | missing | zones signed only with Ed448 validate as insecure | +| Resolver | coalescing of identical in-flight queries | done | client questions are coalesced per route (forwarder pool / recursion); internal resolver lookups are not | +| Resolver | separate cache for DNSSEC results | partial | validated answers use a separate cache key; the validator's zone key cache has a fixed 300 s TTL | +| Cache | persistent cache across restarts | missing | | +| Forwarder | conditional forwarding per record type | missing | per domain/suffix and per client only | +| Forwarder | DoT/DoH upstreams | done | persistent pooled DoT, multiplexed HTTP/2 DoH with HTTP/1.1 fallback | +| Policy | block list update schedule | partial | `easydns blocklists update` + systemd timer; no in-process scheduler | +| Policy | rules by record type | missing | blocking works by name and client, not by type | +| Policy | per-client/per-subnet policies | partial | exemptions (`exempt_clients`) and views for zones; no different block lists per subnet | +| Policy | RPZ | missing | conversion is described in [migration-from-bind.md](migration-from-bind.md) | +| Policy | response rate limiting (RRL) | partial | per client (/32, /56) + global with "slip"; no RRL per (qname, response) | +| Transports | DoH over HTTP/2 | done | server: HTTP/2 + HTTP/1.1 (ALPN), h2c behind a proxy | +| Transports | DoQ / DoH3 | missing | | +| Operations | memory control | partial | limits on cache entries, connections, in-flight queries and sizes; no hard RSS limit | +| Operations | hot reload of listeners / TLS settings / cache size | partial | need a restart, reported in `restart_required` (certificate files themselves are reloaded automatically) | +| Operations | hiding domain names in logs | partial | client IPs are anonymised; names in the query log are not masked (the query log is off by default) | +| Configuration | modular configuration (include) | done | `include: ["zones.d/*.yaml", "keys.d/*.conf"]` – zones, keys, ACLs, forward zones in separate files | +| API | token revocation/rotation | partial | via configuration change + reload; no endpoint; no JWT/mTLS | +| API | users with roles | partial | tokens with admin/read-only roles; no user accounts | +| API | path aliases | by design | only `/api/v1` | +| API | web panel | by design | out of scope for now | +| CLI | access over a UNIX socket | partial | HTTP API on loopback with a local control token; no UNIX socket | +| Tools | man pages and completions for the `e*` tools | partial | man page + completions only for `easydns`; the tools have `--help` | +| Tools | `ed`: `ixfr=SERIAL`, several queries per invocation, `+multiline` | missing | `+multiline` is accepted and ignored | +| Tools | full nslookup compatibility in `ens` | partial | the most common arguments and interactive commands | +| Tools | message translations (i18n) | missing | messages are English only | +| Packaging | DEB / RPM (RHEL) / RPM (SUSE) | done | amd64 packages on [repo.linuxiarz.pl](https://repo.linuxiarz.pl); no arm64 packages yet | -## Verification (what has NOT been run) +## Verification -| § | Requirement | Status | +| Area | What | Status | |---|---|---| -| 20.4 | comparison with real `dig`/`host`/`nslookup` | 🧪 `scripts/e2e.sh` is ready but **has not been run** (no `dig` in the build environment); the `e*` tools are covered by their own integration tests | -| Stage B | "external test secondary" (e.g. BIND) | ❌ interoperability with BIND as secondary/primary has not been tested; primary↔secondary was tested between EasyDNS instances (in one test process; the two-process variant is in `e2e.sh`) | -| 20.5 | cargo-fuzz | 🧪 targets in `fuzz/`, not run; the stable robustness test (30 000 packets) runs with every `cargo test` | -| 20.6 | 10k/50k/100k QPS, long-running test (leaks, tasks, descriptors) | ⚠️ ~54.6k QPS measured for authoritative answers on 2 vCPU; no 100k+ and no soak test; estimates vs BIND in `docs/performance.md` (estimated to stop scaling above ~4–8 cores) | -| 20.7 | CI, ARM64, musl | 🧪 workflow ready (`ci/github-actions-ci.yml` – copy it to `.github/workflows/`), not run; ARM64/musl/macOS/Windows builds not executed | -| 21 | Docker image, compose, systemd | 🧪 files ready, not built or run | -| 11 | DoT/DoH upstreams in the forwarder | ✅ tested end to end (`secure_forwarder_over_dot_and_doh`): plain-DNS client → forwarder → DoT / DoH upstream with a private CA | -| 18.9 | `ewhois` (RDAP/WHOIS) | 🧪 needs the Internet, untested | -| 6 | DNSSEC validation on the real Internet | 🧪 tested against a local signed root→TLD→zone chain; not checked with the real IANA anchors (no network in the test environment) | -| 6 | NSEC3 validation | ⚠️ logic + RFC 5155 test vector unit-tested; no end-to-end test with an NSEC3 zone | - -## Repository - -* No git repository has been initialised on disk (no commits were made – commits only on request). -* `.github/` could not be written remotely – the workflow is in `ci/github-actions-ci.yml`. +| Tools | comparison with real `dig`/`host`/`nslookup` (`scripts/e2e.sh`) | untested; the `e*` tools are covered by their own integration tests | +| Interoperability | BIND as primary/secondary of EasyDNS | partial: zone data of a production BIND setup (10 zones, DDNS with `update-policy` and TSIG) compared record by record after migration; AXFR/IXFR/NOTIFY between BIND and EasyDNS not tested in both directions | +| Robustness | cargo-fuzz | untested: targets in `fuzz/` are not run in CI; the stable robustness test (30 000 packets) runs with every `cargo test` | +| Performance | 100k+ QPS, long-running test (leaks, tasks, descriptors) | partial: ~60k QPS measured for authoritative answers on 2 vCPU; no soak test; estimates vs BIND in [performance.md](performance.md) | +| Builds | CI, ARM64, musl | untested: workflow in `ci/github-actions-ci.yml`; packages are built for x86_64 glibc only | +| Containers | Docker image, compose | untested | +| Tools | `ewhois` (RDAP/WHOIS) | untested (needs the Internet) | +| Resolver | DNSSEC validation on the real Internet | untested: verified against a local signed root -> TLD -> zone chain, not with the real IANA anchors | +| Resolver | NSEC3 validation | partial: logic + RFC 5155 test vector unit-tested; no end-to-end test with an NSEC3 zone | diff --git a/docs/testing.md b/docs/testing.md index 06297df..467623d 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -11,7 +11,7 @@ Linux x86_64 container with 2 vCPUs). | `cargo clippy --workspace --all-targets --all-features -- -D warnings` | pass (0 warnings) | | `cargo test --workspace --all-features` | pass – see counts below | | `cargo build --workspace --release` | pass | -| `./dev.sh e2e` (real `dig`/`host`/`nslookup`, two processes) | **not run yet** – `dig` was not available in the build environment | +| `./dev.sh e2e` (real `dig`/`host`/`nslookup`, two processes) | not run yet | ## Test inventory @@ -42,7 +42,7 @@ Linux x86_64 container with 2 vCPUs). | authoritative A over UDP, unthrottled, 50 workers | 54 595 | 0 % | 0.87 ms | 1.43 ms | 1.89 ms | 13 MB | | fixed 1 000 QPS, 20 workers | 1 000 | 0 % | 0.53 ms | 0.74 ms | 0.90 ms | | -After the SO_REUSEPORT/sharding changes (Unreleased), same setup: 59 400 – 60 100 QPS, +After the SO_REUSEPORT/sharding changes (0.1.1), same setup: 59 400 – 60 100 QPS, p99 1.74 – 1.76 ms, RSS 12.3 MB (two UDP sockets on 2 vCPUs); see docs/performance.md. `tests/performance.rs` checks that a burst of 40 identical cache misses costs one upstream query and that every socket of the UDP group answers.