v0.1.0
This commit is contained in:
commit
fa432bebda
189 files changed
+26219
No files matched your search
@@ -0,0 +1,208 @@
|
||||
# Configuration
|
||||
|
||||
`config.yaml` (JSON is accepted too). Unknown keys are rejected with file/line information.
|
||||
Precedence: **CLI > ENV > file > defaults**, then changes made through the API
|
||||
(`<data_dir>/api-overlay.yaml`) are merged.
|
||||
|
||||
Validate offline: `easydns check-config -c config.yaml` or `econf check config.yaml`
|
||||
(also loads every primary zone file). Exit code 2 on errors.
|
||||
|
||||
## Default installation layout
|
||||
|
||||
| Path | Contents | Owner / mode |
|
||||
|---|---|---|
|
||||
| `/etc/easydns/config.yaml` | main configuration ([config/config.yaml](../config/config.yaml)) | root:easydns 0640 |
|
||||
| `/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/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 |
|
||||
|
||||
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`,
|
||||
`127.0.0.1/32`; add `172.16.0.0/12` if you use it), listening on `0.0.0.0:53` and
|
||||
`[::1]:53`.
|
||||
|
||||
## 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.
|
||||
(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.)
|
||||
|
||||
## Include files
|
||||
|
||||
Zone definitions (and keys, ACLs, forward zones) can be split into separate files, like
|
||||
BIND's `include "named.conf.zones";`:
|
||||
|
||||
```yaml
|
||||
# /etc/easydns/config.yaml
|
||||
include:
|
||||
- "zones.d/*.yaml" # glob in the file name; sorted; empty directory is fine
|
||||
- "keys.yaml" # literal path; must exist
|
||||
server: { ... }
|
||||
```
|
||||
|
||||
An included file is either a **list of zones**:
|
||||
```yaml
|
||||
- { name: example.org, type: secondary, primaries: ["192.0.2.53:53"] }
|
||||
- { name: example.net, type: secondary, primaries: ["192.0.2.53:53"] }
|
||||
```
|
||||
or a **mapping** with any of `zones`, `keys`, `acls`, `forward_zones` and a nested
|
||||
`include` (relative to that file):
|
||||
```yaml
|
||||
keys: [ { name: example-net-xfr, secret: "env:DNS_TSIG_EXAMPLE_NET" } ]
|
||||
acls: { example-net-primaries: ["198.51.100.10/32"] }
|
||||
zones: [ { name: example.net, type: secondary, primaries: ["198.51.100.10:53"], transfer: { tsig_key: example-net-xfr } } ]
|
||||
```
|
||||
|
||||
A file whose first statement is a BIND **`key`** statement is read as a BIND key file, so
|
||||
`keys.conf` from a BIND server can be included unchanged:
|
||||
```
|
||||
key "ddns.example.com" {
|
||||
algorithm hmac-sha512;
|
||||
secret "base64-secret";
|
||||
};
|
||||
```
|
||||
Only `key { algorithm; secret; };` is accepted there (comments `#`, `//`, `/* */` allowed);
|
||||
any other statement is an error with its line number. Keep such files `0640 root:easydns`
|
||||
– `check-config` warns when they are world-readable.
|
||||
|
||||
Rules: include patterns are relative to the including file; zone `file:` paths are
|
||||
relative to `data_dir` (see above) and `file:` secret references to the **main**
|
||||
configuration file's directory;
|
||||
hidden files and `*~` backups are skipped; recursive/duplicate includes and redefined ACLs
|
||||
are errors; duplicate zones are reported with the file they come from; nesting depth ≤ 8.
|
||||
Includes are re-read on every reload, so adding a zone = drop a file into `zones.d/` and
|
||||
run `easydns reload`. Zone files themselves support BIND `$INCLUDE`.
|
||||
|
||||
## Environment overrides
|
||||
|
||||
| Variable | Effect |
|
||||
|---|---|
|
||||
| `EASYDNS_LISTEN` | comma-separated listen addresses |
|
||||
| `EASYDNS_LOG_LEVEL` | log level / filter |
|
||||
| `EASYDNS_DATA_DIR` | data directory |
|
||||
| `EASYDNS_API_LISTEN` | API listen address |
|
||||
| `EASYDNS_LOG` | full `tracing` filter (e.g. `info,query=info`) |
|
||||
|
||||
CLI: `easydns run --listen 127.0.0.1:5353 --log-level debug --data-dir /tmp/x`.
|
||||
|
||||
## Secrets
|
||||
|
||||
TSIG secrets and API tokens are **references**: `env:VAR`, `file:/path` or (discouraged,
|
||||
warned) `base64:...`; API tokens may also be `sha256:<hex>` (`easydns hash-token`).
|
||||
TSIG keys can also come from BIND key files in `keys.d/` (see above).
|
||||
Secrets are never logged (`TsigKey` redacts itself in debug output).
|
||||
|
||||
TSIG keys are **optional** everywhere: zone transfers, NOTIFY and dynamic updates can be
|
||||
authorised by IP address alone (see [zone-transfer-variants.md](zone-transfer-variants.md)
|
||||
and [primary.md](primary.md#dynamic-updates-rfc-2136)).
|
||||
|
||||
The local API token (`api.local_token`, default on) is created by the server in
|
||||
`<data_dir>/control.token` with mode 0640; the `easydns` CLI reads it automatically, so
|
||||
`easydns status`, `easydns reload` etc. work right after installation for root and members
|
||||
of the `easydns` group, without generating or passing a key. Set `local_token: false` to
|
||||
require explicit tokens only.
|
||||
|
||||
## Sections (defaults in brackets)
|
||||
|
||||
```yaml
|
||||
server:
|
||||
mode: hybrid # primary|master, secondary|slave, recursive|resolver, forwarder, hybrid|mixed, cache-only
|
||||
listen: ["0.0.0.0:53", "[::1]:53"] # [::] addresses are IPv6-only, so they can be listed next to 0.0.0.0
|
||||
udp: true
|
||||
tcp: true
|
||||
data_dir: data # relative to the config file → /etc/easydns/data
|
||||
max_tcp_connections: 1024
|
||||
tcp_idle_timeout: 10s
|
||||
max_udp_payload: 1232
|
||||
max_inflight: 10000 # server-wide limit of UDP queries being processed at once
|
||||
udp_sockets: 0 # UDP sockets per address (SO_REUSEPORT); 0 = one per CPU, max 16
|
||||
identity: null # answers id.server/version.bind (CH TXT) only when set
|
||||
logging: { level: info, format: text|json, query_log: false, anonymize_clients: true }
|
||||
keys: [ { name, algorithm: hmac-sha256, secret: "env:..." } ]
|
||||
acls: { name: ["10.0.0.0/8", "acl:other", "any", "none"] }
|
||||
recursion:
|
||||
enabled: false
|
||||
root_hints: null # built-in IANA hints when unset
|
||||
allowed_clients: ["192.168.0.0/16", "10.0.0.0/8", "127.0.0.1/32", "::1/128"]
|
||||
qname_minimization: true
|
||||
dnssec_validation: false
|
||||
trust_anchors: null # DS/DNSKEY file; built-in root KSKs when unset
|
||||
max_depth: 30
|
||||
max_queries: 100
|
||||
max_cname_chain: 8
|
||||
query_timeout: 1500ms
|
||||
total_timeout: 10s
|
||||
local_only_suffixes: []
|
||||
use_ipv6_transport: false
|
||||
zones: # see primary.md / secondary.md
|
||||
- name: example.com
|
||||
type: primary
|
||||
file: zones/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
|
||||
notify_tsig_key: null
|
||||
update_acl: [] # alias allow_update; alone = updates by IP without a key
|
||||
update_keys: [] # keys that may change the whole zone
|
||||
update_policy: [] # BIND-style rules: "grant <key> name|subdomain|wildcard|zonesub|self|selfsub [name] [types]"
|
||||
serial_strategy: increment
|
||||
journal_size: 100
|
||||
views: []
|
||||
dnssec: null
|
||||
forward_zones: [ { domain, upstreams, strategy, clients, fallback_recursion } ]
|
||||
upstreams: { strategy: failover, servers: [], timeout: 2s, health_check_interval: 30s, tls_ca_file: null }
|
||||
resolution: { default: refuse|recursive|forward|forwardthenrecursive, views: [ { name, clients } ] }
|
||||
cache: { enabled: true, max_entries: 100000, min_ttl: 0, max_ttl: 86400, max_negative_ttl: 3600, serve_stale: false, stale_ttl: 30,
|
||||
answer_entries: 20000, # encoded-answer (packet) cache; 0 = off
|
||||
answer_max_age: 30s, # max reuse of local-zone answers (zone changes invalidate at once)
|
||||
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 }
|
||||
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 }
|
||||
metrics: { enabled: true, listen: 127.0.0.1:9090 }
|
||||
```
|
||||
|
||||
Durations accept `500ms`, `2s`, `5m`, `1h`, `1d` or plain seconds.
|
||||
|
||||
### Encoded-answer cache (`cache.answer_entries`)
|
||||
|
||||
Complete responses are kept in encoded form and reused for identical queries: the copy
|
||||
gets the client's message ID and question spelling, and TTLs of resolved data are
|
||||
counted down. A hit costs no parsing, no policy evaluation and no zone lookup, and UDP
|
||||
hits are answered directly in the receive loop (batched with `sendmmsg` on Linux).
|
||||
|
||||
* The key includes everything that can change the answer: the query (flags, EDNS, DO bit,
|
||||
UDP size) and the client's view, recursion permission, block-list exemption,
|
||||
client-specific forward rules and transport (UDP/TCP). TSIG-signed queries are never
|
||||
cached; only NOERROR/NXDOMAIN answers are stored.
|
||||
* Zone changes (file reload, API, DDNS, re-signing, secondary transfer or expiry), a
|
||||
configuration reload and `easydns cache clear` invalidate it immediately.
|
||||
* With `logging.query_log: true` the cache is bypassed, so every query is logged.
|
||||
* 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`.
|
||||
|
||||
## Upstream syntax
|
||||
|
||||
`1.1.1.1`, `1.1.1.1:53`, `[2606:4700::1111]:53`, `tcp://1.1.1.1`,
|
||||
`tls://1.1.1.1#cloudflare-dns.com`, `https://1.1.1.1/dns-query#cloudflare-dns.com`
|
||||
(`#name` is the TLS certificate name and is mandatory for TLS upstreams).
|
||||
DoT upstreams use a pool of persistent connections; DoH upstreams use one persistent,
|
||||
multiplexed HTTP/2 connection (HTTP/1.1 if the server lacks h2). Certificates are checked
|
||||
against the built-in Mozilla roots plus `upstreams.tls_ca_file`. See
|
||||
[secure-dns.md](secure-dns.md).
|
||||
|
||||
## Hot reload
|
||||
|
||||
`kill -HUP <pid>`, `systemctl reload easydns`, `easydns reload` or `POST /api/v1/config/reload`.
|
||||
The new configuration is validated and built completely before it is switched in; on any
|
||||
error the running configuration stays active. Settings that need a restart are reported
|
||||
(`restart_required`).
|
||||
Reference in new issue
Block a user