From 2586526a0a4454657470f5de56817536abc93396 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Wed, 25 Oct 2017 01:00:58 -0700 Subject: [PATCH] [v9_10] log when update-policy local gets a key match from a remote host 4788. [cleanup] When using "update-policy local", log a warning when an update matching the session key is received from a remote host. [RT #46213] - this completes change #4762. --- CHANGES | 4 ++++ bin/tests/system/nsupdate/tests.sh | 2 ++ lib/dns/include/dns/log.h | 1 + lib/dns/log.c | 1 + lib/dns/ssu.c | 11 ++++++++++- 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index f279a578fa..0726f89d43 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +4788. [cleanup] When using "update-policy local", log a warning + when an update matching the session key is received + from a remote host. [RT #46213] + 4787. [cleanup] Turn nsec3param_salt_totext() into a public function, dns_nsec3param_salttotext(), and add unit tests for it. [RT #46289] diff --git a/bin/tests/system/nsupdate/tests.sh b/bin/tests/system/nsupdate/tests.sh index 97e96fbf79..9b3df2428f 100755 --- a/bin/tests/system/nsupdate/tests.sh +++ b/bin/tests/system/nsupdate/tests.sh @@ -497,6 +497,7 @@ fi n=`expr $n + 1` ret=0 echo "I:check that 'update-policy local' fails from non-localhost address ($n)" +grep 'match on session key not from localhost' ns5/named.run > /dev/null && ret=1 $NSUPDATE -p 5300 -k ns5/session.key > nsupdate.out.$n 2>&1 << END && ret=1 server 10.53.0.5 5300 local 10.53.0.1 @@ -504,6 +505,7 @@ update add nonlocal.local.nil. 600 A 4.3.2.1 send END grep REFUSED nsupdate.out.$n > /dev/null 2>&1 || ret=1 +grep 'match on session key not from localhost' ns5/named.run > /dev/null || ret=1 $DIG @10.53.0.5 -p 5300 \ +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd \ nonlocal.local.nil. > dig.out.ns5.$n || ret=1 diff --git a/lib/dns/include/dns/log.h b/lib/dns/include/dns/log.h index 845be49907..b9e731b410 100644 --- a/lib/dns/include/dns/log.h +++ b/lib/dns/include/dns/log.h @@ -78,6 +78,7 @@ LIBDNS_EXTERNAL_DATA extern isc_logmodule_t dns_modules[]; #define DNS_LOGMODULE_DNSSEC (&dns_modules[27]) #define DNS_LOGMODULE_CRYPTO (&dns_modules[28]) #define DNS_LOGMODULE_PACKETS (&dns_modules[29]) +#define DNS_LOGMODULE_SSU (&dns_modules[30]) ISC_LANG_BEGINDECLS diff --git a/lib/dns/log.c b/lib/dns/log.c index 377b03c839..b7bde96ef8 100644 --- a/lib/dns/log.c +++ b/lib/dns/log.c @@ -84,6 +84,7 @@ LIBDNS_EXTERNAL_DATA isc_logmodule_t dns_modules[] = { { "dns/dnssec", 0 }, { "dns/crypto", 0 }, { "dns/packets", 0 }, + { "dns/ssu", 0 }, { NULL, 0 } }; diff --git a/lib/dns/ssu.c b/lib/dns/ssu.c index 9a8e4a3094..491ba4a08e 100644 --- a/lib/dns/ssu.c +++ b/lib/dns/ssu.c @@ -431,12 +431,21 @@ dns_ssutable_checkrules2(dns_ssutable_t *table, dns_name_t *signer, continue; } if (!dns_name_issubdomain(name, rule->name)) { - continue; } dns_acl_match(addr, NULL, env->localhost, NULL, &match, NULL); if (match == 0) { + if (signer != NULL) { + isc_log_write(dns_lctx, + DNS_LOGCATEGORY_GENERAL, + DNS_LOGMODULE_SSU, + ISC_LOG_WARNING, + "update-policy local: " + "match on session " + "key not from " + "localhost"); + } continue; } break;