118 lines
6.3 KiB
Markdown
118 lines
6.3 KiB
Markdown
# CLI: `easydns` and EasyDNS Tools
|
||
|
||
## easydns
|
||
|
||
```
|
||
easydns run [--listen ADDR]... [--log-level L] [--data-dir D]
|
||
easydns check-config | config validate | config show
|
||
easydns status | version | query NAME [TYPE] | reload
|
||
easydns zone create ZONE [--ns NAME[=IP]]... [--ip IP]... [--email E] [--allow-transfer IP]...
|
||
[--notify IP]... [--allow-update IP]... [--ttl S] [--dry-run] [--force] [--reload]
|
||
easydns zones list|show|sync|notify|transfers|records ZONE (`zone` is an alias of `zones`)
|
||
easydns cache clear [--domain D] | cache stats
|
||
easydns upstreams list
|
||
easydns blocklists update easydns root-hints update
|
||
easydns dnssec keygen --zone Z --dir D [--role csk|ksk|zsk] [--algorithm ed25519]
|
||
easydns dnssec ds --zone Z --dir D
|
||
easydns hash-token TOKEN easydns tools
|
||
easydns completions bash|zsh|fish|elvish|powershell easydns man
|
||
```
|
||
Global: `-c/--config` (default `/etc/easydns/config.yaml`), `--api URL`, `--token`
|
||
(`EASYDNS_API_TOKEN`), `--json`.
|
||
Exit codes: 0 ok, 1 operation failed, 2 invalid usage/configuration, 3 API unreachable.
|
||
|
||
**No key needed locally.** Commands that talk to the running server (`status`, `reload`,
|
||
`zones …`, `cache …`, `query`) use the API on `127.0.0.1:9953`. Without `--token` the CLI
|
||
reads the server's local control token from `<data_dir>/control.token` (created by the
|
||
server, mode 0640, readable by root and the `easydns` group). So after installation
|
||
`sudo easydns status` simply works; add your admin user to the `easydns` group to drop
|
||
`sudo`. `--token` is only needed for remote servers or when `api.local_token: false`.
|
||
|
||
### 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`.
|
||
The zone is parsed and validated before anything is written; existing files are never
|
||
overwritten without `--force`.
|
||
|
||
```bash
|
||
# name servers inside the zone need an address (glue)
|
||
easydns zone create example.com --ns ns1.example.com=192.0.2.10 --ns ns2.example.net --ip 192.0.2.80
|
||
# external name servers only, mailbox, secondary allowed to transfer + NOTIFY, reload at once
|
||
easydns zone create example.org --ns ns1.example.net --ns ns2.example.net \
|
||
--email dns-admin@example.net --allow-transfer 198.51.100.20 --notify 198.51.100.20 --reload
|
||
# preview only
|
||
easydns zone create example.net --ns ns.example.org --dry-run
|
||
```
|
||
|
||
Result for the first command:
|
||
```
|
||
; example.com. – created by `easydns zone create`
|
||
$ORIGIN example.com.
|
||
$TTL 3600
|
||
@ IN SOA ns1.example.com. hostmaster.example.com. (
|
||
2026112201 ; serial
|
||
3600 ; refresh
|
||
900 ; retry
|
||
1209600 ; expire
|
||
300 ) ; negative TTL
|
||
@ IN NS ns1.example.com.
|
||
@ IN NS ns2.example.net.
|
||
ns1 IN A 192.0.2.10
|
||
@ IN A 192.0.2.80
|
||
```
|
||
```yaml
|
||
# /etc/easydns/zones.d/example.com.yaml
|
||
- name: example.com
|
||
type: primary
|
||
file: zones/example.com.zone
|
||
```
|
||
|
||
| Option | Meaning (default) |
|
||
|---|---|
|
||
| `--ns NAME[=IP]` | name server, repeatable (`ns1.<zone>`; in-zone names need `=IP` unless `--ip` is given) |
|
||
| `--ip IP` | `@ A`/`@ AAAA`, repeatable; also glue for a default `ns1` without its own address |
|
||
| `--email` | SOA mailbox (`hostmaster@<zone>`) |
|
||
| `--ttl` | `$TTL` (3600) |
|
||
| `--allow-transfer IP` | `transfer_acl` – secondaries allowed to transfer, **no key needed** |
|
||
| `--notify IP[:PORT]` | secondaries to NOTIFY |
|
||
| `--allow-update IP` | RFC 2136 updates from these addresses without a key |
|
||
| `--no-config` | write only the zone file and print the definition |
|
||
| `--dry-run`, `--force`, `--reload` | preview / overwrite / reload the server afterwards |
|
||
|
||
Serial: `YYYYMMDD01`. Files are created mode 0640 and, when run as root, owned by the
|
||
owner of the data directory (the `easydns` user), so the server can later write DDNS and
|
||
API changes. Then add records to the file and run `easydns reload` (or use the REST API).
|
||
|
||
## Tools
|
||
|
||
Every tool has a short and a long binary name, `--help`, `--version`, `--json` where the
|
||
output is structured. Exit codes: 0 success (a DNS answer, also NXDOMAIN for `ed`),
|
||
1 usage error / negative result (eh, eptr) / differences (ediff), 9 no reply, 10 internal error.
|
||
|
||
| Tool | Replaces | Examples |
|
||
|---|---|---|
|
||
| `ed` / `easydig` | dig | `ed @1.1.1.1 example.com MX +short`, `ed -x 8.8.8.8`, `ed example.com +dnssec +tcp`, `ed example.com --json`, `--yaml`, `--watch 5s`, `--compare 1.1.1.1,8.8.8.8`, `--benchmark 1000`, `-y hmac-sha256:key:SECRET example.com AXFR` |
|
||
| `eh` / `easyhost` | host | `eh example.com`, `eh -t MX example.com`, `eh 8.8.8.8`, `eh --all example.com`, `eh --json example.com` |
|
||
| `ens` / `easynslookup` | nslookup | `ens example.com 8.8.8.8`, `ens -type=MX example.com`, `ens --interactive` (`server X`, `set type=AAAA`, `exit`) |
|
||
| `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 ...` |
|
||
| `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) |
|
||
| `edoh` / `easydoh` | – | `edoh https://1.1.1.1/dns-query example.com --method get`, `--http2` (reports whether h2 was negotiated) |
|
||
| `edot` / `easydot` | – | `edot 1.1.1.1 example.com --tls-name cloudflare-dns.com` |
|
||
| `ewhois` / `easywhois` | whois | `ewhois example.com` (RDAP via IANA bootstrap), `ewhois --whois 192.0.2.1` |
|
||
|
||
Output colours are used only on a TTY (`--no-color`, `NO_COLOR`). The default server is the
|
||
first `nameserver` in `/etc/resolv.conf`.
|
||
|
||
`ed` and `eh` can clash with existing commands (`ed` is the classic editor). The installer
|
||
links short names only when they are free; long names are always installed.
|
||
|
||
Compatibility is tested by *meaning*: `scripts/e2e.sh` compares `ed … +short` with `dig … +short`
|
||
after sorting (RRset order and TTLs may differ).
|