v0.1.0
This commit is contained in:
commit
fa432bebda
189 files changed
+26219
No files matched your search
@@ -0,0 +1,271 @@
|
||||
# EasyDNS
|
||||
|
||||
**EasyDNS** is a self-hosted DNS server for Linux written in Rust. One binary covers every
|
||||
DNS role – authoritative **Primary** and **Secondary**, an iterative validating **Recursive
|
||||
resolver**, a **Forwarder** and any **Hybrid** combination of them – and comes with the
|
||||
**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)
|
||||
|
||||
## Project status: 0.1.0 – beta, not yet production-certified
|
||||
|
||||
All mandatory roles from the specification 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
|
||||
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:
|
||||
|
||||
* in labs, staging and internal networks;
|
||||
* in production **next to** an existing DNS server (extra secondary, a resolver for part of
|
||||
the clients) with a rollback path;
|
||||
* not as the only authoritative server of an important zone, and not as the only resolver
|
||||
of a network.
|
||||
|
||||
## 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
|
||||
warnings (missing glue, MX/NS → CNAME, SOA timers)
|
||||
* wildcards (RFC 4592), empty non-terminals, delegations with glue, DS at the cut,
|
||||
additional-section processing, negative answers with SOA (RFC 2308)
|
||||
* **atomic publication** – a query never sees a half-applied change
|
||||
* AXFR, **IXFR** from a persistent journal with AXFR-style fallback, **NOTIFY** with retries
|
||||
* transfers authorised by **IP ACL** (default, no key needed) with optional **TSIG**
|
||||
(HMAC-SHA256/384/512, multi-message verification) – any combination
|
||||
* **Dynamic DNS** (RFC 2136): by source IP without keys (BIND `allow-update`), by key, or
|
||||
per-record **`update_policy`** rules in BIND syntax (`grant key zonesub TXT`, `name`,
|
||||
`subdomain`, `wildcard`, `self`, `selfsub`); prerequisites, audit log
|
||||
* **BIND key files** (`key "…" { algorithm …; secret "…"; };`) included unchanged
|
||||
* `easydns zone create` – a valid minimal zone (SOA, NS, glue) and its definition in one command
|
||||
* serial strategies: increment, unixtime, date (RFC 1982 arithmetic everywhere)
|
||||
* **online DNSSEC signing**: Ed25519 / ECDSA P-256/P-384, KSK/ZSK/CSK, NSEC chain,
|
||||
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
|
||||
* complete validation of every transfer before an atomic swap; persistent snapshot,
|
||||
restart without the primary; chaining (secondary of a secondary)
|
||||
* 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
|
||||
* positive and negative cache (RFC 2308) with LRU bound, TTL clamping, optional serve-stale
|
||||
* **DNSSEC validation**: chain of trust from the IANA root KSKs (or own anchors),
|
||||
NSEC and NSEC3 proofs, secure / insecure / bogus / indeterminate, AD and CD bits
|
||||
* 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
|
||||
* conditional forwarding per domain (and per client network), fallback to recursion
|
||||
* hybrid: local zones → policy → forward zones → recursion/forwarding, with separate cache
|
||||
namespaces; private names never leak to the Internet (RFC 6761/6303 local-only names)
|
||||
* 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)
|
||||
* per-client and optional global rate limiting with RRL-style slip, connection and in-flight limits
|
||||
* secure defaults: no open recursion, transfers denied by default, API/metrics on loopback,
|
||||
secrets only as `env:`/`file:` references, no `unsafe`, robustness test with 30 000
|
||||
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
|
||||
* **REST API** `/api/v1`: zones, records (ETag/If-Match), NOTIFY/sync, transfers, cache,
|
||||
upstreams, policies, block lists, reload, audit, OpenAPI; admin and read-only tokens
|
||||
* **Prometheus** metrics (low cardinality), JSON logs, optional privacy-friendly query log,
|
||||
audit log, Grafana dashboard
|
||||
* `easydns` / `edns` CLI: run, check-config, status, zone create, zones, cache, upstreams,
|
||||
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`
|
||||
|
||||
### 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) |
|
||||
| `etrace` | `easytrace` | dig +trace |
|
||||
| `ednssec` | `easydnssec` | delv |
|
||||
| `eptr` | `easyptr` | dig -x (+ forward-confirmed check) |
|
||||
| `ezone` | `easyzone` | named-checkzone |
|
||||
| `econf` | `easyconf` | named-checkconf |
|
||||
| `ebench` | `easybench` | dnsperf |
|
||||
| `ewhois` | `easywhois` | whois (RDAP first) |
|
||||
| `edoh` / `edot` | `easydoh` / `easydot` | DoH / DoT diagnostics |
|
||||
| `ediff` | `easydiff` | compare resolvers (order-insensitive) |
|
||||
|
||||
Short names are installed only when they do not collide with existing commands.
|
||||
|
||||
## Quick start
|
||||
|
||||
```bash
|
||||
# development (from source, debug build, throw-away state in .dev/)
|
||||
./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,
|
||||
`0.0.0.0:53` + `[::1]:53`, recursion for `acl:lan`, zones in `/etc/easydns/data/zones/`,
|
||||
definitions in `/etc/easydns/zones.d/`, BIND key files in `/etc/easydns/keys.d/`.
|
||||
|
||||
Example configurations: [primary](config/primary.yaml), [secondary](config/secondary.yaml),
|
||||
[resolver](config/resolver.yaml), [forwarder](config/forwarder.yaml),
|
||||
[hybrid example](config/hybrid.yaml) with [zones.d](config/zones.d/). None of them needs a
|
||||
TSIG key; keys are optional extras.
|
||||
|
||||
## Production readiness
|
||||
|
||||
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
|
||||
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;
|
||||
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
|
||||
|
||||
## Roadmap
|
||||
|
||||
**0.2 – verification and hardening** (the list above), plus fixes found on the way.
|
||||
|
||||
**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**
|
||||
* 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
|
||||
* 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
|
||||
|
||||
**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
|
||||
|
||||
## Query flow
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
Q[query UDP/TCP/DoT/DoH] --> P{parse ok?}
|
||||
P -- no --> FE[FORMERR]
|
||||
P -- yes --> RL{rate limit}
|
||||
RL -- exceeded --> D[drop / TC=1 slip]
|
||||
RL -- ok --> TS{TSIG valid?}
|
||||
TS -- invalid --> NA[NOTAUTH]
|
||||
TS --> OP{opcode}
|
||||
OP -- NOTIFY --> N[secondary refresh]
|
||||
OP -- UPDATE --> U[RFC 2136 on primary]
|
||||
OP -- QUERY --> X{AXFR/IXFR?}
|
||||
X -- yes --> XA[ACL + TSIG → transfer]
|
||||
X -- no --> Z{local zone in client view?}
|
||||
Z -- yes --> AA[authoritative answer AA=1]
|
||||
Z -- no --> R{client allowed to recurse?}
|
||||
R -- no --> REF[REFUSED]
|
||||
R -- yes --> L{local-only / blocked?}
|
||||
L -- yes --> NX[NXDOMAIN / policy answer]
|
||||
L -- no --> F{forward zone match?}
|
||||
F -- yes --> FW[forwarder pool + cache ns]
|
||||
F -- no --> DEF[default: recursive / forward / refuse]
|
||||
DEF --> V[DNSSEC validation → AD / SERVFAIL]
|
||||
```
|
||||
|
||||
## NOTIFY → IXFR/AXFR
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant A as Admin (API/DDNS/file)
|
||||
participant P as Primary
|
||||
participant S as Secondary
|
||||
A->>P: change zone
|
||||
P->>P: bump serial, validate, write file, journal diff, atomic swap
|
||||
P->>S: NOTIFY (IP ACL, optional TSIG)
|
||||
S->>P: SOA?
|
||||
P-->>S: SOA serial N+1
|
||||
S->>P: IXFR from N (TCP)
|
||||
P-->>S: diff N→N+1 (or AXFR-style if journal too short)
|
||||
alt IXFR fails
|
||||
S->>P: AXFR
|
||||
end
|
||||
S->>S: validate, atomic swap, persist snapshot
|
||||
```
|
||||
|
||||
## Security defaults
|
||||
|
||||
No open resolver (recursion only for private LAN ranges and loopback unless configured),
|
||||
zone transfers and dynamic updates denied unless allowed by IP ACL and/or key, API on
|
||||
loopback with mandatory tokens (the local one is created with mode 0640 for the CLI),
|
||||
metrics on loopback, secrets as `env:`/`file:` references or BIND key files with
|
||||
restricted permissions, runs unprivileged with `CAP_NET_BIND_SERVICE`. Details: [docs/security.md](docs/security.md).
|
||||
|
||||
## Documentation
|
||||
|
||||
[architecture](docs/architecture.md) · [configuration](docs/configuration.md) ·
|
||||
[primary](docs/primary.md) · [secondary](docs/secondary.md) · [recursive](docs/recursive.md) ·
|
||||
[forwarder](docs/forwarder.md) · [hybrid](docs/hybrid.md) · [dnssec](docs/dnssec.md) ·
|
||||
[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) ·
|
||||
[**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)
|
||||
|
||||
## Tests
|
||||
|
||||
```bash
|
||||
cargo fmt --all -- --check
|
||||
cargo clippy --workspace --all-targets --all-features -- -D warnings
|
||||
cargo test --workspace --all-features
|
||||
cargo build --workspace --release
|
||||
./dev.sh e2e # release build + scripts/e2e.sh (needs dig/host/nslookup)
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT – see [LICENSE](LICENSE).
|
||||
Reference in new issue
Block a user