mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-04 00:25:29 +00:00
rndc dnssec -checkds set algorithm
In the rare case that you have multiple keys acting as KSK and that have the same keytag, you can now set the algorithm when calling '-checkds'.
This commit is contained in:
@@ -14528,6 +14528,7 @@ named_server_dnssec(named_server_t *server, isc_lex_t *lex,
|
|||||||
/* variables for -checkds */
|
/* variables for -checkds */
|
||||||
bool checkds = false, dspublish = false, use_keyid = false;
|
bool checkds = false, dspublish = false, use_keyid = false;
|
||||||
dns_keytag_t keyid = 0;
|
dns_keytag_t keyid = 0;
|
||||||
|
uint8_t algorithm = 0;
|
||||||
/* variables for -status */
|
/* variables for -status */
|
||||||
bool status = false;
|
bool status = false;
|
||||||
char output[4096];
|
char output[4096];
|
||||||
@@ -14565,8 +14566,23 @@ named_server_dnssec(named_server_t *server, isc_lex_t *lex,
|
|||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
msg = "Bad format";
|
msg = "Bad format";
|
||||||
CHECK(ISC_R_UNEXPECTEDEND);
|
CHECK(ISC_R_UNEXPECTEDEND);
|
||||||
}
|
} else if (argcheck(ptr, "alg")) {
|
||||||
if (argcheck(ptr, "key")) {
|
isc_consttextregion_t alg;
|
||||||
|
ptr = next_token(lex, text);
|
||||||
|
if (ptr == NULL) {
|
||||||
|
msg = "No key algorithm specified";
|
||||||
|
CHECK(ISC_R_UNEXPECTEDEND);
|
||||||
|
}
|
||||||
|
alg.base = ptr;
|
||||||
|
alg.length = strlen(alg.base);
|
||||||
|
result = dns_secalg_fromtext(
|
||||||
|
&algorithm, (isc_textregion_t *)&alg);
|
||||||
|
if (result != ISC_R_SUCCESS) {
|
||||||
|
msg = "Bad algorithm";
|
||||||
|
CHECK(DNS_R_SYNTAX);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
} else if (argcheck(ptr, "key")) {
|
||||||
uint16_t id;
|
uint16_t id;
|
||||||
ptr = next_token(lex, text);
|
ptr = next_token(lex, text);
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
@@ -14595,14 +14611,19 @@ named_server_dnssec(named_server_t *server, isc_lex_t *lex,
|
|||||||
* No arguments provided, so we must be
|
* No arguments provided, so we must be
|
||||||
* parsing "published|withdrawn".
|
* parsing "published|withdrawn".
|
||||||
*/
|
*/
|
||||||
if (strcasecmp(ptr, "publish") == 0) {
|
if (strcasecmp(ptr, "published") == 0) {
|
||||||
dspublish = true;
|
dspublish = true;
|
||||||
} else if (strcasecmp(ptr, "withdraw") != 0) {
|
} else if (strcasecmp(ptr, "withdrawn") != 0) {
|
||||||
CHECK(DNS_R_SYNTAX);
|
CHECK(DNS_R_SYNTAX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (algorithm > 0 && !use_keyid) {
|
||||||
|
msg = "Key id is required when setting algorithm";
|
||||||
|
CHECK(DNS_R_SYNTAX);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
CHECK(DNS_R_SYNTAX);
|
CHECK(DNS_R_SYNTAX);
|
||||||
}
|
}
|
||||||
@@ -14658,7 +14679,8 @@ named_server_dnssec(named_server_t *server, isc_lex_t *lex,
|
|||||||
LOCK(&kasp->lock);
|
LOCK(&kasp->lock);
|
||||||
if (use_keyid) {
|
if (use_keyid) {
|
||||||
result = dns_keymgr_checkds_id(kasp, &keys, dir, when,
|
result = dns_keymgr_checkds_id(kasp, &keys, dir, when,
|
||||||
dspublish, keyid);
|
dspublish, keyid,
|
||||||
|
(unsigned int)algorithm);
|
||||||
} else {
|
} else {
|
||||||
result = dns_keymgr_checkds(kasp, &keys, dir, when,
|
result = dns_keymgr_checkds(kasp, &keys, dir, when,
|
||||||
dspublish);
|
dspublish);
|
||||||
|
@@ -108,10 +108,11 @@ command is one of the following:\n\
|
|||||||
Add zone to given view. Requires allow-new-zones option.\n\
|
Add zone to given view. Requires allow-new-zones option.\n\
|
||||||
delzone [-clean] zone [class [view]]\n\
|
delzone [-clean] zone [class [view]]\n\
|
||||||
Removes zone from given view.\n\
|
Removes zone from given view.\n\
|
||||||
dnssec -checkds [-key id] [-when time] (published|withdrawn) zone [class [view]]\n\
|
dnssec -checkds [-key id [-alg algorithm] [-when time] (published|withdrawn) zone [class [view]]\n\
|
||||||
Mark the DS record for the KSK of the given zone as seen\n\
|
Mark the DS record for the KSK of the given zone as seen\n\
|
||||||
in the parent. If the zone has multiple KSKs, select a\n\
|
in the parent. If the zone has multiple KSKs, select a\n\
|
||||||
specific key by providing the keytag with -key id.\n\
|
specific key by providing the keytag with -key id and\n\
|
||||||
|
optionally the key's algorithm with -alg algorithm.\n\
|
||||||
Requires the zone to have a dnssec-policy.\n\
|
Requires the zone to have a dnssec-policy.\n\
|
||||||
dnssec -status zone [class [view]]\n\
|
dnssec -status zone [class [view]]\n\
|
||||||
Show the DNSSEC signing state for the specified zone.\n\
|
Show the DNSSEC signing state for the specified zone.\n\
|
||||||
|
@@ -161,7 +161,7 @@ Currently supported commands are:
|
|||||||
|
|
||||||
See also ``rndc addzone`` and ``rndc modzone``.
|
See also ``rndc addzone`` and ``rndc modzone``.
|
||||||
|
|
||||||
``dnssec`` ( **-status** | **-checkds** [**-key** *id*] [**-when** *time*] ( *published* | *withdrawn* )) *zone* [*class* [*view*]]
|
``dnssec`` ( **-status** | **-checkds** [**-key** *id* [**-alg** *algorithm*]] [**-when** *time*] ( *published* | *withdrawn* )) *zone* [*class* [*view*]]
|
||||||
This command allows you to interact with the "dnssec-policy" of a given
|
This command allows you to interact with the "dnssec-policy" of a given
|
||||||
zone.
|
zone.
|
||||||
|
|
||||||
@@ -172,9 +172,10 @@ Currently supported commands are:
|
|||||||
key has been seen published into or withdrawn from the parent. This is
|
key has been seen published into or withdrawn from the parent. This is
|
||||||
required in order to complete a KSK rollover. If the ``-key id`` argument
|
required in order to complete a KSK rollover. If the ``-key id`` argument
|
||||||
is specified, look for the key with the given identifier, otherwise if there
|
is specified, look for the key with the given identifier, otherwise if there
|
||||||
is only one key acting as a KSK in the zone, assume the DS of that key.
|
is only one key acting as a KSK in the zone, assume the DS of that key (if
|
||||||
The time that the DS has been published or withdrawn is set to now, unless
|
there are multiple keys with the same tag, use ``-alg algorithm`` to
|
||||||
otherwise specified with the argument ``-when time``.
|
select the correct algorithm). The time that the DS has been published or
|
||||||
|
withdrawn is set to now, unless otherwise specified with the argument ``-when time``.
|
||||||
|
|
||||||
``dnstap`` ( **-reopen** | **-roll** [*number*] )
|
``dnstap`` ( **-reopen** | **-roll** [*number*] )
|
||||||
This command closes and re-opens DNSTAP output files. ``rndc dnstap -reopen`` allows
|
This command closes and re-opens DNSTAP output files. ``rndc dnstap -reopen`` allows
|
||||||
|
@@ -1476,6 +1476,22 @@ grep "DSRemoved:" "${basefile2}.state" > /dev/null && log_error "DSPublish incor
|
|||||||
test "$ret" -eq 0 || echo_i "failed"
|
test "$ret" -eq 0 || echo_i "failed"
|
||||||
status=$((status+ret))
|
status=$((status+ret))
|
||||||
|
|
||||||
|
n=$((n+1))
|
||||||
|
echo_i "checkds published does not set DSPublish for zone $ZONE (wrong algorithm) ($n)"
|
||||||
|
rndccmd "$SERVER" dnssec -checkds -key $(key_get KEY1 ID) -alg 8 "published" "$ZONE" > rndc.dnssec.checkds.out.$ZONE.$n
|
||||||
|
grep "DSPublish:" "${basefile1}.state" > /dev/null && log_error "DSPublish incorrectly set in ${basefile1}"
|
||||||
|
grep "DSPublish:" "${basefile2}.state" > /dev/null && log_error "DSPublish incorrectly set in ${basefile2}"
|
||||||
|
test "$ret" -eq 0 || echo_i "failed"
|
||||||
|
status=$((status+ret))
|
||||||
|
|
||||||
|
n=$((n+1))
|
||||||
|
echo_i "checkds withdrawn does not set DSRemoved for zone $ZONE (wrong algorithm) ($n)"
|
||||||
|
rndccmd "$SERVER" dnssec -checkds -key $(key_get KEY1 ID) -alg RSASHA256 "withdrawn" "$ZONE" > rndc.dnssec.checkds.out.$ZONE.$n
|
||||||
|
grep "DSRemoved:" "${basefile1}.state" > /dev/null && log_error "DSRemoved incorrectly set in ${basefile1}"
|
||||||
|
grep "DSRemoved:" "${basefile2}.state" > /dev/null && log_error "DSRemoved incorrectly set in ${basefile2}"
|
||||||
|
test "$ret" -eq 0 || echo_i "failed"
|
||||||
|
status=$((status+ret))
|
||||||
|
|
||||||
n=$((n+1))
|
n=$((n+1))
|
||||||
echo_i "checkds published -key correctly sets DSPublish for key $(key_get KEY1 ID) zone $ZONE (multiple KSK) ($n)"
|
echo_i "checkds published -key correctly sets DSPublish for key $(key_get KEY1 ID) zone $ZONE (multiple KSK) ($n)"
|
||||||
rndc_checkds "$SERVER" "$DIR" $(key_get KEY1 ID) "20190102121314" "published" "$ZONE"
|
rndc_checkds "$SERVER" "$DIR" $(key_get KEY1 ID) "20190102121314" "published" "$ZONE"
|
||||||
|
@@ -161,7 +161,7 @@ recreated. To remove it permanently, it must also be removed from
|
|||||||
.sp
|
.sp
|
||||||
See also \fBrndc addzone\fP and \fBrndc modzone\fP\&.
|
See also \fBrndc addzone\fP and \fBrndc modzone\fP\&.
|
||||||
.TP
|
.TP
|
||||||
\fBdnssec\fP ( \fB\-status\fP | \fB\-checkds\fP [\fB\-key\fP \fIid\fP] [\fB\-when\fP \fItime\fP] ( \fIpublished\fP | \fIwithdrawn\fP )) \fIzone\fP [\fIclass\fP [\fIview\fP]]
|
\fBdnssec\fP ( \fB\-status\fP | \fB\-checkds\fP [\fB\-key\fP \fIid\fP [\fB\-alg\fP \fIalgorithm\fP]] [\fB\-when\fP \fItime\fP] ( \fIpublished\fP | \fIwithdrawn\fP )) \fIzone\fP [\fIclass\fP [\fIview\fP]]
|
||||||
This command allows you to interact with the "dnssec\-policy" of a given
|
This command allows you to interact with the "dnssec\-policy" of a given
|
||||||
zone.
|
zone.
|
||||||
.sp
|
.sp
|
||||||
@@ -172,9 +172,10 @@ zone.
|
|||||||
key has been seen published into or withdrawn from the parent. This is
|
key has been seen published into or withdrawn from the parent. This is
|
||||||
required in order to complete a KSK rollover. If the \fB\-key id\fP argument
|
required in order to complete a KSK rollover. If the \fB\-key id\fP argument
|
||||||
is specified, look for the key with the given identifier, otherwise if there
|
is specified, look for the key with the given identifier, otherwise if there
|
||||||
is only one key acting as a KSK in the zone, assume the DS of that key.
|
is only one key acting as a KSK in the zone, assume the DS of that key (if
|
||||||
The time that the DS has been published or withdrawn is set to now, unless
|
there are multiple keys with the same tag, use \fB\-alg algorithm\fP to
|
||||||
otherwise specified with the argument \fB\-when time\fP\&.
|
select the correct algorithm). The time that the DS has been published or
|
||||||
|
withdrawn is set to now, unless otherwise specified with the argument \fB\-when time\fP\&.
|
||||||
.TP
|
.TP
|
||||||
\fBdnstap\fP ( \fB\-reopen\fP | \fB\-roll\fP [\fInumber\fP] )
|
\fBdnstap\fP ( \fB\-reopen\fP | \fB\-roll\fP [\fInumber\fP] )
|
||||||
This command closes and re\-opens DNSTAP output files. \fBrndc dnstap \-reopen\fP allows
|
This command closes and re\-opens DNSTAP output files. \fBrndc dnstap \-reopen\fP allows
|
||||||
|
@@ -57,12 +57,13 @@ dns_keymgr_checkds(dns_kasp_t *kasp, dns_dnsseckeylist_t *keyring,
|
|||||||
isc_result_t
|
isc_result_t
|
||||||
dns_keymgr_checkds_id(dns_kasp_t *kasp, dns_dnsseckeylist_t *keyring,
|
dns_keymgr_checkds_id(dns_kasp_t *kasp, dns_dnsseckeylist_t *keyring,
|
||||||
const char *directory, isc_stdtime_t now, bool dspublish,
|
const char *directory, isc_stdtime_t now, bool dspublish,
|
||||||
dns_keytag_t id);
|
dns_keytag_t id, unsigned int algorithm);
|
||||||
/*%<
|
/*%<
|
||||||
* Check DS for one key in 'keyring'. The key must have the KSK role.
|
* Check DS for one key in 'keyring'. The key must have the KSK role.
|
||||||
* If 'dspublish' is set to true, set the DS Publish time to 'now'.
|
* If 'dspublish' is set to true, set the DS Publish time to 'now'.
|
||||||
* If 'dspublish' is set to false, set the DS Removed time to 'now'.
|
* If 'dspublish' is set to false, set the DS Removed time to 'now'.
|
||||||
* If a specific key 'id' is given it must match the keytag.
|
* If a specific key 'id' is given it must match the keytag.
|
||||||
|
* If the 'algorithm' is non-zero, it must match the key's algorithm.
|
||||||
* The result is stored in the key state file.
|
* The result is stored in the key state file.
|
||||||
*
|
*
|
||||||
* Requires:
|
* Requires:
|
||||||
|
@@ -1873,7 +1873,7 @@ failure:
|
|||||||
static isc_result_t
|
static isc_result_t
|
||||||
keymgr_checkds(dns_kasp_t *kasp, dns_dnsseckeylist_t *keyring,
|
keymgr_checkds(dns_kasp_t *kasp, dns_dnsseckeylist_t *keyring,
|
||||||
const char *directory, isc_stdtime_t now, bool dspublish,
|
const char *directory, isc_stdtime_t now, bool dspublish,
|
||||||
dns_keytag_t id, bool check_id) {
|
dns_keytag_t id, unsigned int alg, bool check_id) {
|
||||||
int options = (DST_TYPE_PRIVATE | DST_TYPE_PUBLIC | DST_TYPE_STATE);
|
int options = (DST_TYPE_PRIVATE | DST_TYPE_PUBLIC | DST_TYPE_STATE);
|
||||||
isc_dir_t dir;
|
isc_dir_t dir;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
@@ -1893,6 +1893,9 @@ keymgr_checkds(dns_kasp_t *kasp, dns_dnsseckeylist_t *keyring,
|
|||||||
if (check_id && dst_key_id(dkey->key) != id) {
|
if (check_id && dst_key_id(dkey->key) != id) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (alg > 0 && dst_key_alg(dkey->key) != alg) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (ksk_key != NULL) {
|
if (ksk_key != NULL) {
|
||||||
/*
|
/*
|
||||||
@@ -1935,16 +1938,16 @@ keymgr_checkds(dns_kasp_t *kasp, dns_dnsseckeylist_t *keyring,
|
|||||||
isc_result_t
|
isc_result_t
|
||||||
dns_keymgr_checkds(dns_kasp_t *kasp, dns_dnsseckeylist_t *keyring,
|
dns_keymgr_checkds(dns_kasp_t *kasp, dns_dnsseckeylist_t *keyring,
|
||||||
const char *directory, isc_stdtime_t now, bool dspublish) {
|
const char *directory, isc_stdtime_t now, bool dspublish) {
|
||||||
return (keymgr_checkds(kasp, keyring, directory, now, dspublish, 0,
|
return (keymgr_checkds(kasp, keyring, directory, now, dspublish, 0, 0,
|
||||||
false));
|
false));
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
dns_keymgr_checkds_id(dns_kasp_t *kasp, dns_dnsseckeylist_t *keyring,
|
dns_keymgr_checkds_id(dns_kasp_t *kasp, dns_dnsseckeylist_t *keyring,
|
||||||
const char *directory, isc_stdtime_t now, bool dspublish,
|
const char *directory, isc_stdtime_t now, bool dspublish,
|
||||||
dns_keytag_t id) {
|
dns_keytag_t id, unsigned int alg) {
|
||||||
return (keymgr_checkds(kasp, keyring, directory, now, dspublish, id,
|
return (keymgr_checkds(kasp, keyring, directory, now, dspublish, id,
|
||||||
true));
|
alg, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Reference in New Issue
Block a user