}
result = dns_dnssec_verify(name, rdataset, ki->dst,
- false, 0, mctx, &sigrdata,
+ false, mctx, &sigrdata,
NULL);
if (result != ISC_R_SUCCESS &&
INCSTAT(nsigned);
if (tryverify) {
- result = dns_dnssec_verify(name, rdataset, key, true, 0, mctx,
+ result = dns_dnssec_verify(name, rdataset, key, true, mctx,
&trdata, NULL);
if (result == ISC_R_SUCCESS || result == DNS_R_FROMWILDCARD) {
vbprintf(3, "\tsignature verified\n");
setverifies(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
dns_rdata_t *rrsig) {
isc_result_t result;
- result = dns_dnssec_verify(name, set, key, false, 0, mctx, rrsig, NULL);
+ result = dns_dnssec_verify(name, set, key, false, mctx, rrsig, NULL);
if (result == ISC_R_SUCCESS || result == DNS_R_FROMWILDCARD) {
INCSTAT(nverified);
return true;
const char *cachename = NULL;
dns_order_t *order = NULL;
uint32_t udpsize;
- uint32_t maxbits;
unsigned int resopts = 0;
dns_zone_t *zone = NULL;
uint32_t clients_per_query, max_clients_per_query;
}
view->nocookieudp = udpsize;
- /*
- * Set the maximum rsa exponent bits.
- */
- obj = NULL;
- result = named_config_get(maps, "max-rsa-exponent-size", &obj);
- INSIST(result == ISC_R_SUCCESS);
- maxbits = cfg_obj_asuint32(obj);
- if (maxbits != 0 && maxbits < 35) {
- maxbits = 35;
- }
- if (maxbits > 4096) {
- maxbits = 4096;
- }
- view->maxbits = maxbits;
-
/*
* Set supported DNSSEC algorithms.
*/
# Configure the resolving server with a static key.
keyfile_to_static_ds $keyname >trusted.conf
cp trusted.conf ../ns2/trusted.conf
-cp trusted.conf ../ns3/trusted.conf
cd ../ns2 && $SHELL -e ./sign.sh
+++ /dev/null
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * SPDX-License-Identifier: MPL-2.0
- *
- * 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.
- */
-
-// NS3
-
-options {
- query-source address 10.53.0.3;
- notify-source 10.53.0.3;
- transfer-source 10.53.0.3;
- port @PORT@;
- pid-file "named.pid";
- listen-on { 10.53.0.3; };
- listen-on-v6 { none; };
- recursion yes;
- notify yes;
- dnssec-validation yes;
- max-rsa-exponent-size 35;
-};
-
-zone "." {
- type hint;
- file "../../_common/root.hint";
-};
-
-include "trusted.conf";
copy_setports ns1/named.conf.in ns1/named.conf
copy_setports ns2/named.conf.in ns2/named.conf
-copy_setports ns3/named.conf.in ns3/named.conf
cd ns1 && $SHELL -e sign.sh
import os
import subprocess
-import dns.message
import pytest
import isctest
"dnssec-signzone: fatal: cannot load dnskey Kexample.+008+52810.key: out of range"
in file.read()
)
-
-
-def test_rsa_big_exponent_keys_cant_validate():
- msg = dns.message.make_query("a.example.", "A")
- res2 = isctest.query.tcp(msg, "10.53.0.2")
- isctest.check.noerror(res2)
- res3 = isctest.query.tcp(msg, "10.53.0.3")
- isctest.check.servfail(res3)
This option is not to be confused with the :any:`notify-defer` option.
.. namedconf:statement:: max-rsa-exponent-size
- :tags: dnssec, query
+ :tags: deprecated
:short: Sets the maximum RSA exponent size (in bits) when validating.
- This sets the maximum RSA exponent size, in bits, that is accepted when
- validating. Valid values are 35 to 4096 bits. The default, zero, is
- also accepted and is equivalent to 4096.
+ The maximum RSA exponent size is now always 4096. This option is
+ deprecated, and will be rendered non-operational in a future release.
.. namedconf:statement:: prefetch
:tags: query
isc_result_t
dns_dnssec_verify(const dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
- bool ignoretime, unsigned int maxbits, isc_mem_t *mctx,
- dns_rdata_t *sigrdata, dns_name_t *wild) {
+ bool ignoretime, isc_mem_t *mctx, dns_rdata_t *sigrdata,
+ dns_name_t *wild) {
dns_rdata_rrsig_t sig;
dns_fixedname_t fnewname;
isc_region_t r;
r.base = sig.signature;
r.length = sig.siglen;
- ret = dst_context_verify(ctx, maxbits, &r);
+ ret = dst_context_verify(ctx, &r);
if (ret == ISC_R_SUCCESS && downcase) {
char namebuf[DNS_NAME_FORMATSIZE];
dns_name_format(&sig.signer, namebuf, sizeof(namebuf));
sig_r.base = sig.signature;
sig_r.length = sig.siglen;
- result = dst_context_verify(ctx, 0, &sig_r);
+ result = dst_context_verify(ctx, &sig_r);
if (result != ISC_R_SUCCESS) {
msg->sig0status = dns_tsigerror_badsig;
goto failure;
if (sig.algorithm == key.algorithm && sig.keyid == keytag) {
result = dns_dnssec_verify(name, rdataset, dstkey,
- ignoretime, 0, mctx,
- &sigrdata, NULL);
+ ignoretime, mctx, &sigrdata,
+ NULL);
if (result == ISC_R_SUCCESS) {
dst_key_free(&dstkey);
return true;
}
isc_result_t
-dst_context_verify(dst_context_t *dctx, int maxbits, isc_region_t *sig) {
+dst_context_verify(dst_context_t *dctx, isc_region_t *sig) {
REQUIRE(VALID_CTX(dctx));
REQUIRE(sig != NULL);
return DST_R_NOTPUBLICKEY;
}
- return dctx->key->func->verify(dctx, maxbits, sig);
+ return dctx->key->func->verify(dctx, sig);
}
isc_result_t
* Key operations
*/
isc_result_t (*sign)(dst_context_t *dctx, isc_buffer_t *sig);
- isc_result_t (*verify)(dst_context_t *dctx, int maxbits,
- const isc_region_t *sig);
+ isc_result_t (*verify)(dst_context_t *dctx, const isc_region_t *sig);
bool (*compare)(const dst_key_t *key1, const dst_key_t *key2);
isc_result_t (*generate)(dst_key_t *key, int parms,
void (*callback)(int));
* Verify.
*/
static isc_result_t
-gssapi_verify(dst_context_t *dctx, int maxbits ISC_ATTR_UNUSED,
- const isc_region_t *sig) {
+gssapi_verify(dst_context_t *dctx, const isc_region_t *sig) {
dst_gssapi_signverifyctx_t *ctx = dctx->ctxdata.gssctx;
isc_region_t message;
gss_buffer_desc gmessage, gsig;
return (hmac_sign(dctx, sig)); \
} \
static isc_result_t hmac##alg##_verify(dst_context_t *dctx, \
- int maxbits ISC_ATTR_UNUSED, \
const isc_region_t *sig) { \
return (hmac_verify(dctx, sig)); \
} \
isc_result_t
dns_dnssec_verify(const dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
- bool ignoretime, unsigned int maxbits, isc_mem_t *mctx,
- dns_rdata_t *sigrdata, dns_name_t *wild);
+ bool ignoretime, isc_mem_t *mctx, dns_rdata_t *sigrdata,
+ dns_name_t *wild);
/*%<
* Verifies the RRSIG record covering this rdataset signed by a specific
* key. This does not determine if the key's owner is authorized to sign
uint16_t nocookieudp;
uint16_t padding;
dns_acl_t *pad_acl;
- unsigned int maxbits;
dns_dns64list_t dns64;
unsigned int dns64cnt;
bool usedns64;
*/
isc_result_t
-dst_context_verify(dst_context_t *dctx, int maxbits, isc_region_t *sig);
+dst_context_verify(dst_context_t *dctx, isc_region_t *sig);
/*%<
* Verifies the signature using the data and key stored in the context.
*
- * 'maxbits' specifies the maximum number of bits permitted in the RSA
- * exponent.
- *
* Requires:
* \li "dctx" is a valid context.
* \li "sig" is a valid region.
}
static isc_result_t
-opensslecdsa_verify(dst_context_t *dctx, int maxbits ISC_ATTR_UNUSED,
- const isc_region_t *sig) {
+opensslecdsa_verify(dst_context_t *dctx, const isc_region_t *sig) {
isc_result_t ret;
dst_key_t *key = dctx->key;
int status;
}
static isc_result_t
-openssleddsa_verify(dst_context_t *dctx, int maxbits ISC_ATTR_UNUSED,
- const isc_region_t *sig) {
+openssleddsa_verify(dst_context_t *dctx, const isc_region_t *sig) {
isc_result_t ret;
dst_key_t *key = dctx->key;
int status;
goto err; \
}
+#define OPENSSLRSA_MAX_MODULUS_BITS 4096
+
typedef struct rsa_components {
bool bnfree;
const BIGNUM *e, *n, *d, *p, *q, *dmp1, *dmq1, *iqmp;
static bool
opensslrsa_check_exponent_bits(EVP_PKEY *pkey, int maxbits) {
/* Always use the new API first with OpenSSL 3.x. */
+ int bits = INT_MAX;
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
BIGNUM *e = NULL;
if (EVP_PKEY_get_bn_param(pkey, OSSL_PKEY_PARAM_RSA_E, &e) == 1) {
- int bits = BN_num_bits(e);
+ bits = BN_num_bits(e);
BN_free(e);
- return bits < maxbits;
}
#else
const RSA *rsa = EVP_PKEY_get0_RSA(pkey);
const BIGNUM *ce = NULL;
RSA_get0_key(rsa, NULL, &ce, NULL);
if (ce != NULL) {
- return BN_num_bits(ce) < maxbits;
+ bits = BN_num_bits(ce);
}
}
#endif
- return false;
+ return bits <= maxbits;
}
static isc_result_t
-opensslrsa_verify(dst_context_t *dctx, int maxbits, const isc_region_t *sig) {
+opensslrsa_verify(dst_context_t *dctx, const isc_region_t *sig) {
dst_key_t *key = NULL;
int status = 0;
EVP_MD_CTX *evp_md_ctx = NULL;
evp_md_ctx = dctx->ctxdata.evp_md_ctx;
pkey = key->keydata.pkeypair.pub;
- if (maxbits != 0 && !opensslrsa_check_exponent_bits(pkey, maxbits)) {
+ if (!opensslrsa_check_exponent_bits(pkey, OPENSSLRSA_MAX_MODULUS_BITS))
+ {
return DST_R_VERIFYFAILURE;
}
}
}
- result = dst_context_verify(ctx, 0, &sig_r);
+ result = dst_context_verify(ctx, &sig_r);
if (result == DST_R_VERIFYFAILURE) {
result = DNS_R_TSIGVERIFYFAILURE;
tsig_log(msg->tsigkey, 2,
goto cleanup_context;
}
- result = dst_context_verify(msg->tsigctx, 0, &sig_r);
+ result = dst_context_verify(msg->tsigctx, &sig_r);
if (result == DST_R_VERIFYFAILURE) {
tsig_log(msg->tsigkey, 2,
"signature failed to verify(2)");
dst_key_free(&dstkey);
return ISC_R_QUOTA;
}
- result = dns_dnssec_verify(
- name, rdataset, dstkey, true,
- val->view->maxbits, mctx, &sigrdata,
- NULL);
+ result = dns_dnssec_verify(name, rdataset,
+ dstkey, true, mctx,
+ &sigrdata, NULL);
switch (result) {
case DNS_R_SIGFUTURE:
case DNS_R_SIGEXPIRED:
}
again:
result = dns_dnssec_verify(val->name, val->rdataset, key, ignore,
- val->view->maxbits, val->view->mctx, rdata,
- wild);
+ val->view->mctx, rdata, wild);
if ((result == DNS_R_SIGEXPIRED || result == DNS_R_SIGFUTURE) &&
val->view->acceptexpired)
{
if (dst_key_alg(dstkey) == sig.algorithm &&
dst_key_rid(dstkey) == sig.keyid)
{
- result = dns_dnssec_verify(
- keyname, &kfetch->dnskeyset, dstkey, false, 0,
- mctx, &sigrr, dns_fixedname_name(&fixed));
+ result = dns_dnssec_verify(keyname, &kfetch->dnskeyset,
+ dstkey, false, mctx, &sigrr,
+ dns_fixedname_name(&fixed));
dnssec_log(kfetch->zone, ISC_LOG_DEBUG(3),
"Confirm revoked DNSKEY is self-signed: %s",
}
result = dns_dnssec_verify(keyname, dnskeys, dstkey,
- false, 0, mctx, &sigrr,
- NULL);
+ false, mctx, &sigrr, NULL);
dst_key_free(&dstkey);
dnssec_log(zone, ISC_LOG_DEBUG(3),
continue;
}
result = dns_dnssec_verify(name, rdataset, dstkeys[key], false,
- 0, vctx->mctx, sigrdata, NULL);
+ vctx->mctx, sigrdata, NULL);
if (result == ISC_R_SUCCESS || result == DNS_R_FROMWILDCARD) {
return true;
}
again:
result = dns_dnssec_verify(name, rdataset, key, ignore,
- client->view->maxbits, client->manager->mctx,
- rdata, NULL);
+ client->manager->mctx, rdata, NULL);
if (result == DNS_R_SIGEXPIRED && client->view->acceptexpired) {
ignore = true;
goto again;
result = dst_context_adddata(ctx, &datareg);
assert_int_equal(result, ISC_R_SUCCESS);
- result = dst_context_verify(ctx, 0, &sigreg);
+ result = dst_context_verify(ctx, &sigreg);
/*
* Compute the expected signature and emit it
r.base = sigsha1;
r.length = 256;
- ret = dst_context_verify(ctx, 0, &r);
+ ret = dst_context_verify(ctx, &r);
assert_int_equal(ret, ISC_R_SUCCESS);
dst_context_destroy(&ctx);
r.base = sigsha256;
r.length = 256;
- ret = dst_context_verify(ctx, 0, &r);
+ ret = dst_context_verify(ctx, &r);
assert_int_equal(ret, ISC_R_SUCCESS);
dst_context_destroy(&ctx);
r.base = sigsha512;
r.length = 256;
- ret = dst_context_verify(ctx, 0, &r);
+ ret = dst_context_verify(ctx, &r);
assert_int_equal(ret, ISC_R_SUCCESS);
dst_context_destroy(&ctx);