v0.1.0
This commit is contained in:
commit
fa432bebda
189 files changed
+26219
No files matched your search
@@ -0,0 +1,62 @@
|
||||
# Security
|
||||
|
||||
## Defaults (secure by default)
|
||||
|
||||
| Area | Default |
|
||||
|---|---|
|
||||
| Recursion | only private LAN ranges `192.168.0.0/16`, `10.0.0.0/8` and `127.0.0.1`, `::1` (`recursion.allowed_clients`); everyone else REFUSED |
|
||||
| Zone transfers | denied unless `transfer_acl` allows (IP-based; an optional `transfer_tsig_key` adds a key check) |
|
||||
| NOTIFY | only from the zone's primaries (or a valid zone TSIG) |
|
||||
| Dynamic updates | disabled; enabled per zone by source IP (`update_acl`), key (`update_keys`) or per-record rules (`update_policy`); audited; open-to-any without a key is a validation error |
|
||||
| API | `127.0.0.1:9953`, tokens required (local control token in `data_dir`, mode 0640), admin/read-only roles, per-IP rate limit |
|
||||
| Metrics | `127.0.0.1:9090` |
|
||||
| CH TXT version.bind / id.server | REFUSED unless `server.identity` is set |
|
||||
| UDP response size | EDNS 1232 (no fragmentation), TC for larger answers |
|
||||
| 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 |
|
||||
| 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
|
||||
to any address without TSIG, unsigned dynamic updates from any address (error), IP-only
|
||||
dynamic updates (warning: source addresses can be spoofed), API on a non-loopback address
|
||||
without auth (error), inline secrets, plaintext DoH on non-loopback addresses.
|
||||
|
||||
## Hardening measures in code
|
||||
|
||||
* No `unsafe` (`#![forbid(unsafe_code)]` workspace-wide); clippy warns on `unwrap`/`expect`;
|
||||
untrusted input paths return errors instead of panicking. A robustness test sends
|
||||
30 000 random/mutated packets through the handler; fuzz targets exist for the parser,
|
||||
zone files, configuration and transfers.
|
||||
* Packets claiming to be responses are dropped (reflection loops); FORMERR is generated
|
||||
only for queries whose header is readable.
|
||||
* Resource limits: UDP in-flight queries (`max_inflight`), TCP connections, idle timeouts,
|
||||
pipelined queries per connection, transfer size/record limits, regex size limits,
|
||||
zone file size limit, HTTP header/body limits, resolver budgets.
|
||||
* UDP sockets use SO_REUSEPORT (`server.udp_sockets`). On Linux only processes running
|
||||
under the same effective UID can join the socket group, so run EasyDNS under its own
|
||||
dedicated user (as the systemd unit does) – another process of that user could
|
||||
otherwise bind the same port and receive part of the queries. Set `udp_sockets: 1` to
|
||||
disable SO_REUSEPORT.
|
||||
* Rate limiting: per-client buckets are on by default; the server-wide cap
|
||||
(`rate_limit.global_qps`) is off by default (0) because it drops legitimate and
|
||||
attack traffic alike – set it only if you need a hard ceiling.
|
||||
* Identical concurrent questions are coalesced into one upstream resolution, which
|
||||
reduces the number of outstanding queries a spoofing ("birthday") attack can race.
|
||||
* TSIG: HMAC-SHA256/384/512 (MD5 rejected), constant-time MAC check, fudge window,
|
||||
every message of a transfer verified (RFC 8945 §5.3.1 unsigned intermediate rule).
|
||||
* Secrets: references (`env:`, `file:`), redacted in `Debug`, never logged. Key files are
|
||||
created with mode 0600 in 0700 directories.
|
||||
* API tokens are compared by SHA-256 in constant time; tokens can be configured as hashes.
|
||||
* Logging privacy: query logs are off by default; when on, client IPs are truncated
|
||||
(/24, /48) unless `anonymize_clients: false`. Metrics have no per-domain/IP labels.
|
||||
|
||||
## Running unprivileged
|
||||
|
||||
Use the systemd unit (`User=easydns`, `AmbientCapabilities=CAP_NET_BIND_SERVICE`,
|
||||
`ProtectSystem=strict`, syscall filter, no new privileges) or the Docker image (non-root,
|
||||
`cap_drop: ALL` + `NET_BIND_SERVICE`, read-only root). `easydns run` warns when started as root.
|
||||
|
||||
## Dependencies
|
||||
|
||||
`cargo deny check` (CI) audits advisories and licenses (`deny.toml`).
|
||||
Reference in new issue
Block a user