public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
* [PATCH] test if nameservers with DNSSEC support return "ad"-flagged data
@ 2018-01-20 15:25 Peter Müller
  2018-01-22 13:51 ` Michael Tremer
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Müller @ 2018-01-20 15:25 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 1378 bytes --]

DNSSEC-validating nameservers return an "ad" (Authenticated Data)
flag in the DNS response header. This can be used as a negative
indicator for DNSSEC validation: In case a nameserver does not
return the flag, but failes to look up a domain with an invalid
signature, it does not support DNSSEC validation.

This makes it easier to detect nameservers which do not fully
comply to the RFCs or try to tamper DNS queries.

See bug #11595 (https://bugzilla.ipfire.org/show_bug.cgi?id=11595) for further details.

Signed-off-by: Peter Müller <peter.mueller(a)link38.eu>
---
 src/initscripts/system/unbound | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/initscripts/system/unbound b/src/initscripts/system/unbound
index 4e7e63e5f..410631f86 100644
--- a/src/initscripts/system/unbound
+++ b/src/initscripts/system/unbound
@@ -364,7 +364,12 @@ ns_is_validating() {
 	local ns=${1}
 	shift
 
-	dig @${ns} A ${TEST_DOMAIN_FAIL} $@ | grep -q SERVFAIL
+	if ! dig @${ns} A ${TEST_DOMAIN_FAIL} $@ | grep -q SERVFAIL; then
+		return 1
+	else
+		# Determine if NS replies with "ad" data flag if DNSSEC enabled
+		dig @${ns} +dnssec SOA ${TEST_DOMAIN} $@ | grep "\;\;\ flags:" | awk -F\: '{ print $2 }' | awk -F\; '{ print $1 }' | grep -q "\ ad"
+	fi
 }
 
 # Checks if we can retrieve the DNSKEY for this domain.
-- 
2.13.6


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-24 16:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-20 15:25 [PATCH] test if nameservers with DNSSEC support return "ad"-flagged data Peter Müller
2018-01-22 13:51 ` Michael Tremer
2018-01-24 16:49   ` Peter Müller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox