Script icon
Docker icon
If icon
SlackIncomingWebhook icon
Log icon
Return icon
Schedule icon

Unbound Recursive DNS SERVFAIL and DNSSEC Bogus Sentinel

Audits Unbound validating recursive DNS resolver SERVFAIL spikes and DNSSEC bogus verification errors to prevent upstream lookup failures.

Categories
CloudInfrastructure

Audits Unbound validating recursive DNS resolver metrics across enterprise infrastructure to detect elevated SERVFAIL reply codes, DNSSEC cryptographic validation errors, and upstream recursive timeouts.

How it works

  1. A schedule trigger executes the recursive DNS audit workflow every 15 minutes.
  2. The Python task queries the Unbound Prometheus exporter endpoint (unbound-exporter:9167).
  3. The script extracts cumulative SERVFAIL error flags, DNSSEC bogus verification counters, total queries, and cache hit metrics.
  4. An evaluation gate determines whether SERVFAIL replies or DNSSEC validation failures breach operational tolerance ceilings.
  5. When thresholds are breached, a high-priority Slack alert is dispatched to DNS operations engineers.
  6. When resolution proceeds normally and cache hit ratios remain healthy, nominal telemetry is logged.
  7. A structured JSON audit manifest is emitted for enterprise DNS governance and resolver SLA compliance archives.

Architecture diagram

graph TD
    Trigger[Schedule Trigger: 15m] --> ScanMetrics[Python Script: Scrape Unbound Exporter Metrics]
    ScanMetrics --> EvalBreach{SERVFAIL Replies >= Threshold OR DNSSEC Bogus > 10?}
    EvalBreach -- Yes --> SlackAlert[Slack: High-Urgency DNS Alert]
    EvalBreach -- No --> LogNominal[Log: Nominal Recursive DNS Status]
    SlackAlert --> EmitManifest[Debug Return: Unbound Audit Manifest]
    LogNominal --> EmitManifest

Architecture components

  • Trigger: Automated schedule polling at 15-minute intervals.
  • Script Task: Scrapes Unbound Prometheus exporter metrics using Docker container isolation.
  • Decision Gate: Evaluates whether SERVFAIL reply rates or DNSSEC failures exceed operational thresholds.
  • Notification Task: Dispatches structured Slack alerts with cluster identity and failure metrics.
  • Audit Manifest: Emits JSON execution payloads containing resolution metrics and timestamps.

Key capabilities

  • Continuous surveillance of enterprise Unbound recursive caching resolver performance.
  • Rapid detection of upstream authoritative root and TLD server reachability dropouts.
  • Immediate identification of DNSSEC validation failures caused by expired RRSIG cryptographic records.
  • Zero external dependency execution via isolated containerized Python runners.

What you get

  • Preemptive alerting on corporate recursive DNS degradation before users experience service lookup failures.
  • Automated tracking of cache hit ratios to identify DNS cache eviction storms and TTL anomalies.
  • Real-time audit manifests capturing resolver health for SOC 2 and ISO 27001 compliance.
  • Configurable tolerance thresholds adaptable to internal office resolvers and public DNS fleets.

Who it's for

  • Enterprise network engineers maintaining internal Unbound and Pi-hole recursive resolvers.
  • SREs overseeing Kubernetes CoreDNS upstream recursive forwarding layers.
  • Security operations analysts investigating DNS hijacking, cache poisoning, and DNSSEC validation stalls.
  • Platform engineers diagnosing intermittent external third-party API resolution timeouts.

Why orchestrate this with Kestra

  • Deterministic Scheduling: Guarantees regular health audits without reliance on local host cron daemons.
  • Containerized Runners: Runs Python tasks inside isolated Docker containers without host library dependencies.
  • Condition Branching: Flowable If tasks route alerts and nominal logging cleanly without custom glue code.
  • Enterprise Secret Safety: Securely injects Slack webhook credentials without plain-text exposure.

Use cases

  • Expired DNSSEC RRSIG Key: Detects when an upstream domain owner forgets to roll DNSSEC keys, causing bogus errors.
  • ISP Upstream Forwarder Outage: Alerts when external ISP recursive forwarders go dark during fiber cuts.
  • EDNS Buffer Size Truncation: Identifies SERVFAIL reply spikes caused by network firewalls stripping EDNS0 UDP packets.
  • Cache Thrashing Detection: Surfaces misconfigured short TTLs forcing excessive upstream recursive recursions.

Inputs

Name Type Default Description
unbound_metrics_url STRING http://unbound-exporter.dns.svc.cluster.local:9167 Base HTTP URL exposing Unbound Prometheus metrics.
resolver_cluster_id STRING internal-resolver-pool-01 Target recursive resolver cluster identifier under surveillance.
max_servfail_threshold INT 25 Maximum allowable SERVFAIL replies before triggering alerts.
lookback_minutes INT 15 Lookback evaluation window in minutes for failure rates.
alert_on_servfail_spikes BOOL true Toggle Slack alert dispatch upon detecting SERVFAIL spikes.

Expected outputs

  • {{ outputs.scan_unbound_resolver_metrics.vars.servfail_reply_count }}: Cumulative number of SERVFAIL response codes.
  • {{ outputs.scan_unbound_resolver_metrics.vars.dnssec_bogus_count }}: Count of cryptographic DNSSEC validation failures.
  • {{ outputs.scan_unbound_resolver_metrics.vars.total_queries_evaluated }}: Total number of recursive queries processed.
  • {{ outputs.scan_unbound_resolver_metrics.vars.cache_hit_ratio_percent }}: Percentage of queries answered from cache.
  • {{ outputs.scan_unbound_resolver_metrics.vars.is_alerting }}: Boolean flag indicating whether failure thresholds were breached.
  • {{ outputs.emit_audit_manifest.value }}: Structured JSON audit manifest emitted for compliance archives.

Prerequisites

  • Unbound daemon deployed with extended-statistics: yes enabled in unbound.conf.
  • Unbound Prometheus exporter port 9167 reachable from the Kestra worker execution environment.
  • Docker daemon running on the Kestra host to execute containerized Python tasks.

Secrets

  • SLACK_WEBHOOK_URL: Incoming webhook URL for the target DNS Operations Slack alerting channel.

Quick start

  1. Ensure unbound.conf contains statistics-interval: 0 and extended-statistics: yes.
  2. Configure the SLACK_WEBHOOK_URL secret in your Kestra namespace settings.
  3. Specify your resolver pool name in resolver_cluster_id.
  4. Execute a manual test run via the Kestra UI to verify metric ingestion.
  5. Enable the periodic_unbound_audit trigger to establish automated continuous surveillance.

Common pitfalls and troubleshooting

  • Unbound Control Socket Access: Verify that unbound_exporter has read permissions to /var/run/unbound.ctl.
  • Root Trust Anchor Stale: An outdated /etc/unbound/root.key causes all DNSSEC-signed queries to return SERVFAIL.
  • UDP Buffer Overflows: Ensure OS kernel net.core.rmem_max is tuned to prevent dropped UDP query frames.
  • Access Control Restrictions: Check access-control clauses in unbound.conf to avoid unintended query rejections.

How to extend

  • Automated Cache Flush Sub-Flow: Trigger an automated unbound-control flush_zone command when stale records occur.
  • Trust Anchor Re-anchor Drill: Chain a task to update root trust anchors using unbound-anchor upon DNSSEC failures.
  • PagerDuty Escalation: Escalate to on-call network engineers when SERVFAIL rate exceeds 5% of total query volume.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.