2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 06:55:30 +00:00

Add the ability to dig to specify the signing time

This commit is contained in:
Mark Andrews
2022-03-14 17:42:08 +11:00
committed by Petr Špaček
parent 4d248ee78e
commit 805e2ba31d
5 changed files with 55 additions and 6 deletions

View File

@@ -1522,8 +1522,31 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
} }
break; break;
case 'f': /* fail */ case 'f': /* fail */
FULLCHECK("fail"); switch (cmd[1]) {
lookup->servfail_stops = state; case 'a':
FULLCHECK("fail");
lookup->servfail_stops = state;
break;
case 'u':
FULLCHECK("fuzztime");
lookup->fuzzing = state;
if (lookup->fuzzing) {
if (value == NULL) {
lookup->fuzztime = 0x622acce1;
break;
}
result = parse_uint(&num, value, 0xffffffff,
"fuzztime");
if (result != ISC_R_SUCCESS) {
warn("Couldn't parse fuzztime");
goto exit_or_usage;
}
lookup->fuzztime = num;
}
break;
default:
goto invalid_option;
}
break; break;
case 'h': case 'h':
switch (cmd[1]) { switch (cmd[1]) {

View File

@@ -388,6 +388,14 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
to not try the next server, which is the reverse of normal stub to not try the next server, which is the reverse of normal stub
resolver behavior. resolver behavior.
.. option:: +fuzztime[=value], +nofuzztime
This option allows the signing time to be specified when generating
signed messages. If a value is specified it is the seconds since
00:00:00 January 1, 1970 UTC ignoring leap seconds. If no value
is specified 1646972129 (Fri 11 Mar 2022 04:15:29 UTC) is used.
The default is ``+nofuzztime`` and the current time is used.
.. option:: +header-only, +noheader-only .. option:: +header-only, +noheader-only
This option sends a query with a DNS header without a question section. The This option sends a query with a DNS header without a question section. The

View File

@@ -795,6 +795,8 @@ clone_lookup(dig_lookup_t *lookold, bool servers) {
looknew->done_as_is = lookold->done_as_is; looknew->done_as_is = lookold->done_as_is;
looknew->dscp = lookold->dscp; looknew->dscp = lookold->dscp;
looknew->rrcomments = lookold->rrcomments; looknew->rrcomments = lookold->rrcomments;
looknew->fuzzing = lookold->fuzzing;
looknew->fuzztime = lookold->fuzztime;
if (lookold->ecs_addr != NULL) { if (lookold->ecs_addr != NULL) {
size_t len = sizeof(isc_sockaddr_t); size_t len = sizeof(isc_sockaddr_t);
@@ -2438,6 +2440,11 @@ setup_lookup(dig_lookup_t *lookup) {
check_result(result, "dns_message_setsig0key"); check_result(result, "dns_message_setsig0key");
} }
if (lookup->fuzzing) {
lookup->sendmsg->fuzzing = true;
lookup->sendmsg->fuzztime = lookup->fuzztime;
}
lookup->sendspace = isc_mem_get(mctx, COMMSIZE); lookup->sendspace = isc_mem_get(mctx, COMMSIZE);
result = dns_compress_init(&cctx, mctx); result = dns_compress_init(&cctx, mctx);

View File

@@ -108,10 +108,11 @@ struct dig_lookup {
isc_refcount_t references; isc_refcount_t references;
bool aaonly, adflag, badcookie, besteffort, cdflag, cleared, comments, bool aaonly, adflag, badcookie, besteffort, cdflag, cleared, comments,
dns64prefix, dnssec, doing_xfr, done_as_is, ednsneg, expandaaaa, dns64prefix, dnssec, doing_xfr, done_as_is, ednsneg, expandaaaa,
expire, header_only, identify, /*%< Append an "on server <foo>" expire, fuzzing, header_only, identify, /*%< Append an "on
message */ server <foo>" message
identify_previous_line, /*% Prepend a "Nameserver <foo>:" */
message, with newline and tab */ identify_previous_line, /*% Prepend a "Nameserver <foo>:"
message, with newline and tab */
idnin, idnout, ignore, multiline, need_search, new_search, idnin, idnout, ignore, multiline, need_search, new_search,
noclass, nocrypto, nottl, ns_search_only, /*%< dig +nssearch, noclass, nocrypto, nottl, ns_search_only, /*%< dig +nssearch,
host -C */ host -C */
@@ -188,6 +189,7 @@ struct dig_lookup {
char *tls_key_file; char *tls_key_file;
isc_tlsctx_cache_t *tls_ctx_cache; isc_tlsctx_cache_t *tls_ctx_cache;
}; };
isc_stdtime_t fuzztime;
}; };
/*% The dig_query structure */ /*% The dig_query structure */

View File

@@ -450,6 +450,15 @@ resolver behavior.
.UNINDENT .UNINDENT
.INDENT 0.0 .INDENT 0.0
.TP .TP
.B +fuzztime[=value], +nofuzztime
This option allows the signing time to be specified when generating
signed messages. If a value is specified it is the seconds since
00:00:00 January 1, 1970 UTC ignoring leap seconds. If no value
is specified 1646972129 (Fri 11 Mar 2022 04:15:29 UTC) is used.
The default is \fB+nofuzztime\fP and the current time is used.
.UNINDENT
.INDENT 0.0
.TP
.B +header\-only, +noheader\-only .B +header\-only, +noheader\-only
This option sends a query with a DNS header without a question section. The This option sends a query with a DNS header without a question section. The
default is to add a question section. The query type and query name default is to add a question section. The query type and query name