v0.1.2
This commit is contained in:
1 parent
6e57b9e1b8
commit
7b8c7e93fb
48 files changed
+1010
-116
No files matched your search
@@ -60,16 +60,17 @@ journal (IXFR then falls back to AXFR); snapshots are plain zone files.
|
||||
|
||||
| Path (`data_dir`) | Content |
|
||||
|---|---|
|
||||
| `zones/primary/<zone>.zone` | primary zone files (operator, `zone create`, API, DDNS) |
|
||||
| `zones/secondary/<zone>.zone` + `.meta.json` | last valid secondary copy + last successful refresh |
|
||||
| `zones/signed/<zone>.zone` | last signed version of DNSSEC zones (keeps signatures stable across restarts) |
|
||||
| `journal/<zone>.jnl` | IXFR differences |
|
||||
| `signed/<zone>.zone` | last signed version of DNSSEC zones (keeps signatures stable across restarts) |
|
||||
| `zones/` | zones created via the API |
|
||||
| `api-overlay.yaml` | API changes (zones, upstreams, allowlist, block rules) merged on load |
|
||||
| `blocklists/` | downloaded/API block lists |
|
||||
| `audit.log` | JSON lines of administrative actions |
|
||||
|
||||
## Hybrid decision order
|
||||
|
||||
0. hosts files (`hosts.files`), for clients allowed to resolve → AA answer, NODATA for other types;
|
||||
1. local authoritative zone (most specific, visible in the client's view) → AA answer;
|
||||
2. client not allowed to recurse → REFUSED;
|
||||
3. local-only names (RFC 6761/6303, configurable) → NXDOMAIN, never sent out;
|
||||
|
||||
+4
-4
@@ -31,8 +31,8 @@ server, mode 0640, readable by root and the `easydns` group). So after installat
|
||||
### Creating a zone
|
||||
|
||||
`easydns zone create` writes a minimal, valid primary zone – SOA, NS, glue for in-zone
|
||||
name servers and optional apex addresses – into `<data_dir>/zones/<zone>.zone`
|
||||
(`/etc/easydns/data/zones/`) and its definition into `/etc/easydns/zones.d/<zone>.yaml`.
|
||||
name servers and optional apex addresses – into `<data_dir>/zones/primary/<zone>.zone`
|
||||
(`/etc/easydns/data/zones/primary/`) and its definition into `/etc/easydns/zones.d/<zone>.yaml`.
|
||||
The zone is parsed and validated before anything is written; existing files are never
|
||||
overwritten without `--force`.
|
||||
|
||||
@@ -66,7 +66,7 @@ ns1 IN A 192.0.2.10
|
||||
# /etc/easydns/zones.d/example.com.yaml
|
||||
- name: example.com
|
||||
type: primary
|
||||
file: zones/example.com.zone
|
||||
file: zones/primary/example.com.zone
|
||||
```
|
||||
|
||||
| Option | Meaning (default) |
|
||||
@@ -99,7 +99,7 @@ output is structured. Exit codes: 0 success (a DNS answer, also NXDOMAIN for `ed
|
||||
| `etrace` / `easytrace` | dig +trace | `etrace example.com --dnssec --json` |
|
||||
| `ednssec` / `easydnssec` | delv | `ednssec example.com A -v` (secure/insecure/bogus with reason; exit 2 = bogus) |
|
||||
| `eptr` / `easyptr` | dig -x | `eptr 192.0.2.1 2001:db8::1 --verify` (forward-confirmed) |
|
||||
| `ezone` / `easyzone` | named-checkzone | `ezone check zones/example.com.zone --origin example.com`, `ezone validate --all -c config.yaml`, `ezone canonical ...` |
|
||||
| `ezone` / `easyzone` | named-checkzone | `ezone check zones/primary/example.com.zone --origin example.com`, `ezone validate --all -c config.yaml`, `ezone canonical ...` |
|
||||
| `econf` / `easyconf` | named-checkconf | `econf check config.yaml`, `econf print config.yaml` |
|
||||
| `ebench` / `easybench` | dnsperf | `ebench @127.0.0.1 --qps 1000 --duration 30s -c 50 -d queries.txt` (high load needs `--i-own-this-server`) |
|
||||
| `ediff` / `easydiff` | – | `ediff example.com MX @1.1.1.1 @8.8.8.8 --json` (order-insensitive, TTL shown not compared) |
|
||||
|
||||
+22
-6
@@ -15,11 +15,15 @@ Validate offline: `easydns check-config -c config.yaml` or `econf check config.y
|
||||
| `/etc/easydns/zones.d/*.yaml` | zone definitions, one file per zone (`easydns zone create` writes here) | root:easydns 0750 |
|
||||
| `/etc/easydns/keys.d/*.conf` | TSIG keys – BIND `key "…" { … };` files copied unchanged | root:easydns 0640 |
|
||||
| `/etc/easydns/data/` | `server.data_dir`: everything the server writes | easydns:easydns 0750 |
|
||||
| `/etc/easydns/data/zones/` | zone files of primary zones (`file: zones/example.com.zone`) | easydns |
|
||||
| `/etc/easydns/data/zones/secondary/` | copies of secondary zones (+ `.meta.json`) | easydns |
|
||||
| `/etc/easydns/data/zones/primary/` | **your** primary zone files (`file: zones/primary/example.com.zone`); `zone create`, the API and DDNS write here too – back them up | easydns |
|
||||
| `/etc/easydns/data/zones/secondary/` | copies of secondary zones (+ `.meta.json`) – recreated by a transfer | easydns |
|
||||
| `/etc/easydns/data/zones/signed/` | signed versions of DNSSEC zones – recreated by signing | easydns |
|
||||
| `/etc/easydns/data/journal/` | IXFR journals | easydns |
|
||||
| `/etc/easydns/data/control.token` | local admin token for the CLI | easydns 0640 |
|
||||
| `/etc/easydns/data/audit.log`, `api-overlay.yaml`, `signed/` | audit trail, API changes, signed zones | easydns |
|
||||
| `/etc/easydns/data/audit.log`, `api-overlay.yaml`, `blocklists/` | audit trail, API changes, downloaded block lists | easydns |
|
||||
|
||||
In short: `/etc/easydns/` is configuration you write, `data/zones/primary/` is zone data
|
||||
you own, everything else under `data/` is created by the server.
|
||||
|
||||
The default configuration runs a **hybrid** node: authoritative for the zones in
|
||||
`zones.d/`, recursive resolver for `acls.lan` (`192.168.0.0/16`, `10.0.0.0/8`,
|
||||
@@ -28,8 +32,10 @@ The default configuration runs a **hybrid** node: authoritative for the zones in
|
||||
|
||||
## Zone file paths
|
||||
|
||||
A relative zone `file:` is relative to `server.data_dir`: `file: zones/example.com.zone`
|
||||
is `/etc/easydns/data/zones/example.com.zone`. Absolute paths are used as they are.
|
||||
A relative zone `file:` is relative to `server.data_dir`: `file: zones/primary/example.com.zone`
|
||||
is `/etc/easydns/data/zones/primary/example.com.zone`. Absolute paths are used as they are,
|
||||
and any other relative path works too – `zones/primary/` is the convention used by
|
||||
`easydns zone create`, the API and the examples, not a requirement.
|
||||
(Older configurations whose relative paths point next to the config file keep working:
|
||||
if the file is not found under `data_dir` but exists relative to the configuration
|
||||
directory, that one is used.)
|
||||
@@ -144,7 +150,7 @@ recursion:
|
||||
zones: # see primary.md / secondary.md
|
||||
- name: example.com
|
||||
type: primary
|
||||
file: zones/example.com.zone # relative to data_dir
|
||||
file: zones/primary/example.com.zone # relative to data_dir
|
||||
transfer_acl: [] # IPs allowed to AXFR/IXFR
|
||||
transfer_tsig_key: null # optional key for transfers
|
||||
notify: [] # secondaries to NOTIFY
|
||||
@@ -165,6 +171,7 @@ cache: { enabled: true, max_entries: 100000, min_ttl: 0, max_ttl: 86400, max_neg
|
||||
prefetch: true } # refresh popular resolver entries before they expire
|
||||
policy: { blocklists: [ { name, file|url, category, enabled } ], allowlist: [], block_action: nxdomain|refused|null|address,
|
||||
block_address_v4: 0.0.0.0, block_address_v6: "::", block_ttl: 60, exempt_clients: [], log_blocked: true }
|
||||
hosts: { files: [], ttl: 0, domain: null, reload_interval: 5s } # /etc/hosts-format files answered first (dnsmasq style), see hosts.md
|
||||
rate_limit: { enabled: true, per_client_qps: 200, burst: 400, global_qps: 0, slip: 2, exempt_clients: [loopback] } # global_qps 0 = no server-wide cap
|
||||
tls: { cert_file, key_file, dot_listen: [], doh_listen: [], doh_plaintext_behind_proxy: false } # certificate files re-read within 60 s of a change
|
||||
api: { enabled: true, listen: 127.0.0.1:9953, auth_required: true, local_token: true, tokens: [], allowed_clients: [loopback], requests_per_minute: 600 }
|
||||
@@ -190,6 +197,15 @@ hits are answered directly in the receive loop (batched with `sendmmsg` on Linux
|
||||
* Memory: about 0.3–1 KiB per entry (20 000 entries ≈ 6–20 MB at most).
|
||||
* Metrics: `dns_answer_cache_hits_total`, `…_misses_total`, `…_inserts_total`, `dns_answer_cache_entries`.
|
||||
|
||||
### Hosts files (`hosts`)
|
||||
|
||||
`hosts.files: ["/etc/hosts"]` answers the names in those files (A, AAAA and PTR) before
|
||||
local zones, block lists, forwarding and recursion – the dnsmasq behaviour. A name that
|
||||
is in the files but lacks the asked type gets NODATA and is not forwarded. Only clients
|
||||
in `recursion.allowed_clients` get these answers. `domain: lan` also answers bare names
|
||||
as `<name>.lan`; files are re-read automatically every `reload_interval` when they
|
||||
change. Details and a dnsmasq translation table: [hosts.md](hosts.md).
|
||||
|
||||
## Upstream syntax
|
||||
|
||||
`1.1.1.1`, `1.1.1.1:53`, `[2606:4700::1111]:53`, `tcp://1.1.1.1`,
|
||||
|
||||
+15
-4
@@ -35,7 +35,7 @@ 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:
|
||||
creates `/etc/easydns/{zones.d,keys.d,data/zones/primary,data/zones/secondary}` and the `easydns` user. Layout:
|
||||
[configuration.md](configuration.md#default-installation-layout). Example configurations
|
||||
are in `/usr/share/doc/easydns/examples/`.
|
||||
|
||||
@@ -72,8 +72,19 @@ sudo apt update && sudo apt install -o Dpkg::Options::=--force-confold easydns
|
||||
* 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
|
||||
running and the reason is in `/tmp/easydns-upgrade-check.log`.
|
||||
* Secondary zone copies from older versions (`data/secondary/`) are moved automatically
|
||||
to `data/zones/secondary/` on the first start, so zones are served immediately.
|
||||
* Files the server keeps are moved automatically on the first start: secondary copies
|
||||
`data/secondary/` → `data/zones/secondary/` (0.1.1) and signed zones `data/signed/` →
|
||||
`data/zones/signed/` (0.1.2), so zones are served at once and signatures are reused.
|
||||
* Your own primary zone files are **not** moved: `file:` in `zones.d/` points at them and
|
||||
keeps working. To adopt the 0.1.2 layout (`data/zones/primary/`), move them and fix the
|
||||
paths, then reload:
|
||||
```bash
|
||||
sudo -u easydns sh -c 'cd /etc/easydns/data/zones && mkdir -p primary && mv -- *.zone primary/'
|
||||
sudo sed -i 's|file: zones/\([^/ ]*\.zone\)|file: zones/primary/\1|' /etc/easydns/zones.d/*.yaml /etc/easydns/config.yaml
|
||||
sudo easydns check-config && sudo easydns reload
|
||||
```
|
||||
Zones created through the API keep their absolute path in `data/api-overlay.yaml`; new
|
||||
ones go to `zones/primary/`.
|
||||
* After the upgrade: `sudo easydns check-config`, `journalctl -u easydns -n 50`, and
|
||||
query a few zones (`easydig @127.0.0.1 example.com SOA +short`).
|
||||
|
||||
@@ -83,7 +94,7 @@ sudo apt update && sudo apt install -o Dpkg::Options::=--force-confold easydns
|
||||
sudo useradd --system --home /etc/easydns/data --shell /usr/sbin/nologin easydns
|
||||
sudo deploy/install.sh /usr # binaries (+ short tool names when free)
|
||||
sudo install -d -o root -g easydns -m 0750 /etc/easydns /etc/easydns/zones.d /etc/easydns/keys.d
|
||||
sudo install -d -o easydns -g easydns -m 0750 /etc/easydns/data /etc/easydns/data/zones
|
||||
sudo install -d -o easydns -g easydns -m 0750 /etc/easydns/data /etc/easydns/data/zones /etc/easydns/data/zones/primary
|
||||
sudo install -m 0640 -g easydns config/config.yaml /etc/easydns/config.yaml # or config/primary.yaml, secondary.yaml, …
|
||||
sudo cp deploy/systemd/easydns.service /etc/systemd/system/
|
||||
sudo systemctl daemon-reload && sudo systemctl enable --now easydns
|
||||
|
||||
+4
-4
@@ -40,7 +40,7 @@ emergency rollover; a leaked key lets others sign data for your domain.
|
||||
```yaml
|
||||
- name: example.com
|
||||
type: primary
|
||||
file: zones/example.com.zone # stays unsigned – keep editing it as before
|
||||
file: zones/primary/example.com.zone # stays unsigned – keep editing it as before
|
||||
transfer_acl: ["198.51.100.20"]
|
||||
notify: ["198.51.100.20:53"]
|
||||
dnssec:
|
||||
@@ -51,7 +51,7 @@ emergency rollover; a leaked key lets others sign data for your domain.
|
||||
sudo easydns check-config && sudo easydns reload
|
||||
```
|
||||
EasyDNS adds DNSKEY, NSEC and RRSIG records, bumps the serial, stores the signed copy in
|
||||
`/etc/easydns/data/signed/` and sends NOTIFY, so the secondaries transfer the signed zone.
|
||||
`/etc/easydns/data/zones/signed/` and sends NOTIFY, so the secondaries transfer the signed zone.
|
||||
(If the key directory is empty, `auto_generate: true` creates the key at this point –
|
||||
step 1 is then optional; get the DS with step 4.)
|
||||
|
||||
@@ -160,7 +160,7 @@ primary, remove the old DS) – see [migration-from-bind.md](migration-from-bind
|
||||
zones:
|
||||
- name: example.com
|
||||
type: primary
|
||||
file: zones/example.com.zone # stays unsigned
|
||||
file: zones/primary/example.com.zone # stays unsigned
|
||||
dnssec:
|
||||
keys_dir: /etc/easydns/data/keys/example.com
|
||||
algorithm: ed25519 # ed25519 | ecdsap256 | ecdsap384 (13 = ecdsap256 is the most widely accepted by registrars)
|
||||
@@ -177,7 +177,7 @@ zones:
|
||||
NODATA, wildcard expansions and unsigned delegations.
|
||||
* Every change (file reload, API, DDNS) re-signs and bumps the serial; an hourly task
|
||||
re-signs when signatures expire within `resign_before`. The signed zone is persisted in
|
||||
`<data_dir>/signed/` so a restart does not produce new signatures under the same serial.
|
||||
`<data_dir>/zones/signed/` so a restart does not produce new signatures under the same serial.
|
||||
* Rollover: add the new key file, reload (both keys published and used), wait DNSKEY TTL
|
||||
(+ parent DS TTL for KSKs, after updating the DS), remove the old key file, reload.
|
||||
* Secondaries simply transfer the signed zone (signing on secondaries is rejected).
|
||||
|
||||
+194
@@ -0,0 +1,194 @@
|
||||
# Hosts files (local names, dnsmasq style)
|
||||
|
||||
EasyDNS can answer names from files in `/etc/hosts` format, the way dnsmasq does by
|
||||
default. A name found there is answered **locally and first** – before local zones, the
|
||||
block lists, forwarding and recursion. Everything else continues to the usual resolution.
|
||||
|
||||
```yaml
|
||||
hosts:
|
||||
files: ["/etc/hosts"] # [] (off)
|
||||
ttl: 0 # [0] TTL of the answers, like dnsmasq local-ttl
|
||||
domain: lan # [none] also answer bare names as <name>.lan
|
||||
reload_interval: 5s # [5s] check the files for changes; 0s = only on reload
|
||||
```
|
||||
|
||||
The feature is off while `files` is empty.
|
||||
|
||||
## File format
|
||||
|
||||
The standard hosts format, one address per line, followed by one or more names:
|
||||
|
||||
```
|
||||
# /etc/hosts
|
||||
127.0.0.1 localhost
|
||||
::1 localhost ip6-localhost ip6-loopback
|
||||
192.168.1.1 router gw
|
||||
192.168.1.10 nas nas.home # comments are allowed at the end of a line
|
||||
fd00::10 nas
|
||||
192.168.1.50 git.linuxiarz.pl # override a public name inside the LAN
|
||||
```
|
||||
|
||||
* IPv4 and IPv6 addresses; a link-local zone index (`fe80::1%eth0`) is ignored,
|
||||
IPv4-mapped addresses (`::ffff:192.0.2.1`) are treated as IPv4.
|
||||
* All names on a line get the address (A or AAAA). The same name may appear on several
|
||||
lines; all its addresses are returned (duplicates are removed).
|
||||
* Names are case-insensitive. Lines that do not parse are skipped and counted in the
|
||||
`hosts files loaded … skipped_lines=N` log message.
|
||||
* Files are read as UTF-8 (invalid bytes are replaced); files over 64 MiB are refused.
|
||||
|
||||
## Answers
|
||||
|
||||
| Query | Answer |
|
||||
| --- | --- |
|
||||
| `A` / `AAAA` for a name in the files | its addresses of that family, AA flag set, TTL = `hosts.ttl` |
|
||||
| `A` for a name that has only IPv6 addresses (or the reverse), or any other type (`MX`, `TXT`, …) | **NODATA** (NOERROR, empty answer) – the question is not forwarded |
|
||||
| `ANY` | all A and AAAA addresses of the name |
|
||||
| `PTR` for an address from the files | the **first name** of the **first line** with that address (as glibc and dnsmasq do); with `domain:` set, a bare name is returned qualified (`nas.lan.`) |
|
||||
| a name not in the files | normal processing: local zones, policy, forwarding, recursion |
|
||||
|
||||
`0.0.0.0` / `::` lines are answered as written (handy for blocking a name), but no PTR
|
||||
record is made for them.
|
||||
|
||||
The NODATA rule means a name in the hosts files "owns" the name: an `AAAA` query for an
|
||||
IPv4-only host returns an empty answer at once instead of a slow or misleading upstream
|
||||
lookup. This is what dnsmasq does as well.
|
||||
|
||||
## Bare names and `domain`
|
||||
|
||||
A name without a dot (`nas`) is answered as `nas.` – clients that try the plain name, and
|
||||
dnsmasq-style setups that rely on it, work unchanged.
|
||||
|
||||
With `domain: lan`, every bare name is also answered as `<name>.lan` (dnsmasq
|
||||
`expand-hosts` + `domain=lan`). Names that already contain a dot are not changed. To make
|
||||
the whole domain local – unknown `*.lan` names get NXDOMAIN and are never sent to the
|
||||
Internet, like dnsmasq `local=/lan/` – also list it in `recursion.local_only_suffixes`:
|
||||
|
||||
```yaml
|
||||
hosts: { files: ["/etc/hosts"], domain: lan }
|
||||
recursion:
|
||||
local_only_suffixes: [lan]
|
||||
```
|
||||
|
||||
(Names such as `local`, `home.arpa`, `test`, `localhost` and the private reverse zones are
|
||||
local-only already; see [hybrid.md](hybrid.md).)
|
||||
|
||||
## Several files and globs
|
||||
|
||||
```yaml
|
||||
hosts:
|
||||
files:
|
||||
- /etc/hosts
|
||||
- /etc/easydns/hosts.d/*.hosts # dnsmasq addn-hosts / hostsdir
|
||||
- lan.hosts # relative to the directory of config.yaml
|
||||
```
|
||||
|
||||
* `*` and `?` are allowed in the file name (not in directory names). Hidden files (`.x`)
|
||||
and editor backups (`x~`) are ignored; matching files are read in alphabetical order.
|
||||
* A missing file is not an error: `check-config` reports a warning and the file is read
|
||||
as soon as it appears. A glob that matches nothing is simply empty.
|
||||
* Files are read in the order listed; for PTR records the first line wins across all files.
|
||||
|
||||
## Who gets these answers
|
||||
|
||||
Hosts answers are given to clients that may resolve, i.e. clients in
|
||||
`recursion.allowed_clients` (the same list that controls forwarding and recursion).
|
||||
Other clients – for example the Internet asking an authoritative server – never see the
|
||||
contents of the hosts files; they get the usual answer (local zone or REFUSED).
|
||||
|
||||
Precedence for allowed clients:
|
||||
|
||||
1. **hosts files**
|
||||
2. local authoritative zones (most specific zone in the client's view)
|
||||
3. local-only names (RFC 6761/6303 and `recursion.local_only_suffixes`) → NXDOMAIN
|
||||
4. allow/block policy
|
||||
5. conditional forwarding, then the default resolution
|
||||
|
||||
Hosts entries therefore win over a zone that contains the same name and are **not**
|
||||
subject to the block lists (they are your own data, like zone records). A name that
|
||||
leaves a local zone through a CNAME is looked up in the hosts files too before it is
|
||||
forwarded.
|
||||
|
||||
## Changes and reload
|
||||
|
||||
* Every `reload_interval` (default 5 s) EasyDNS compares the modification time and size
|
||||
of the files (and the list of files matched by the globs). On a change the files are
|
||||
re-read in the background and swapped in atomically; cached answers are dropped at once.
|
||||
No restart or reload is needed after editing `/etc/hosts`.
|
||||
* `reload_interval: 0s` turns the check off; the files are then read at start and on
|
||||
`easydns reload` / `systemctl reload easydns` / `kill -HUP` (dnsmasq behaviour).
|
||||
* A configuration reload always re-reads the files.
|
||||
|
||||
Log line after each load:
|
||||
|
||||
```
|
||||
INFO hosts files loaded files=2 names=17 skipped_lines=0
|
||||
```
|
||||
|
||||
## Checking
|
||||
|
||||
```sh
|
||||
easydig @127.0.0.1 nas A
|
||||
easydig @127.0.0.1 nas.lan AAAA
|
||||
easydig @127.0.0.1 -x 192.168.1.10
|
||||
```
|
||||
|
||||
With `logging.query_log: true` these answers are logged with `source=local
|
||||
note="hosts file"`.
|
||||
|
||||
## Migrating from dnsmasq
|
||||
|
||||
| dnsmasq | EasyDNS |
|
||||
| --- | --- |
|
||||
| reads `/etc/hosts` (default) | `hosts: { files: ["/etc/hosts"] }` |
|
||||
| `no-hosts` | leave `hosts.files` empty (default) |
|
||||
| `addn-hosts=/path/file` | add the file to `hosts.files` |
|
||||
| `hostsdir=/path` | `hosts.files: ["/path/*"]` (re-read automatically) |
|
||||
| `expand-hosts` + `domain=lan` | `hosts.domain: lan` |
|
||||
| `local=/lan/` | `recursion.local_only_suffixes: [lan]` |
|
||||
| `local-ttl=N` | `hosts.ttl: N` |
|
||||
| `server=127.0.0.1#55` | `upstreams.servers: ["127.0.0.1:55"]` + `resolution.default: forward` |
|
||||
| `server=/corp/10.0.0.1` | `forward_zones: [{ domain: corp, upstreams: ["10.0.0.1"] }]` |
|
||||
| `no-resolv` | (EasyDNS never reads `/etc/resolv.conf`) |
|
||||
| `port=54`, `listen-address=0.0.0.0`, `bind-interfaces` | `server.listen: ["0.0.0.0:54"]` |
|
||||
| `bogus-priv` | built in: private reverse zones are local-only (RFC 6303) |
|
||||
| `dnssec` | `recursion.dnssec_validation: true` (validation applies to recursion) |
|
||||
| `clear-on-reload` | a configuration reload drops the answer cache; `easydns cache clear` empties the resolver cache |
|
||||
| `enable-ra`, DHCP | not provided – EasyDNS is a DNS server only |
|
||||
|
||||
Example – a dnsmasq forwarder on port 54 in front of a resolver on 127.0.0.1:55,
|
||||
answering `/etc/hosts` first:
|
||||
|
||||
```yaml
|
||||
server:
|
||||
mode: forwarder
|
||||
listen: ["0.0.0.0:54"]
|
||||
recursion:
|
||||
allowed_clients: ["acl:lan", "::1/128"]
|
||||
acls:
|
||||
lan: ["192.168.0.0/16", "10.0.0.0/8", "127.0.0.1/32"]
|
||||
hosts:
|
||||
files: ["/etc/hosts"]
|
||||
resolution:
|
||||
default: forward
|
||||
upstreams:
|
||||
servers: ["127.0.0.1:55"]
|
||||
```
|
||||
|
||||
## Docker
|
||||
|
||||
Inside a container `/etc/hosts` is the container's own file. Mount the host's file (or a
|
||||
dedicated one) read-only and point `hosts.files` at it:
|
||||
|
||||
```yaml
|
||||
volumes:
|
||||
- /etc/hosts:/etc/easydns/hosts:ro
|
||||
```
|
||||
|
||||
```yaml
|
||||
hosts: { files: ["/etc/easydns/hosts"] }
|
||||
```
|
||||
|
||||
A single-file bind mount keeps the original inode; editors that replace the file (write
|
||||
a new file and rename it) break such a mount. Mount a directory instead
|
||||
(`./hosts.d:/etc/easydns/hosts.d:ro` with `files: ["/etc/easydns/hosts.d/*"]`) if the
|
||||
file is edited on the host.
|
||||
+3
-1
@@ -6,7 +6,7 @@ and recurse for everything else:
|
||||
```yaml
|
||||
recursion: { enabled: true, allowed_clients: ["acl:lan"] }
|
||||
zones:
|
||||
- { name: example.com, type: primary, file: zones/example.com.zone }
|
||||
- { name: example.com, type: primary, file: zones/primary/example.com.zone }
|
||||
- { name: example.net, type: secondary, primaries: ["192.0.2.10:53"] }
|
||||
forward_zones:
|
||||
- { domain: corp.internal, upstreams: ["10.0.0.53"] }
|
||||
@@ -19,6 +19,8 @@ resolution:
|
||||
|
||||
## Precedence (tested in `crates/dns-server/tests/resolver.rs`)
|
||||
|
||||
0. **Hosts files** (`hosts.files`, only for clients in `recursion.allowed_clients`) – a name
|
||||
listed there is answered from the files (NODATA for other types); see [hosts.md](hosts.md).
|
||||
1. **Local authoritative zones** – the most specific zone visible in the client's view wins
|
||||
(`example.com` beats a forward rule for `com`); NXDOMAIN inside a local zone is final and
|
||||
the name is never sent upstream.
|
||||
|
||||
@@ -14,7 +14,7 @@ rndc zonestatus example.com # type, serial, files, signing
|
||||
| BIND (`named.conf`) | EasyDNS (`config.yaml`) |
|
||||
|---|---|
|
||||
| `listen-on port 53 { 192.0.2.1; };` / `listen-on-v6` | `server.listen: ["192.0.2.1:53", "[2001:db8::1]:53"]` |
|
||||
| `directory "/var/named";` | `server.data_dir` (default install: `/etc/easydns/data`); zone `file:` paths are relative to it (`zones/example.com.zone`) |
|
||||
| `directory "/var/named";` | `server.data_dir` (default install: `/etc/easydns/data`); zone `file:` paths are relative to it (`zones/primary/example.com.zone`) |
|
||||
| `key "xfr" { algorithm hmac-sha256; secret "…"; };` | copy the BIND key file unchanged to `/etc/easydns/keys.d/` (included by default), or `keys: [ { name: xfr, secret: "file:…" } ]` |
|
||||
| `acl lan { 10.0.0.0/8; };` | `acls: { lan: ["10.0.0.0/8"] }`, referenced as `acl:lan` |
|
||||
| `zone "x" { type master; file "…"; };` | `zones: [ { name: x, type: primary, file: … } ]` |
|
||||
@@ -105,7 +105,7 @@ secondary of an EasyDNS primary (standard AXFR/IXFR/NOTIFY/TSIG). Useful as a mi
|
||||
stage: make EasyDNS a secondary first, then promote it (next section).
|
||||
|
||||
**Promote an EasyDNS secondary to primary:** copy the snapshot
|
||||
`<data_dir>/secondary/ZONE.zone` to a zone file, change the zone to `type: primary` with
|
||||
`<data_dir>/zones/secondary/ZONE.zone` to `<data_dir>/zones/primary/ZONE.zone`, change the zone to `type: primary` with
|
||||
`file:` pointing to it, reload. The serial continues from the transferred one.
|
||||
|
||||
## 3. Recursive resolver (caching resolver for a LAN)
|
||||
|
||||
+3
-3
@@ -24,13 +24,13 @@ api: { listen: "127.0.0.1:9953" } # the CLI uses the local control token aut
|
||||
# /etc/easydns/zones.d/example.com.yaml
|
||||
- name: example.com
|
||||
type: primary
|
||||
file: zones/example.com.zone # = /etc/easydns/data/zones/example.com.zone
|
||||
file: zones/primary/example.com.zone # = /etc/easydns/data/zones/primary/example.com.zone
|
||||
transfer_acl: ["198.51.100.20/32"] # IP only; a TSIG key is optional
|
||||
notify: ["198.51.100.20:53"]
|
||||
serial_strategy: date # YYYYMMDDnn for API/DDNS changes
|
||||
```
|
||||
```
|
||||
; /etc/easydns/data/zones/example.com.zone
|
||||
; /etc/easydns/data/zones/primary/example.com.zone
|
||||
$TTL 3600
|
||||
@ IN SOA ns1.example.com. hostmaster.example.com. (
|
||||
2026112101 ; serial
|
||||
@@ -100,7 +100,7 @@ All authentication variants: [zone-transfer-variants.md](zone-transfer-variants.
|
||||
| status of all zones | `easydns zones list` / `easydns status` |
|
||||
| details (serial, last change, errors) | `easydns zones show example.com` |
|
||||
| force NOTIFY | `easydns zones notify example.com` |
|
||||
| check a zone before reloading | `easyzone check /etc/easydns/data/zones/example.com.zone -o example.com` |
|
||||
| check a zone before reloading | `easyzone check /etc/easydns/data/zones/primary/example.com.zone -o example.com` |
|
||||
| compare primary with secondaries | `easydiff example.com SOA @192.0.2.10 @198.51.100.20` |
|
||||
| DS for the registrar (signed zone) | `easydns dnssec ds --zone example.com --dir /etc/easydns/data/keys/example.com` |
|
||||
| audit of changes | `GET /api/v1/audit` or `<data_dir>/audit.log` |
|
||||
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
# Primary (master)
|
||||
|
||||
A primary serves zones from zone files (BIND format) stored in
|
||||
`/etc/easydns/data/zones/`, sends NOTIFY to its secondaries, serves AXFR/IXFR and accepts
|
||||
`/etc/easydns/data/zones/primary/`, sends NOTIFY to its secondaries, serves AXFR/IXFR and accepts
|
||||
RFC 2136 dynamic updates when allowed.
|
||||
|
||||
## Quick start
|
||||
@@ -10,7 +10,7 @@ RFC 2136 dynamic updates when allowed.
|
||||
easydns zone create example.com --ns ns1.example.com=192.0.2.10 --ns ns2.example.net \
|
||||
--ip 192.0.2.80 --allow-transfer 198.51.100.20 --notify 198.51.100.20 --reload
|
||||
```
|
||||
This writes `/etc/easydns/data/zones/example.com.zone` and
|
||||
This writes `/etc/easydns/data/zones/primary/example.com.zone` and
|
||||
`/etc/easydns/zones.d/example.com.yaml` (see [cli-tools.md](cli-tools.md#creating-a-zone)).
|
||||
|
||||
## Zone definition
|
||||
@@ -19,7 +19,7 @@ This writes `/etc/easydns/data/zones/example.com.zone` and
|
||||
zones:
|
||||
- name: example.com
|
||||
type: primary
|
||||
file: zones/example.com.zone # relative to data_dir → /etc/easydns/data/zones/example.com.zone
|
||||
file: zones/primary/example.com.zone # relative to data_dir → /etc/easydns/data/zones/primary/example.com.zone
|
||||
transfer_acl: ["198.51.100.20/32"] # secondaries allowed to AXFR/IXFR (default: nobody)
|
||||
notify: ["198.51.100.20:53"] # NOTIFY after every change
|
||||
serial_strategy: increment # increment | unixtime | date (YYYYMMDDnn)
|
||||
@@ -71,7 +71,7 @@ Every accepted and refused update is written to the audit log
|
||||
```yaml
|
||||
- name: example.com
|
||||
type: primary
|
||||
file: zones/example.com.zone
|
||||
file: zones/primary/example.com.zone
|
||||
update_acl: ["198.51.100.50", "203.0.113.2"] # these hosts may change any record
|
||||
```
|
||||
```bash
|
||||
@@ -93,7 +93,7 @@ Internet. `easydns check-config` refuses `update_acl: [any]` without a key.
|
||||
```yaml
|
||||
- name: example.com
|
||||
type: primary
|
||||
file: zones/example.com.zone
|
||||
file: zones/primary/example.com.zone
|
||||
update_keys: [ddns-key]
|
||||
update_acl: ["192.168.1.0/24"] # optional extra restriction
|
||||
```
|
||||
@@ -149,7 +149,7 @@ EasyDNS – `/etc/easydns/zones.d/example.com.yaml`:
|
||||
```yaml
|
||||
- name: example.com
|
||||
type: primary
|
||||
file: zones/example.com.zone # copy of /etc/bind/example.com.conf into /etc/easydns/data/zones/
|
||||
file: zones/primary/example.com.zone # copy of /etc/bind/example.com.conf into /etc/easydns/data/zones/primary/
|
||||
transfer_acl: ["198.51.100.10", "198.51.100.11", "203.0.113.20", "127.0.0.1"]
|
||||
notify: ["198.51.100.11:53", "203.0.113.20:53"] # notify yes + also-notify
|
||||
update_policy:
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
| Rate limit | 200 qps / client (/32, /56), burst 400, no global cap (`global_qps: 0`), RRL-style slip |
|
||||
| Listening | `0.0.0.0:53` and `[::1]:53` (default configuration); `[::]` sockets are IPv6-only |
|
||||
| DoT / DoH | off until `tls.*_listen` is set; TLS 1.2/1.3 only; certificates reloaded on change |
|
||||
| Hosts files | off (`hosts.files: []`); when set, answered only to clients in `recursion.allowed_clients`, never to other clients |
|
||||
| Key files | BIND `keys.d/*.conf` read as is; warning when world-readable; installer creates `/etc/easydns` as root:easydns 0750 |
|
||||
|
||||
Risky configurations produce validation warnings/errors: open resolver (`any`), transfers
|
||||
|
||||
+3
-2
@@ -1,6 +1,6 @@
|
||||
# Feature status and known gaps (0.1.1)
|
||||
# Feature status and known gaps (0.1.2)
|
||||
|
||||
What EasyDNS 0.1.1 does not do yet, does only partly, or has not been verified outside the
|
||||
What EasyDNS 0.1.2 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.
|
||||
|
||||
@@ -28,6 +28,7 @@ Status: **missing** – not implemented; **partial** – implemented with the li
|
||||
| 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 |
|
||||
| Local data | hosts files (`/etc/hosts`, dnsmasq style) | done | A/AAAA/PTR from hosts-format files before zones and resolution, auto-reload on change; no DHCP-lease names – see [hosts.md](hosts.md) |
|
||||
| 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 |
|
||||
|
||||
+4
-3
@@ -18,13 +18,14 @@ Linux x86_64 container with 2 vCPUs).
|
||||
| Suite | What it covers |
|
||||
|---|---|
|
||||
| `dns-core` unit (20) | RFC 1982 serials + strategies, IDN names, zone file parse/emit incl. DNSKEY/RRSIG/NSEC/NSEC3/NSEC3PARAM/RFC 3597 round trip, TSIG request/response + multi-message chain with unsigned intermediates, UDP truncation, FORMERR, DNSSEC sign/verify/DS/tamper/expiry, NSEC logic, NSEC3 hash (RFC 5155 vector), HTTP parsing |
|
||||
| `dns-config` unit (15) | sample config, unknown-field error with line, error paths, ENV/CLI precedence, open-resolver warning, upstream syntax, durations, includes, **BIND key files** (comments, multi-line secrets, errors with line numbers), **`update_policy`** rules (BIND strings and mappings, invalid rules), zone paths with `..` before the data directory exists |
|
||||
| `dns-config` unit (16) | sample config, unknown-field error with line, error paths, ENV/CLI precedence, open-resolver warning, upstream syntax, durations, includes, **BIND key files** (comments, multi-line secrets, errors with line numbers), **`update_policy`** rules (BIND strings and mappings, invalid rules), zone paths with `..` before the data directory exists, `hosts` section (missing file warning, invalid domain) |
|
||||
| `dns-cli` unit (4) | **`zone create`**: zone with glue from `--ip`, external + in-zone name servers, mailbox escaping, missing glue error, files written + loaded by the config, no overwrite without `--force` |
|
||||
| `dns-server` unit (7) | query coalescing (50 identical → 1 resolution, cancelled leader releases waiters), **TLS certificate reload** (new pair picked up, broken pair rejected), **encoded-answer cache** (ID/0x20 case/TTL patching, profile/DO/name separation, generation and age invalidation, TTL 0 not cached, only plain queries – no TSIG, opcodes or trailing data, bounded memory) |
|
||||
| `dns-authoritative` unit (12) | lookup: positive/additional/case, NODATA/NXDOMAIN/ENT, CNAME chains + loops, wildcards, delegation/glue/DS at cut, validation errors, diff/apply, lint, journal chain/persistence/gap, AXFR chunking/framing, IXFR incremental/up-to-date/fallback/wrong base, zone signing (every RRset verifies, no glue/delegation signatures, NSEC chain) |
|
||||
| `dns-server` unit (13) | **hosts files** (names/aliases/comments, link-local zone index, NODATA for other types, PTR from the first name and line, `domain` for bare names, TTL, reload on change), query coalescing (50 identical → 1 resolution, cancelled leader releases waiters), **TLS certificate reload** (new pair picked up, broken pair rejected), **encoded-answer cache** (ID/0x20 case/TTL patching, profile/DO/name separation, generation and age invalidation, TTL 0 not cached, only plain queries – no TSIG, opcodes or trailing data, bounded memory) |
|
||||
| `dns-authoritative` unit (13) | moving secondary copies and signed zones from pre-0.1.2 locations, lookup: positive/additional/case, NODATA/NXDOMAIN/ENT, CNAME chains + loops, wildcards, delegation/glue/DS at cut, validation errors, diff/apply, lint, journal chain/persistence/gap, AXFR chunking/framing, IXFR incremental/up-to-date/fallback/wrong base, zone signing (every RRset verifies, no glue/delegation signatures, NSEC chain) |
|
||||
| `dns-cache` (7), `dns-policy` (5), `dns-forwarder` (2), `dns-recursive` (1), `dns-metrics` (1), `dns-tools` (3) | TTL clamp, negative caching, LRU/eviction, rank, namespaces; rules (exact/suffix/wildcard/regex/hosts), allow > block, rate limit + slip + /56, local-only, views; strategies, circuit breaker, failover; root hints; Prometheus output; dig argument parsing |
|
||||
| `dns-server/tests/authoritative.rs` (6) | AA answers, negative TTL, wildcard, referral, MX additional, REFUSED, TCP, FORMERR; AXFR requires TSIG+ACL, wrong key → NOTAUTH, AXFR over UDP refused; **primary + secondary**: initial AXFR, change → NOTIFY → **IXFR**, unauthorised NOTIFY refused, restart of the secondary with the primary down serves the persisted copy; **EXPIRE → SERVFAIL**; **DDNS** unsigned refused, signed applied, prerequisites (YXDOMAIN), RRset delete, audit; **`update_policy`** with keys from an included BIND key file (granted name/type, wrong type/name/key/unsigned refused, wildcard strictly below), **IP-only updates** (`allow_update`) |
|
||||
| `dns-server/tests/resolver.rs` (3) | **iterative resolution from a local root → TLD → authoritative fixture** (no Internet): A, cross-zone CNAME, glueless NS, QNAME minimisation over ENTs, NXDOMAIN/NODATA with SOA, non-existent TLD, cache hit without upstream queries, TCP, REFUSED for a client outside the ACL with **no upstream query**, local-only names never sent out; **hybrid** node: primary + secondary + forward zone + recursion + block list with **no leak** of private names to the root; **forwarder failover**, hot reload, invalid reload rolled back |
|
||||
| `dns-server/tests/hosts.rs` (3) | **hosts files** in front of a forwarder: A/AAAA/PTR/NODATA, `domain`, hosts win over a local zone and the upstream, other names forwarded, edits and a file created later picked up without reload, no answers for clients outside `recursion.allowed_clients`, glob + config reload |
|
||||
| `dns-server/tests/dnssec.rs` (2) | signed root/TLD/zone fixture: RRSIG with DO only, NSEC proofs; validating resolver: **secure** A (AD), secure CNAME chain, validated NXDOMAIN and NODATA, wildcard proof, **insecure** delegation (no AD), **bogus** → SERVFAIL, CD=1 returns data; signed zone change re-signs, source stays unsigned, restart reuses signatures |
|
||||
| `dns-server/tests/transport.rs` (3 + 1 manual) | DoT query, 20 concurrent DoT connections, untrusted CA and wrong name rejected; DoH POST/GET, 404/405/400/415/413 (no hanging connection); **DoH over HTTP/2** – 50 concurrent GET/POST multiplexed, h2 negotiated; **pooled DoT** reuse; **secure forwarder** plain DNS → DoT/DoH upstream with private CA; manual `measure_pooled_vs_one_shot` |
|
||||
| `dns-server/tests/performance.rs` (3) | coalescing of 40 identical cache misses into 1 upstream query, SO_REUSEPORT group on one port answering, **answer cache**: hit with other letter case echoes the client's spelling, DDNS change visible immediately, UDP answer stays truncated while TCP is complete, reload invalidates |
|
||||
|
||||
@@ -53,7 +53,7 @@ Primary (`192.0.2.10`):
|
||||
zones:
|
||||
- name: example.com
|
||||
type: primary
|
||||
file: zones/example.com.zone # = /etc/easydns/data/zones/example.com.zone
|
||||
file: zones/primary/example.com.zone # = /etc/easydns/data/zones/primary/example.com.zone
|
||||
transfer_acl: ["198.51.100.20/32", "198.51.100.21/32"]
|
||||
notify: ["198.51.100.20:53", "198.51.100.21:53"]
|
||||
```
|
||||
@@ -81,7 +81,7 @@ keys:
|
||||
zones:
|
||||
- name: example.com
|
||||
type: primary
|
||||
file: zones/example.com.zone
|
||||
file: zones/primary/example.com.zone
|
||||
transfer_acl: ["198.51.100.20/32", "198.51.100.21/32"]
|
||||
transfer_tsig_key: xfr-key # optional
|
||||
notify: ["198.51.100.20:53", "198.51.100.21:53"]
|
||||
@@ -105,7 +105,7 @@ Generate a secret: `head -c 32 /dev/urandom | base64 > /etc/easydns/keys/xfr.sec
|
||||
# primary
|
||||
- name: example.com
|
||||
type: primary
|
||||
file: zones/example.com.zone
|
||||
file: zones/primary/example.com.zone
|
||||
transfer_tsig_key: xfr-key # no transfer_acl: any address with a valid key
|
||||
notify: ["203.0.113.5:53"]
|
||||
notify_tsig_key: xfr-key
|
||||
@@ -133,7 +133,7 @@ server: { mode: primary, listen: ["10.0.0.10:53"] }
|
||||
zones:
|
||||
- name: example.com
|
||||
type: primary
|
||||
file: zones/example.com.zone
|
||||
file: zones/primary/example.com.zone
|
||||
transfer_acl: ["10.0.0.20/32", "10.0.0.21/32"]
|
||||
notify: ["10.0.0.20:53", "10.0.0.21:53"]
|
||||
resolution: { default: refuse }
|
||||
@@ -215,8 +215,8 @@ keys:
|
||||
- { name: provider-a, secret: "file:/etc/easydns/keys/provider-a.secret" }
|
||||
- { name: provider-b, secret: "file:/etc/easydns/keys/provider-b.secret" }
|
||||
zones:
|
||||
- { name: example.com, type: primary, file: zones/example.com.zone, transfer_tsig_key: provider-a, notify: ["198.51.100.20:53"], notify_tsig_key: provider-a }
|
||||
- { name: example.net, type: primary, file: zones/example.net.zone, transfer_tsig_key: provider-b, notify: ["203.0.113.7:53"], notify_tsig_key: provider-b }
|
||||
- { name: example.com, type: primary, file: zones/primary/example.com.zone, transfer_tsig_key: provider-a, notify: ["198.51.100.20:53"], notify_tsig_key: provider-a }
|
||||
- { name: example.net, type: primary, file: zones/primary/example.net.zone, transfer_tsig_key: provider-b, notify: ["203.0.113.7:53"], notify_tsig_key: provider-b }
|
||||
```
|
||||
|
||||
## Key rotation (only when you use keys)
|
||||
|
||||
Reference in new issue
Block a user