Merge branch '2642-reduce-the-maximum-nsec3-iterations-that-can-be-configured-v9_11' into 'v9_11'
Reduce nsec3 max iterations to 150 (9.11) See merge request isc-projects/bind9!4967
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
5629. [func] Reduce the supported maximum number of iterations
|
||||
that can be configured in an NSEC3 zone to 150.
|
||||
[GL #2642]
|
||||
|
||||
--- 9.11.31 released ---
|
||||
|
||||
5621. [bug] Due to a backporting mistake in change 5609, named
|
||||
|
||||
@@ -176,8 +176,9 @@ static bool remove_orphansigs = false;
|
||||
static bool remove_inactkeysigs = false;
|
||||
static bool output_dnssec_only = false;
|
||||
static bool output_stdout = false;
|
||||
bool set_maxttl = false;
|
||||
static bool set_maxttl = false;
|
||||
static dns_ttl_t maxttl = 0;
|
||||
static bool no_max_check = false;
|
||||
|
||||
#define INCSTAT(counter) \
|
||||
if (printstats) { \
|
||||
@@ -3275,6 +3276,12 @@ main(int argc, char *argv[]) {
|
||||
|
||||
case 'H':
|
||||
set_iter = true;
|
||||
/* too-many is NOT DOCUMENTED */
|
||||
if (strcmp(isc_commandline_argument, "too-many") == 0) {
|
||||
nsec3iter = 151;
|
||||
no_max_check = true;
|
||||
break;
|
||||
}
|
||||
nsec3iter = strtoul(isc_commandline_argument, &endp, 0);
|
||||
if (*endp != '\0')
|
||||
fatal("iterations must be numeric");
|
||||
@@ -3682,7 +3689,6 @@ main(int argc, char *argv[]) {
|
||||
warnifallksk(gdb);
|
||||
|
||||
if (IS_NSEC3) {
|
||||
unsigned int max;
|
||||
bool answer;
|
||||
|
||||
hash_length = dns_nsec3_hashlength(dns_hash_sha1);
|
||||
@@ -3699,11 +3705,17 @@ main(int argc, char *argv[]) {
|
||||
fatal("NSEC3 generation requested with "
|
||||
"NSEC-only DNSKEY");
|
||||
|
||||
result = dns_nsec3_maxiterations(gdb, NULL, mctx, &max);
|
||||
check_result(result, "dns_nsec3_maxiterations()");
|
||||
if (nsec3iter > max)
|
||||
fatal("NSEC3 iterations too big for weakest DNSKEY "
|
||||
"strength. Maximum iterations allowed %u.", max);
|
||||
if (nsec3iter > dns_nsec3_maxiterations()) {
|
||||
if (no_max_check) {
|
||||
fprintf(stderr,
|
||||
"Ignoring max iterations check.\n");
|
||||
} else {
|
||||
fatal("NSEC3 iterations too big. Maximum "
|
||||
"iterations allowed %u.",
|
||||
dns_nsec3_maxiterations());
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
hashlist_init(&hashlist, 0, 0); /* silence clang */
|
||||
}
|
||||
|
||||
+3
-1
@@ -78,6 +78,7 @@
|
||||
#include <dns/lib.h>
|
||||
#include <dns/master.h>
|
||||
#include <dns/masterdump.h>
|
||||
#include <dns/nsec3.h>
|
||||
#include <dns/nta.h>
|
||||
#include <dns/order.h>
|
||||
#include <dns/peer.h>
|
||||
@@ -13469,7 +13470,8 @@ ns_server_signing(ns_server_t *server, isc_lex_t *lex, isc_buffer_t **text) {
|
||||
if (n != 3U)
|
||||
return (ISC_R_BADNUMBER);
|
||||
|
||||
if (hash > 0xffU || flags > 0xffU)
|
||||
if (hash > 0xffU || flags > 0xffU ||
|
||||
iter > dns_nsec3_maxiterations())
|
||||
return (ISC_R_RANGE);
|
||||
|
||||
ptr = next_token(lex, text);
|
||||
|
||||
+3
-5
@@ -1940,7 +1940,7 @@ check_dnssec(ns_client_t *client, dns_zone_t *zone, dns_db_t *db,
|
||||
dns_difftuple_t *tuple;
|
||||
bool nseconly = false, nsec3 = false;
|
||||
isc_result_t result;
|
||||
unsigned int iterations = 0, max;
|
||||
unsigned int iterations = 0;
|
||||
dns_rdatatype_t privatetype = dns_zone_getprivatetype(zone);
|
||||
|
||||
/* Scan the tuples for an NSEC-only DNSKEY or an NSEC3PARAM */
|
||||
@@ -1994,11 +1994,9 @@ check_dnssec(ns_client_t *client, dns_zone_t *zone, dns_db_t *db,
|
||||
|
||||
/* Verify NSEC3 params */
|
||||
CHECK(get_iterations(db, ver, privatetype, &iterations));
|
||||
CHECK(dns_nsec3_maxiterations(db, ver, client->mctx, &max));
|
||||
if (max != 0 && iterations > max) {
|
||||
if (iterations > dns_nsec3_maxiterations()) {
|
||||
update_log(client, zone, ISC_LOG_ERROR,
|
||||
"too many NSEC3 iterations (%u) for "
|
||||
"weakest DNSKEY (%u)", iterations, max);
|
||||
"too many NSEC3 iterations (%u)", iterations);
|
||||
result = DNS_R_REFUSED;
|
||||
goto failure;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
#include <dns/masterdump.h>
|
||||
#include <dns/message.h>
|
||||
#include <dns/name.h>
|
||||
#include <dns/nsec3.h>
|
||||
#include <dns/rcode.h>
|
||||
#include <dns/rdata.h>
|
||||
#include <dns/rdataclass.h>
|
||||
@@ -1993,6 +1994,19 @@ update_addordelete(char *cmdline, bool isdelete) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!isdelete && rdata->type == dns_rdatatype_nsec3param) {
|
||||
dns_rdata_nsec3param_t nsec3param;
|
||||
|
||||
result = dns_rdata_tostruct(rdata, &nsec3param, NULL);
|
||||
check_result(result, "dns_rdata_tostruct");
|
||||
if (nsec3param.iterations > dns_nsec3_maxiterations()) {
|
||||
fprintf(stderr,
|
||||
"NSEC3PARAM has excessive iterations (> %u)\n",
|
||||
dns_nsec3_maxiterations());
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
|
||||
doneparsing:
|
||||
|
||||
result = dns_message_gettemprdatalist(updatemsg, &rdatalist);
|
||||
|
||||
@@ -25,6 +25,7 @@ rm -f ./canonical?.*
|
||||
rm -f ./delv.out*
|
||||
rm -f ./delve.out*
|
||||
rm -f ./dig.out.*
|
||||
rm -f ./ns2/too-many-iterations.db
|
||||
rm -f ./dnssectools.out*
|
||||
rm -f ./dsfromkey.out.*
|
||||
rm -f ./keygen.err
|
||||
|
||||
@@ -33,3 +33,5 @@ ns6.optout-tld. A 10.53.0.6
|
||||
in-addr.arpa. NS ns2.example.
|
||||
inprogress. NS ns10.inprogress.
|
||||
ns10.inprogress. A 10.53.0.10
|
||||
too-many-iterations. NS ns2.too-many-iterations.
|
||||
ns2.too-many-iterations. A 10.53.0.2
|
||||
|
||||
@@ -25,6 +25,7 @@ echo_i "ns1/sign.sh"
|
||||
cp ../ns2/dsset-example$TP .
|
||||
cp ../ns2/dsset-dlv$TP .
|
||||
cp ../ns2/dsset-in-addr.arpa$TP .
|
||||
cp ../ns2/dsset-too-many-iterations$TP .
|
||||
|
||||
grep "$DEFAULT_ALGORITHM_NUMBER [12] " ../ns2/dsset-algroll$TP > dsset-algroll$TP
|
||||
cp ../ns6/dsset-optout-tld$TP .
|
||||
|
||||
@@ -168,4 +168,9 @@ zone "corp" {
|
||||
file "corp.db";
|
||||
};
|
||||
|
||||
zone "too-many-iterations" {
|
||||
type master;
|
||||
file "too-many-iterations.db.signed";
|
||||
};
|
||||
|
||||
include "trusted.conf";
|
||||
|
||||
@@ -291,3 +291,14 @@ $DSFROMKEY -C $key1.key > $key1.cds
|
||||
cat $infile $key1.key $key2.key $key1.cdnskey $key1.cds > $zonefile
|
||||
# Don't sign, let auto-dnssec maintain do it.
|
||||
mv $zonefile $zonefile.signed
|
||||
|
||||
#
|
||||
# Negative result from this zone should come back as insecure.
|
||||
#
|
||||
zone=too-many-iterations
|
||||
infile=too-many-iterations.db.in
|
||||
zonefile=too-many-iterations.db
|
||||
key1=$("$KEYGEN" -q -a "$DEFAULT_ALGORITHM" -b "$DEFAULT_BITS" -n zone -f KSK "$zone")
|
||||
key2=$("$KEYGEN" -q -a "$DEFAULT_ALGORITHM" -b "$DEFAULT_BITS" -n zone "$zone")
|
||||
cat "$infile" "$key1.key" "$key2.key" > "$zonefile"
|
||||
"$SIGNER" -P -3 - -H too-many -g -o "$zone" "$zonefile" > /dev/null 2>&1
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
;
|
||||
; This Source Code Form is subject to the terms of the Mozilla Public
|
||||
; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
; file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
;
|
||||
; See the COPYRIGHT file distributed with this work for additional
|
||||
; information regarding copyright ownership.
|
||||
|
||||
$TTL 30 ; 5 minutes
|
||||
@ IN SOA mname1. . (
|
||||
2000042407 ; serial
|
||||
20 ; refresh (20 seconds)
|
||||
20 ; retry (20 seconds)
|
||||
1814400 ; expire (3 weeks)
|
||||
30 ; minimum (1 hour)
|
||||
)
|
||||
NS ns2
|
||||
ns2 A 10.53.0.2
|
||||
ns3 A 10.53.0.3
|
||||
|
||||
a A 10.0.0.1
|
||||
*.a A 10.0.0.3
|
||||
b A 10.0.0.2
|
||||
d A 10.0.0.4
|
||||
@@ -333,6 +333,12 @@ zone "unsupported.trusted" {
|
||||
file "unsupported.trusted.db.signed";
|
||||
};
|
||||
|
||||
zone "too-many-iterations" {
|
||||
type slave;
|
||||
masters { 10.53.0.2; };
|
||||
file "too-many-iterations.bk";
|
||||
};
|
||||
|
||||
include "siginterval.conf";
|
||||
|
||||
include "trusted.conf";
|
||||
|
||||
@@ -25,6 +25,7 @@ options {
|
||||
dnssec-validation auto;
|
||||
bindkeys-file "managed.conf";
|
||||
dnssec-accept-expired yes;
|
||||
minimal-responses no;
|
||||
};
|
||||
|
||||
key rndc_key {
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
; This is a key-signing key, keyid 15002, for example.com.
|
||||
; Created: 20210423012926 (Fri Apr 23 11:29:26 2021)
|
||||
; Publish: 20210423012926 (Fri Apr 23 11:29:26 2021)
|
||||
; Activate: 20210423012926 (Fri Apr 23 11:29:26 2021)
|
||||
example.com. IN DNSKEY 257 3 8 AwEAAdp+oCXl7vpKA3Mmyndx6/iA+wLrtxeMUiWL7uWJ9ZF24EdS8Dye 63p0lGlyvjvM9T5dTiyEpTAdutEBr79H0MlDqIBqpadrCdJRI2S4kC+0 nq5+Aj2CEyiAamPGujwWeXwtfLAvVPfBqs42PBr6wPQIJOByFYDaZBU3 enUEWgHYy/7OnJDrt0QlswKph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+TY93kxICO/ee9/v0hXgLmrKUkS1Kwu4a1PxLX5U/LAzXPR6zF+EHP9OKFjDRWHqN0=
|
||||
Prime2: 3YU9QdtsXofjNmlDETRwemKv45pa0oVNPmNvS1vtzIpQ3m/QSuhJxzyTgSP9x1XMiIsg63er3LOCtkRifXVE1IBrfIUgchp8YD5LsyesRl2ielE8Hw8PwSA1YjUVu90yRHcVfbZJ8lm2KyRKHgDWXz94t2Xnm/9M5XjUGuNW7l0=
|
||||
Exponent1: 7KIkpJYZyvW4ZAFk10sMgiUBMbs4f2D2i509YUC9ga4YJD7wVpVncN1nxS9L19RCopl7KbUo+yxDm8TX/dzhu3j7VVLFqbPiM1Cfw/mZUhszoii3ezFFPpbOl4rKRl66I0TSGvEKNoDfYrBPavby7Rf/wHRveifZRXspgpeMvRk=
|
||||
Exponent2: yvvtjuxW2CRiopg/+YL40lyd2cy2DpRRnKqW8BHzzGquAbWpwwopmOS8MSjewgqv2irK5pmJJTpku0nciiOsB6EJXVfLzGLSt4o96ZOf+/aPDNBla/xsLkaqRCxqlvPwvOX2DnS8O9PS5qNhOy7/QNYzcrJxUfPV7awTh/Pr040=
|
||||
Coefficient: PHxU1tqPKTpI/8nABvso0SRerc1m+RPWGRk7s/SVcADSBvEW7fUDcwiZeRfK9MdlwPvLiVozbYnRbgRQl8GuKSqAD1+Cnvn2yOQk81AgNKbuKPwF7UvKIdq/c/xnhj2bvZUVSavJ91ux/RlZNP50378Ks8bj5HJl1xzAMVHXB5o=
|
||||
Created: 20210423012926
|
||||
Publish: 20210423012926
|
||||
Activate: 20210423012926
|
||||
@@ -0,0 +1,5 @@
|
||||
; This is a zone-signing key, keyid 63613, for example.com.
|
||||
; Created: 20210423012810 (Fri Apr 23 11:28:10 2021)
|
||||
; Publish: 20210423012810 (Fri Apr 23 11:28:10 2021)
|
||||
; Activate: 20210423012810 (Fri Apr 23 11:28:10 2021)
|
||||
example.com. IN DNSKEY 256 3 8 AwEAAZzun7bYfjmGDwUEn4pyJG34v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H9HV0hS0w9SKCUyoeOVwf/JZL4hlfoe8+jglsyJpAgoQ==
|
||||
Prime1: zeXvO3PT4iXv9GlGeebl39pF1sXs8tXY4B9VHUJGGSYlyOlyCEy4URQJIPfuL6VjFKCErSxUJSrGz0HyQuKr8l9qP/0MGxGRH7wxvUR7YTmai84yyQ4fFENRmn8bzxGwj0MVHIW7cKC59j7nWT24gseT21/NP5m8EnPsjz/K40M=
|
||||
Prime2: wx5vVFSydUfr8HtOHNS1kRrTjhnQOfjmj8SxGi72Hk+mgi9fBCTC5fRLifd80wGbgyFk1vZOXeStOC8L3IlnBGLX0O9MNip+vVX3hRzIRhLwHhL1ygN3xEd04qwVH0XJ8+4A0XCzh/FJgW59F62geN6gwedo7GmZAOSZUBAyRHk=
|
||||
Exponent1: IlkqeLuQ7Fgx2I87b5iiXp62Keco6TXdkT4I3/GvagCgKw0utc2+rd/uye4ycQZhKg7BM3aCrxScx/STaq8PykY6nmQjgdyDXkzx60YiYwzOCGakuD+/1YyJb4Gm7PthffTN780rgNV/UGIcDBoszrxmoSExR1vpMRbfruIQgas=
|
||||
Exponent2: or0Os/KUibc79W6Snv9WlLkgPAQRpViQzNaLtD/47R0Xzrs975HNsMgJ/P+bb86Ga1994MC8ahmh1BuBNCax8nmScWQ1V3QoEzjRYoe4DqIa/aposF4mFWJX/fry/wtRPo+CxSzPwJGh8j86PHaHQmjFAhVFcPE+OP1xVdK8alk=
|
||||
Coefficient: r5wPmPXUF5pVC0Y7La3jVkL4w/3wvq9LBz91tH9gA8OUNLpDDBuFZISiJdhOZ4JVw+qSSoHcEa+3Phd+BqxmXzwZDU1Fqta9mLDDGCqCWjVQOopeeJgrvkv9P0TIzEuoGmW50cQhyqHYCtuUxjOnHfiQSc53p7rfD4Vom1VQ3Ok=
|
||||
Created: 20210423012810
|
||||
Publish: 20210423012810
|
||||
Activate: 20210423012810
|
||||
@@ -0,0 +1,17 @@
|
||||
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
;
|
||||
; This Source Code Form is subject to the terms of the Mozilla Public
|
||||
; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
; file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
;
|
||||
; See the COPYRIGHT file distributed with this work for additional
|
||||
; information regarding copyright ownership.
|
||||
|
||||
; This is a zone which has two DNSKEY records, both of which have
|
||||
; existing private key files available. They should be loaded automatically
|
||||
; and the zone correctly signed.
|
||||
;
|
||||
$TTL 3600
|
||||
example.com. IN SOA ns hostmaster 00090000 1200 3600 604800 300
|
||||
$include Kexample.com.+008+63613.key
|
||||
$include Kexample.com.+008+15002.key
|
||||
@@ -1334,7 +1334,7 @@ echo_i "basic dnssec-signzone checks:"
|
||||
echo_ic "two DNSKEYs ($n)"
|
||||
ret=0
|
||||
(
|
||||
cd signer/general
|
||||
cd signer/general || exit 1
|
||||
rm -f signed.zone
|
||||
$SIGNER -f signed.zone -o example.com. test1.zone > signer.out.$n 2>&1
|
||||
test -f signed.zone
|
||||
@@ -1346,7 +1346,7 @@ status=`expr $status + $ret`
|
||||
echo_ic "one non-KSK DNSKEY ($n)"
|
||||
ret=0
|
||||
(
|
||||
cd signer/general
|
||||
cd signer/general || exit 0
|
||||
rm -f signed.zone
|
||||
$SIGNER -f signed.zone -o example.com. test2.zone > signer.out.$n 2>&1
|
||||
test -f signed.zone
|
||||
@@ -1358,7 +1358,7 @@ status=`expr $status + $ret`
|
||||
echo_ic "one KSK DNSKEY ($n)"
|
||||
ret=0
|
||||
(
|
||||
cd signer/general
|
||||
cd signer/general || exit 0
|
||||
rm -f signed.zone
|
||||
$SIGNER -f signed.zone -o example.com. test3.zone > signer.out.$n 2>&1
|
||||
test -f signed.zone
|
||||
@@ -1370,7 +1370,7 @@ status=`expr $status + $ret`
|
||||
echo_ic "three DNSKEY ($n)"
|
||||
ret=0
|
||||
(
|
||||
cd signer/general
|
||||
cd signer/general || exit 1
|
||||
rm -f signed.zone
|
||||
$SIGNER -f signed.zone -o example.com. test4.zone > signer.out.$n 2>&1
|
||||
test -f signed.zone
|
||||
@@ -1382,7 +1382,7 @@ status=`expr $status + $ret`
|
||||
echo_ic "three DNSKEY, one private key missing ($n)"
|
||||
ret=0
|
||||
(
|
||||
cd signer/general
|
||||
cd signer/general || exit 1
|
||||
rm -f signed.zone
|
||||
$SIGNER -f signed.zone -o example.com. test5.zone > signer.out.$n 2>&1
|
||||
test -f signed.zone
|
||||
@@ -1394,7 +1394,7 @@ status=`expr $status + $ret`
|
||||
echo_ic "four DNSKEY ($n)"
|
||||
ret=0
|
||||
(
|
||||
cd signer/general
|
||||
cd signer/general || exit 1
|
||||
rm -f signed.zone
|
||||
$SIGNER -f signed.zone -o example.com. test6.zone > signer.out.$n 2>&1
|
||||
test -f signed.zone
|
||||
@@ -1406,7 +1406,7 @@ status=`expr $status + $ret`
|
||||
echo_ic "two DNSKEY, both private keys missing ($n)"
|
||||
ret=0
|
||||
(
|
||||
cd signer/general
|
||||
cd signer/general || exit 0
|
||||
rm -f signed.zone
|
||||
$SIGNER -f signed.zone -o example.com. test7.zone > signer.out.$n 2>&1
|
||||
test -f signed.zone
|
||||
@@ -1418,7 +1418,7 @@ status=`expr $status + $ret`
|
||||
echo_ic "two DNSKEY, one private key missing ($n)"
|
||||
ret=0
|
||||
(
|
||||
cd signer/general
|
||||
cd signer/general || exit 0
|
||||
rm -f signed.zone
|
||||
$SIGNER -f signed.zone -o example.com. test8.zone > signer.out.$n 2>&1
|
||||
test -f signed.zone
|
||||
@@ -1442,6 +1442,30 @@ get_rsasha1_key_ids_from_sigs() {
|
||||
sort -u
|
||||
}
|
||||
|
||||
echo_ic "check that dnssec-signzone rejects excessive NSEC3 iterations ($n)"
|
||||
ret=0
|
||||
(
|
||||
cd signer/general || exit 0
|
||||
rm -f signed.zone
|
||||
$SIGNER -f signed.zone -3 - -H 151 -o example.com. test9.zone > signer.out.$n
|
||||
test -f signed.zone
|
||||
) && ret=1
|
||||
n=$((n+1))
|
||||
test "$ret" -eq 0 || echo_i "failed"
|
||||
status=$((status+ret))
|
||||
|
||||
echo_ic "check that dnssec-signzone accepts maximum NSEC3 iterations ($n)"
|
||||
ret=0
|
||||
(
|
||||
cd signer/general || exit 1
|
||||
rm -f signed.zone
|
||||
$SIGNER -f signed.zone -3 - -H 150 -o example.com. test9.zone > signer.out.$n
|
||||
test -f signed.zone
|
||||
) || ret=1
|
||||
n=$((n+1))
|
||||
test "$ret" -eq 0 || echo_i "failed"
|
||||
status=$((status+ret))
|
||||
|
||||
echo_i "checking that a key using an unsupported algorithm cannot be generated ($n)"
|
||||
ret=0
|
||||
zone=example
|
||||
@@ -4034,5 +4058,13 @@ n=`expr $n + 1`
|
||||
test "$ret" -eq 0 || echo_i "failed"
|
||||
status=`expr $status + $ret`
|
||||
|
||||
echo_i "checking excessive NSEC3 iteration warnings in named.run ($n)"
|
||||
ret=0
|
||||
grep "zone too-many-iterations/IN: excessive NSEC3PARAM iterations [0-9]* > 150" ns2/named.run >/dev/null 2>&1 || ret=1
|
||||
grep "zone too-many-iterations/IN: excessive NSEC3PARAM iterations [0-9]* > 150" ns3/named.run >/dev/null 2>&1 || ret=1
|
||||
n=$((n+1))
|
||||
test "$ret" -eq 0 || echo_i "failed"
|
||||
status=$((status+ret))
|
||||
|
||||
echo_i "exit status: $status"
|
||||
[ $status -eq 0 ] || exit 1
|
||||
|
||||
@@ -309,6 +309,7 @@ then
|
||||
{
|
||||
$PERL update_test.pl -s 10.53.0.1 -p ${PORT} update.nil. || ret=1
|
||||
} | cat_i
|
||||
grep "updating zone 'update.nil/IN': too many NSEC3 iterations (151)" ns1/named.run > /dev/null || ret=1
|
||||
[ $ret -eq 1 ] && { echo_i "failed"; status=1; }
|
||||
else
|
||||
echo_i "The second part of this test requires the Net::DNS library." >&2
|
||||
@@ -1035,6 +1036,17 @@ grep "UPDATE, status: NOERROR" nsupdate.out-$n > /dev/null 2>&1 || ret=1
|
||||
grep "UPDATE, status: FORMERR" nsupdate.out-$n > /dev/null 2>&1 || ret=1
|
||||
[ $ret = 0 ] || { echo_i "failed"; status=1; }
|
||||
|
||||
n=`expr $n + 1`
|
||||
ret=0
|
||||
echo_i "check that excessive NSEC3PARAM iterations are rejected by nsupdate ($n)"
|
||||
$NSUPDATE -d <<END > nsupdate.out-$n 2>&1 && ret=1
|
||||
server 10.53.0.3 ${PORT}
|
||||
zone example
|
||||
update add example 0 in NSEC3PARAM 1 0 151 -
|
||||
END
|
||||
grep "NSEC3PARAM has excessive iterations (> 150)" nsupdate.out-$n >/dev/null || ret=1
|
||||
[ $ret = 0 ] || { echo_i "failed"; status=1; }
|
||||
|
||||
if $FEATURETEST --gssapi ; then
|
||||
n=`expr $n + 1`
|
||||
ret=0
|
||||
|
||||
@@ -410,6 +410,10 @@ test("NOERROR", ["update", rr_add("u.$zone 300 NS ns.u.$zone")]);
|
||||
|
||||
test("NOERROR", ["update", rr_del("u.$zone NS ns.u.$zone")]);
|
||||
|
||||
section("Excessive NSEC3PARAM iterations");
|
||||
test("REFUSED", ["update", rr_add("$zone 300 NSEC3PARAM 1 0 151 -")]);
|
||||
test("NOERROR", ["update", rr_add("$zone 300 NSEC3PARAM 1 0 150 -")]);
|
||||
|
||||
if ($failures) {
|
||||
print "$failures tests failed.\n";
|
||||
} else {
|
||||
|
||||
@@ -55,7 +55,8 @@
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
None.
|
||||
Reduce the supported maximum number of iterations that can be
|
||||
configured in an NSEC3 zones to 150. [GL #2642]
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
@@ -200,18 +200,10 @@ dns_nsec3_activex(dns_db_t *db, dns_dbversion_t *version,
|
||||
* 'answer' to be non NULL.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
dns_nsec3_maxiterations(dns_db_t *db, dns_dbversion_t *version,
|
||||
isc_mem_t *mctx, unsigned int *iterationsp);
|
||||
unsigned int
|
||||
dns_nsec3_maxiterations(void);
|
||||
/*%<
|
||||
* Find the maximum permissible number of iterations allowed based on
|
||||
* the key strength.
|
||||
*
|
||||
* Requires:
|
||||
* 'db' to be valid.
|
||||
* 'version' to be valid or NULL.
|
||||
* 'mctx' to be valid.
|
||||
* 'iterationsp' to be non NULL.
|
||||
* Return the maximum permissible number of NSEC3 iterations.
|
||||
*/
|
||||
|
||||
bool
|
||||
|
||||
+3
-65
@@ -1774,72 +1774,10 @@ dns_nsec3_activex(dns_db_t *db, dns_dbversion_t *version,
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_nsec3_maxiterations(dns_db_t *db, dns_dbversion_t *version,
|
||||
isc_mem_t *mctx, unsigned int *iterationsp)
|
||||
unsigned int
|
||||
dns_nsec3_maxiterations(void)
|
||||
{
|
||||
dns_dbnode_t *node = NULL;
|
||||
dns_rdataset_t rdataset;
|
||||
dst_key_t *key = NULL;
|
||||
isc_buffer_t buffer;
|
||||
isc_result_t result;
|
||||
unsigned int bits, minbits = 4096;
|
||||
|
||||
result = dns_db_getoriginnode(db, &node);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
|
||||
dns_rdataset_init(&rdataset);
|
||||
result = dns_db_findrdataset(db, node, version, dns_rdatatype_dnskey,
|
||||
0, 0, &rdataset, NULL);
|
||||
dns_db_detachnode(db, &node);
|
||||
if (result == ISC_R_NOTFOUND) {
|
||||
*iterationsp = 0;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto failure;
|
||||
|
||||
for (result = dns_rdataset_first(&rdataset);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(&rdataset)) {
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
dns_rdataset_current(&rdataset, &rdata);
|
||||
|
||||
REQUIRE(rdata.type == dns_rdatatype_key ||
|
||||
rdata.type == dns_rdatatype_dnskey);
|
||||
REQUIRE(rdata.length > 3);
|
||||
|
||||
/* Skip unsupported algorithms when
|
||||
* calculating the maximum iterations.
|
||||
*/
|
||||
if (!dst_algorithm_supported(rdata.data[3]))
|
||||
continue;
|
||||
|
||||
isc_buffer_init(&buffer, rdata.data, rdata.length);
|
||||
isc_buffer_add(&buffer, rdata.length);
|
||||
CHECK(dst_key_fromdns(dns_db_origin(db), rdataset.rdclass,
|
||||
&buffer, mctx, &key));
|
||||
bits = dst_key_size(key);
|
||||
dst_key_free(&key);
|
||||
if (minbits > bits)
|
||||
minbits = bits;
|
||||
}
|
||||
if (result != ISC_R_NOMORE)
|
||||
goto failure;
|
||||
|
||||
if (minbits <= 1024)
|
||||
*iterationsp = 150;
|
||||
else if (minbits <= 2048)
|
||||
*iterationsp = 500;
|
||||
else
|
||||
*iterationsp = 2500;
|
||||
result = ISC_R_SUCCESS;
|
||||
|
||||
failure:
|
||||
if (dns_rdataset_isassociated(&rdataset))
|
||||
dns_rdataset_disassociate(&rdataset);
|
||||
return (result);
|
||||
return (150);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
|
||||
@@ -65,8 +65,7 @@ iteration_test(const char *file, unsigned int expected) {
|
||||
result = dns_test_loaddb(&db, dns_dbtype_zone, "test", file);
|
||||
assert_int_equal(result, ISC_R_SUCCESS);
|
||||
|
||||
result = dns_nsec3_maxiterations(db, NULL, mctx, &iterations);
|
||||
assert_int_equal(result, ISC_R_SUCCESS);
|
||||
iterations = dns_nsec3_maxiterations();
|
||||
|
||||
assert_int_equal(iterations, expected);
|
||||
|
||||
@@ -144,10 +143,10 @@ max_iterations(void **state) {
|
||||
UNUSED(state);
|
||||
|
||||
iteration_test("testdata/nsec3/1024.db", 150);
|
||||
iteration_test("testdata/nsec3/2048.db", 500);
|
||||
iteration_test("testdata/nsec3/4096.db", 2500);
|
||||
iteration_test("testdata/nsec3/2048.db", 150);
|
||||
iteration_test("testdata/nsec3/4096.db", 150);
|
||||
iteration_test("testdata/nsec3/min-1024.db", 150);
|
||||
iteration_test("testdata/nsec3/min-2048.db", 500);
|
||||
iteration_test("testdata/nsec3/min-2048.db", 150);
|
||||
}
|
||||
|
||||
/* check dns_nsec3param_salttotext() */
|
||||
|
||||
+24
-11
@@ -3715,13 +3715,12 @@ set_resigntime(dns_zone_t *zone) {
|
||||
|
||||
static isc_result_t
|
||||
check_nsec3param(dns_zone_t *zone, dns_db_t *db) {
|
||||
bool ok = false;
|
||||
dns_dbnode_t *node = NULL;
|
||||
dns_rdataset_t rdataset;
|
||||
dns_dbversion_t *version = NULL;
|
||||
dns_rdata_nsec3param_t nsec3param;
|
||||
bool ok = false;
|
||||
dns_rdataset_t rdataset;
|
||||
isc_result_t result;
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
bool dynamic = (zone->type == dns_zone_master) ?
|
||||
dns_zone_isdynamic(zone, false) : false;
|
||||
|
||||
@@ -3751,19 +3750,22 @@ check_nsec3param(dns_zone_t *zone, dns_db_t *db) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
* For dynamic zones we must support every algorithm so we can
|
||||
* regenerate all the NSEC3 chains.
|
||||
* For non-dynamic zones we only need to find a supported algorithm.
|
||||
*/
|
||||
for (result = dns_rdataset_first(&rdataset);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(&rdataset))
|
||||
{
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
|
||||
dns_rdataset_current(&rdataset, &rdata);
|
||||
result = dns_rdata_tostruct(&rdata, &nsec3param, NULL);
|
||||
dns_rdata_reset(&rdata);
|
||||
INSIST(result == ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
|
||||
/*
|
||||
* For dynamic zones we must support every algorithm so we
|
||||
* can regenerate all the NSEC3 chains.
|
||||
* For non-dynamic zones we only need to find a supported
|
||||
* algorithm.
|
||||
*/
|
||||
if (DNS_ZONE_OPTION(zone, DNS_ZONEOPT_NSEC3TESTZONE) &&
|
||||
nsec3param.hash == DNS_NSEC3_UNKNOWNALG && !dynamic)
|
||||
{
|
||||
@@ -3785,8 +3787,19 @@ check_nsec3param(dns_zone_t *zone, dns_db_t *db) {
|
||||
dns_zone_log(zone, ISC_LOG_WARNING,
|
||||
"unsupported nsec3 hash algorithm: %u",
|
||||
nsec3param.hash);
|
||||
} else
|
||||
} else {
|
||||
ok = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Warn if the zone has excessive NSEC3 iterations.
|
||||
*/
|
||||
if (nsec3param.iterations > dns_nsec3_maxiterations()) {
|
||||
dns_zone_log(zone, ISC_LOG_WARNING,
|
||||
"excessive NSEC3PARAM iterations %u > %u",
|
||||
nsec3param.iterations,
|
||||
dns_nsec3_maxiterations());
|
||||
}
|
||||
}
|
||||
if (result == ISC_R_NOMORE)
|
||||
result = ISC_R_SUCCESS;
|
||||
|
||||
@@ -1133,6 +1133,7 @@
|
||||
./bin/tests/system/dnssec/ns2/sign.sh SH 2000,2001,2002,2003,2004,2006,2007,2008,2009,2010,2011,2012,2014,2015,2016,2018,2019,2020,2021
|
||||
./bin/tests/system/dnssec/ns2/single-nsec3.db.in ZONE 2010,2016,2018,2019,2020,2021
|
||||
./bin/tests/system/dnssec/ns2/template.secure.db.in ZONE 2019,2020,2021
|
||||
./bin/tests/system/dnssec/ns2/too-many-iterations.db.in ZONE 2021
|
||||
./bin/tests/system/dnssec/ns3/auto-nsec.example.db.in ZONE 2011,2016,2018,2019,2020,2021
|
||||
./bin/tests/system/dnssec/ns3/auto-nsec3.example.db.in ZONE 2011,2016,2018,2019,2020,2021
|
||||
./bin/tests/system/dnssec/ns3/bogus.example.db.in ZONE 2000,2001,2004,2007,2014,2016,2018,2019,2020,2021
|
||||
@@ -1212,6 +1213,10 @@
|
||||
./bin/tests/system/dnssec/signer/general/Kexample.com.+005+07065.private X 2018,2019,2020,2021
|
||||
./bin/tests/system/dnssec/signer/general/Kexample.com.+005+23362.key X 2018,2019,2020,2021
|
||||
./bin/tests/system/dnssec/signer/general/Kexample.com.+005+23362.private X 2018,2019,2020,2021
|
||||
./bin/tests/system/dnssec/signer/general/Kexample.com.+008+15002.key X 2021
|
||||
./bin/tests/system/dnssec/signer/general/Kexample.com.+008+15002.private X 2021
|
||||
./bin/tests/system/dnssec/signer/general/Kexample.com.+008+63613.key X 2021
|
||||
./bin/tests/system/dnssec/signer/general/Kexample.com.+008+63613.private X 2021
|
||||
./bin/tests/system/dnssec/signer/general/bogus-ksk.key X 2018,2019,2020,2021
|
||||
./bin/tests/system/dnssec/signer/general/bogus-zsk.key X 2018,2019,2020,2021
|
||||
./bin/tests/system/dnssec/signer/general/test1.zone ZONE 2018,2019,2020,2021
|
||||
@@ -1222,6 +1227,7 @@
|
||||
./bin/tests/system/dnssec/signer/general/test6.zone ZONE 2018,2019,2020,2021
|
||||
./bin/tests/system/dnssec/signer/general/test7.zone ZONE 2018,2019,2020,2021
|
||||
./bin/tests/system/dnssec/signer/general/test8.zone ZONE 2018,2019,2020,2021
|
||||
./bin/tests/system/dnssec/signer/general/test9.zone ZONE 2021
|
||||
./bin/tests/system/dnssec/signer/remove.db.in ZONE 2016,2018,2019,2020,2021
|
||||
./bin/tests/system/dnssec/signer/remove2.db.in ZONE 2016,2018,2019,2020,2021
|
||||
./bin/tests/system/dnssec/tests.sh SH 2000,2001,2002,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021
|
||||
|
||||
Reference in New Issue
Block a user