Resolver operations
The pinned Unbound
Section titled “The pinned Unbound”Every image that runs Unbound builds the same release from the NLnet Labs source tarball. It does not use the version that a distribution packages. Today the release is 1.26.2.
| Image | Used by |
|---|---|
opdns-edge |
the edge with -unbound-spawn |
opdns-node |
the self-hosted node’s container |
opdns-unbound |
the fleet’s resolver job with the Docker driver |
The version and the SHA-256 of the tarball are pinned in one place. One
shared build script makes sure that the checksum is correct. It compiles
Unbound with the subnet cache (for ECS) and libevent. It compiles without
cachedb, HTTP/2 or Python. Unbound does not need HTTP/2 because the edge
terminates DoH. The script installs unbound, unbound-control,
unbound-checkconf, unbound-anchor and unbound-host.
unbound-check-version fails the build if the binary reports a different
version or lacks the subnet cache, validator, iterator or libevent. It runs
this check again in each runtime stage. The edge exports
opdns_edge_unbound_build_info{pinned, running}: the release that the
images build and the version that the running Unbound reports. The static
opdns-node binary uses the Unbound of the host.
Upgrading
Section titled “Upgrading”- Read the release notes. Look for renamed options, changed defaults and new statistics keys.
- Change the pinned
UNBOUND_VERSIONandUNBOUND_SHA256. Take the checksum from the.sha256file next to the tarball. - Make sure one time that the checksum agrees with the PGP-signed
.ascfile. - Build the images. If the checksum or the version does not match, the build fails.
- Compare the new
stats_noresetkeys with the statistics mapping of the edge. - Roll out the fleet’s
resolverjob wave by wave (fleetctl rollout).
An automated dependency update watches the Unbound release tags and opens the version bump. The bump fails until someone updates the checksum by hand. This is intentional. A security advisory comes as a patch release. For an advisory, follow the same steps on the same day. The full procedure is in the Unbound build notes in the source repository.
Unbound statistics
Section titled “Unbound statistics”Every -unbound-stats-interval (15 s), the edge runs stats_noreset over
the remote-control socket of Unbound. It exports the totals as about 40
opdns_edge_unbound_* metrics. Like every edge series, each metric has the
PoP as a label. The edge does not export per-thread keys. Some of the
metrics:
| Metric | Is |
|---|---|
queries_total, cache_hits_total, cache_misses_total, cache_hit_ratio |
load and cache efficiency |
recursion_duration_seconds |
histogram of recursion time for replies that needed recursion |
queries_by_type_total, answers_by_rcode_total, queries_by_transport_total |
traffic shape |
answers_secure_total, answers_bogus_total, rrsets_bogus_total |
DNSSEC outcomes |
requestlist_current, requestlist_exceeded_total, queries_timed_out_total |
recursion backlog |
memory_bytes{pool}, cache_entries |
memory by pool, cache sizes |
queries_subnet_total, queries_subnet_cache_total |
ECS |
queries_authzone_total |
lookups answered from the local root zone |
uptime_seconds, up, scrape_errors_total |
the uptime of Unbound and the scrape itself |
With -unbound-spawn, the socket is the one of the spawned Unbound.
Otherwise it is the socket that -unbound-control
(OPDNS_UNBOUND_CONTROL) names. Without a socket, the edge exports only
build_info. With the Docker driver, the fleet’s resolver job runs the
edge and Unbound in separate containers. For that case, a connection to the
socket through the shared directory of the allocation is planned. The
self-hosted node does not export Unbound statistics.
The opdns / edge Grafana dashboard has an Unbound row. The alerts are:
| Alert | Severity | Fires when |
|---|---|---|
UnboundCacheHitRatioLow |
ticket | under 60% of the queries of Unbound answered from cache for 15 minutes, at more than 1 query a second |
UnboundRecursionSlow |
ticket | recursion p95 over 500 ms for 15 minutes |
Tuning both thresholds on real fleet traffic is planned.
Local root zone
Section titled “Local root zone”The Unbound on every PoP keeps a copy of the root zone (RFC 8806) as
auth-zone: ".". Its own iterator uses this copy, so cold lookups skip the
root servers. Clients cannot query the copy (for-downstream: no).
Unbound transfers the copy from the published root sources and from the
HTTPS copy of ICANN. It refreshes the copy on the root SOA timers. It
accepts a copy only when its ZONEMD digest is correct. The file is
/var/lib/unbound/root.zone. The edge reads its SOA serial and
modification time (-root-zone-file). It exports
opdns_edge_root_zone_loaded, _serial and _updated_timestamp_seconds.
A missing, rejected or expired copy is not an outage. A copy expires 7 days
after the last good refresh. Without a copy, Unbound queries the root
servers like any other resolver (fallback-enabled: yes). The /healthz
endpoint and the anycast announcement do not change. Do not drain a PoP for
it.
| Alert | Severity | Fires when |
|---|---|---|
RootZoneStale |
warn | no update to the copy for 2 days |
RootZoneMissing |
warn | no copy loaded for an hour |
To see the serial that Unbound holds, run unbound-control list_auth_zones.
To force a transfer, run unbound-control auth_zone_transfer .. The root
zone runbook in the operator repository has the full diagnosis. Production
PoPs need outbound TCP and UDP 53 to the root primaries in the Unbound
configuration. The configuration gives these primaries as IP addresses
only.
A new resolver allocation starts without the file. It runs on fallback for the few seconds of the first download (about 2 MB). A sticky disk in the Nomad job, to keep the state of Unbound across rollouts, is planned.
Self-hosted nodes keep the same copy, and it is on by default. The node
renders the same auth-zone "." from the template of the edge, with the
same default sources. The zone file is <data_dir>/unbound/root.zone. The
node exports the same opdns_edge_root_zone_* series on its /metrics
endpoint, which is also on by default. The user can change the sources or
turn the copy off
(Local root zone).
Amplification
Section titled “Amplification”The open UDP path (the public resolver path) is where the fleet is open to reflection attacks. A spoofed question of 40 bytes can ask for a 4 KiB answer that goes to someone else. The edge limits the bytes that it sends back to the bytes that it receives. It does not rely on the token bucket per client alone.
All of the mitigations below are on by default. You set them with -rrl-*
flags (OPDNS_RRL_*). They apply to UDP only. TCP, DoT, DoH and DoQ prove
the source with their handshake. QUIC also limits unvalidated sends to 3x
by itself.
The target is as follows. On UDP, each client network (a /24 or /48) gets at most 4x the bytes that it sent. For queries that carry a known profile, the limit is 8x. Each network also gets an allowance of 8 KiB. Ordinary answers go out whole. If the budget of the network cannot pay for an answer, the edge truncates the answer (TC=1), and the client retries over TCP. So after the allowance is spent, a spoofed flood aimed at a victim network reflects at most 4x.
| Mitigation | Flags and defaults | Does |
|---|---|---|
| Response-size budget | -rrl-budget-factor 4, -rrl-budget-factor-identified 8, -rrl-budget-burst 8192, -rrl-minimal on |
Each client network (-rrl-ipv4-prefix, -rrl-ipv6-prefix) has a bucket of answer bytes. Every UDP question adds the factor times its size, up to the burst. Every UDP answer takes its size. If the bucket cannot pay for an answer, the edge first minimizes the answer: it strips the additional records and the NS records of a positive answer. Then it truncates the answer (TC=1). The buckets share the memory limit of RRL (-rrl-max-keys) |
| Mitigation level | normal by default. For strict: -strict-budget-factor 1, -strict-budget-burst 512, -strict-rate-do53 10 |
A runtime setting for an attack in progress. You change it without a restart. strict credits unidentified networks 1x into small buckets and lowers the Do53 rate per address. tcp-only truncates every UDP answer to an unidentified client that has no valid cookie. The level does not affect identified clients and cookie clients |
| Response rate limiting (RRL) | -rrl-responses-per-second 50, -rrl-nxdomains-per-second 50, -rrl-errors-per-second 20, -rrl-window 2s, -rrl-slip 2, -rrl-ipv4-prefix 24, -rrl-ipv6-prefix 48, -rrl-identified-scale 4 |
Counts UDP responses per client network and per kind. A flood aims at a victim network, not at one address. The kinds are answers by name and type, NXDOMAIN by parent domain (random subdomains share a bucket), and errors by rcode. Over the rate, every second limited response is a bare TC=1 answer. The edge drops the rest. Identified responses have their own buckets at 4x the rates, so a flood on the public path cannot throttle a customer |
| ANY | -rrl-minimal-any on |
ANY over UDP gets the synthesized HINFO answer of RFC 8482. The edge forwards ANY whole only over streams |
| UDP payload cap | fixed, 1232 bytes | Advertised on every OPT record and enforced above the budget, also for a source that a cookie verified |
| DNS cookies | -rrl-cookies on, -rrl-cookie-secret |
RFC 7873 with RFC 9018 server cookies. A client that echoes a valid server cookie proved its address. That client is exempt from the budget and from RRL. The 1232-byte cap and the token bucket still limit it. A client cookie alone gets a fresh server cookie. A malformed cookie option gets FORMERR. The edge answers cookies on every transport and never forwards them to Unbound |
The defaults for RRL are a first pass. Tuning them on real PoP traffic is planned. A busy NAT behind one /24 is the case to watch.
The audit
Section titled “The audit”We measured the values below against opdns-edge with the pinned Unbound
and every mitigation on. The table shows the UDP bytes on the wire for the
request and the response, and the factor that they give. The last two
columns show the same answer whole over TCP. That is the reflected volume
without a UDP cap.
| Query (UDP) | Unidentified req/resp B | Factor | TC | Identified req/resp B | Factor | TC | TCP resp B | Uncapped factor |
|---|---|---|---|---|---|---|---|---|
| ANY (RFC 8482 HINFO) | 37/58 | 1.57x | no | 37/58 | 1.57x | no | 115 | 3.11x |
| TXT ~700 B | 37/37 | 1.00x | yes | 37/37 | 1.00x | yes | 760 | 20.5x |
| TXT ~1,100 B | 39/39 | 1.00x | yes | 39/39 | 1.00x | yes | 1154 | 29.6x |
| TXT ~4 KiB | 37/37 | 1.00x | yes | 37/37 | 1.00x | yes | 4457 | 120x |
| DNSKEY +DO (RRSIG) | 40/40 | 1.00x | yes | 40/40 | 1.00x | yes | 1110 | 27.8x |
| signed CNAME chain +DO | 43/43 | 1.00x | yes | 43/43 | 1.00x | yes | 686 | 16.0x |
| signed NXDOMAIN +DO (NSEC) | 45/45 | 1.00x | yes | 45/45 | 1.00x | yes | 578 | 12.8x |
| A, EDNS buffer 4096 | 35/51 | 1.46x | no | 35/51 | 1.46x | no | 57 | 1.63x |
id.server CH TXT |
38/58 | 1.53x | no | 38/58 | 1.53x | no | 67 | 1.76x |
| REFUSED (unknown class) | 35/35 | 1.00x | no | 35/35 | 1.00x | no | 35 | 1.00x |
| A, small answer | 35/51 | 1.46x | no | 35/51 | 1.46x | no | 57 | 1.63x |
Every response stays under the target. The answers that are worth reflecting truncate to a TC=1 packet that is not bigger than the question. A plain DNS question is only about 40 bytes. So 4x of it (about 160 bytes) still truncates a DNSKEY or signed answer, and identified customers also fetch large answers over TCP. That is the intended outcome, not a regression.
A load test sent a reflection-shaped mix at 20,000 queries a second. Before the mitigations, the edge reflected 13.7x the bytes that it received. After the mitigations, it reflected 0.5x, because slip and drops send back less than arrives. An identified client that queried the same edge kept its p99 at 3.3 ms. The test fails above 2x or above a 20 ms p99.
Metrics
Section titled “Metrics”| Metric | Is |
|---|---|
opdns_edge_amplification_capped_total{identified,action} |
UDP answers minimized or truncated to fit the budget |
opdns_edge_rrl_limited_total{class,action} |
responses that RRL held back, by class (answer, nxdomain, error) and action (slipped as TC=1, dropped) |
opdns_edge_cookies_total{state} |
queries with a cookie option: client (a server cookie issued), valid (source verified), malformed (FORMERR) |
opdns_edge_udp_bytes_total{identified,direction} |
UDP bytes in and out, for the reflected ratio that the edge actually serves |
Unknown profile ids
Section titled “Unknown profile ids”Some queries name a profile that the edge does not hold. The id is unknown or deleted, on the DoH path, in the DoT/DoQ server name or in an IPv6 profile address. Other queries claim a profile but encode none: a malformed or foreign server name, or a reserved address in the profile prefix. The edge answers both kinds exactly as if they named no profile:
- On the public path, unfiltered.
- Under the rate limits and the amplification budget for unidentified clients.
- With the ECS opt-out.
- Not logged.
- With no EDE that says that the id is unknown.
opdns_edge_identification_total counts them as none.
opdns_edge_unknown_profile_total{reason} counts them by reason: unknown
for an unknown or deleted id, and invalid for an address or server name
that encodes none. A steady unknown rate from a few networks suggests a
device with a stale id, or someone who enumerates ids. You can throttle or
block such a source through the source-block list, like any other source.
A self-hosted node does the same, so on a self-hosted node these queries
get the node’s own profile.
Container limits
Section titled “Container limits”At start, the edge reads its cgroup v2 limits. It sets GOMAXPROCS from
the CPU quota (cpu.max) or the CPU set. It sets the Go soft memory limit
(GOMEMLIMIT) to 90% of memory.max. So the edge uses exactly its Nomad
share, and the garbage collector reacts before the kernel kills the task.
The remaining 10% covers memory that the Go limit does not count, such as
the memory-mapped pages of the list artifact. If GOMAXPROCS or
GOMEMLIMIT is set in the environment, that value wins.