summaryrefslogtreecommitdiffstats
path: root/lib/layer/validate.c
diff options
context:
space:
mode:
authorVladimír Čunát <vladimir.cunat@nic.cz>2024-01-02 11:18:31 +0100
committerVladimír Čunát <vladimir.cunat@nic.cz>2024-02-12 11:19:57 +0100
commiteccb8e278c1cde0548cc570eac619feaa290cede (patch)
tree153e1f5613ca201eaabf0aaf110585eced145df3 /lib/layer/validate.c
parentvalidator: lower the NSEC3 iteration limit (150 -> 50) (diff)
downloadknot-resolver-eccb8e278c1cde0548cc570eac619feaa290cede.tar.xz
knot-resolver-eccb8e278c1cde0548cc570eac619feaa290cede.zip
validator: similarly also limit excessive NSEC3 salt length
Limit combination of iterations and salt length, based on estimated expense of the computation. Note that the result only differs for salt length > 44 which is rather nonsensical and very rare: https://chat.dns-oarc.net/community/pl/h58qx9sjkbgt9dajb7x988p78a
Diffstat (limited to '')
-rw-r--r--lib/layer/validate.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/layer/validate.c b/lib/layer/validate.c
index 17f90740..1b1237da 100644
--- a/lib/layer/validate.c
+++ b/lib/layer/validate.c
@@ -128,14 +128,15 @@ static bool maybe_downgrade_nsec3(const ranked_rr_array_entry_t *e, struct kr_qu
const knot_rdataset_t *rrs = &e->rr->rrs;
knot_rdata_t *rd = rrs->rdata;
for (int j = 0; j < rrs->count; ++j, rd = knot_rdataset_next(rd)) {
- if (knot_nsec3_iters(rd) > KR_NSEC3_MAX_ITERATIONS)
+ if (kr_nsec3_limited_rdata(rd))
goto do_downgrade;
}
return false;
do_downgrade: // we do this deep inside calls because of having signer name available
- VERBOSE_MSG(qry, "<= DNSSEC downgraded due to NSEC3 iterations %d > %d\n",
- (int)knot_nsec3_iters(rd), (int)KR_NSEC3_MAX_ITERATIONS);
+ VERBOSE_MSG(qry,
+ "<= DNSSEC downgraded due to expensive NSEC3: %d iterations, %d salt length\n",
+ (int)knot_nsec3_iters(rd), (int)knot_nsec3_salt_len(rd));
qry->flags.DNSSEC_WANT = false;
qry->flags.DNSSEC_INSECURE = true;
rank_records(qry, true, KR_RANK_INSECURE, vctx->zone_name);