Skip to content
Snippets Groups Projects
Commit 78d801df authored by Libor Peltan's avatar Libor Peltan
Browse files

keymgr: ds command with no params prints all

fixing #516
when calling 'keymgr -c/-C/-d <path> <zone> ds', the DS records for all KSKs in the zone are generated
parent 23c11271
No related branches found
No related tags found
1 merge request!753keymgr: ds command with no params prints all
Pipeline #
......@@ -95,9 +95,9 @@ Changes a timing argument of an existing key to new timestamp. \fIKey_spec\fP is
key tag or a prefix of key ID; \fIarguments\fP are like for \fBgenerate\fP, but just
timing\-related ones.
.TP
\fBds\fP \fIkey_spec\fP
\fBds\fP [\fIkey_spec\fP]
Generate DS record (all digest algorithms together) from specified key. \fIKey_spec\fP
is like for \fBset\fP\&.
is like for \fBset\fP, if unspecified, all KSKs are used.
.TP
\fBdelete\fP \fIkey_spec\fP
Remove the specified key from zone. If the key was not shared, it is also deleted from keystore.
......
......@@ -72,9 +72,9 @@ Actions
key tag or a prefix of key ID; *arguments* are like for **generate**, but just
timing-related ones.
**ds** *key_spec*
**ds** [*key_spec*]
Generate DS record (all digest algorithms together) from specified key. *Key_spec*
is like for **set**.
is like for **set**, if unspecified, all KSKs are used.
**delete** *key_spec*
Remove the specified key from zone. If the key was not shared, it is also deleted from keystore.
......
......@@ -125,14 +125,17 @@ static int key_command(int argc, char *argv[])
ret = keymgr_list_keys(&kctx);
} else if (strcmp(argv[1], "ds") == 0) {
if (argc < 3) {
printf("Key is not specified\n");
ret = KNOT_EINVAL;
goto main_end;
}
knot_kasp_key_t *key2ds;
ret = keymgr_get_key(&kctx, argv[2], &key2ds);
if (ret == KNOT_EOK) {
ret = keymgr_generate_ds(zone_name, key2ds);
for (int i = 0; i < kctx.zone->num_keys && ret == KNOT_EOK; i++) {
if (dnssec_key_get_flags(kctx.zone->keys[i].key) == DNSKEY_FLAGS_KSK) {
ret = keymgr_generate_ds(zone_name, &kctx.zone->keys[i]);
}
}
} else {
knot_kasp_key_t *key2ds;
ret = keymgr_get_key(&kctx, argv[2], &key2ds);
if (ret == KNOT_EOK) {
ret = keymgr_generate_ds(zone_name, key2ds);
}
}
} else if (strcmp(argv[1], "share") == 0) {
knot_dname_t *other_zone = NULL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment