ldns package icon
icedcoffee/ldns
Public
wasmer run icedcoffee/ldns

ldns — drill, the DNS debugging tool, for WASIX

drill from ldns 1.8.4, built for WASIX. It is the query tool that ships with NLnet Labs' ldns, the same people who write NSD and Unbound: dig's output shape, the same @server syntax, and the same job — ask a nameserver and show the answer.

wasmer run icedcoffee/ldns -- example.com A
wasmer run icedcoffee/ldns -- @1.1.1.1 example.com MX
wasmer run icedcoffee/ldns -- -x 8.8.8.8
wasmer run icedcoffee/ldns -- -T example.com A

How it maps onto dig

digdrill
dig name TYPEdrill name TYPE
dig @8.8.8.8 namedrill @8.8.8.8 name
dig -x 8.8.8.8drill -x 8.8.8.8
dig +tracedrill -T
dig +tcpdrill -t (and it is the default here, see below)
dig +dnssecdrill -D — not available in this build, see below
dig +shortno equivalent; use -q for a terse run

Also in the box: -S chase a delegation chain, -w file write the answer to a file, -p port, -4/-6, -b bufsize, -o mnemonic set query flags (QR, RD, CD, …), -d domain start a trace deeper, -c file use another resolv.conf, -s show the DS RR for each key, -y name:key TSIG, -v version, -V level verbosity.

Two things this runtime forces

  • TCP is the default. UDP sockets here accept socket() and bind() but every sendto() fails with EINVAL, so a datagram query can never leave the sandbox. drill is patched to start with usevc on, which means every query goes over TCP:53. -u still asks for UDP if you want to see it fail.
  • No DNSSEC. There is no OpenSSL in the WASIX sysroot, so this build has SHA2, GOST, ECDSA, DSA, ED25519/ED448 and DANE compiled out. Plain querying, trace and reverse lookups are unaffected; -D, -S and -k are not available.

The package also installs /etc/resolv.conf pointing at 1.1.1.1 and 8.8.8.8, because a WASIX box has no resolver configuration of its own and drill refuses to run without one. Override it with drill -c yourfile … or by naming a server with @.

Verified

$ drill example.com A
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 54056
;; flags: qr rd ra ; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; ANSWER SECTION:
example.com.  148  IN  A  172.66.147.243
example.com.  148  IN  A  104.20.23.154
;; SERVER: 1.1.1.1
;; Query time: 14 msec

$ drill example.com MX       -> 0 .
$ drill google.com TXT       -> TXT record returned
$ drill -x 1.1.1.1           -> one.one.one.one.
$ drill com NS               -> a.gtld-servers.net. …
$ drill -T example.com A     -> root NS set, then the delegation walk

Building

./configure --host=wasm32-wasi --build=x86_64-linux-gnu --with-drill \
            --without-pyldns --without-ssl --enable-poll \
            --disable-sha2 --disable-gost --disable-ecdsa --disable-dsa \
            --disable-ed25519 --disable-ed448 --disable-dane
make

with -matomics -mbulk-memory -mmutable-globals -pthread -mthread-model posix -ftls-model=local-exec, -D_WASI_EMULATED_{MMAN,SIGNAL,PROCESS_CLOCKS,GETPID}, -lwasi-emulated-{mman,process-clocks,getpid}, -Wl,--shared-memory -Wl,--max-memory=1073741824 -Wl,--import-memory -Wl,-z,stack-size=2097152, and the __heap_base/__stack_pointer/__wasm_init_tls/__tls_* exports.

The single source patch is in drill/drill.c: qusevc starts as true instead of false. No asyncify is needed — drill never forks.

License: BSD-3-Clause, as upstream.

ldns 1.8.4 for WASIX - drill, the DNS debugging tool, with dig-style query output


Github
icedcoffee/ldns: ldns 1.8.4 for WASIX - drill, the DNS debugging tool...