Initial version of keyset.

This commit is contained in:
Philip Homburg
2025-04-17 13:37:25 +02:00
parent 53561781df
commit f8c1453bdb
3 changed files with 32 additions and 22 deletions
+7 -3
View File
@@ -20,14 +20,14 @@ ring = ["domain/ring"]
bytes = "1.8.0"
chrono = "0.4.38"
clap = { version = "4.3.4", features = ["cargo", "derive"] }
domain = { git = "https://github.com/NLnetLabs/domain.git", branch = "initial-nsec3-generation", features = [
#git = "https://github.com/NLnetLabs/domain.git", branch = "initial-nsec3-generation",
domain = { path = "../domain", features = [
"bytes",
"net",
"resolv",
"tsig",
"unstable-client-transport",
"unstable-sign",
"unstable-validate",
"unstable-validator",
"zonefile",
] }
@@ -38,11 +38,15 @@ tokio = "1.40.0"
# still uses it. And sharded-slab is used by tracing-subscriber, which is
# used by domain, which is used by us.
_unused_lazy_static = { package = "lazy_static", version = "1.0.2" }
serde_json = "1.0.137"
serde = "1.0.217"
jiff = "0.2.6"
[dev-dependencies]
test_bin = "0.4.0"
tempfile = "3.14.0"
regex = "1.11.1"
domain = { git = "https://github.com/NLnetLabs/domain.git", branch = "initial-nsec3-generation", features = [
#git = "https://github.com/NLnetLabs/domain.git", branch = "initial-nsec3-generation",
domain = { path = "../domain", features = [
"unstable-stelline",
] }
+19 -13
View File
@@ -1,9 +1,10 @@
//! The command of _dnst_.
pub mod help;
pub mod key2ds;
pub mod keygen;
//pub mod key2ds;
//pub mod keygen;
pub mod keyset;
pub mod notify;
pub mod nsec3hash;
//pub mod nsec3hash;
pub mod update;
use clap::crate_version;
@@ -41,13 +42,13 @@ pub enum Command {
/// <tag> is the 16-bit tag of the key, zero-padded to 5 digits.
///
/// Upon completion, 'K<name>+<alg>+<tag>' will be printed.
#[allow(rustdoc::invalid_html_tags)]
#[command(name = "keygen", verbatim_doc_comment)]
Keygen(self::keygen::Keygen),
//#[allow(rustdoc::invalid_html_tags)]
//#[command(name = "keygen", verbatim_doc_comment)]
//Keygen(self::keygen::Keygen),
/// Print the NSEC3 hash of a given domain name
#[command(name = "nsec3-hash")]
Nsec3Hash(self::nsec3hash::Nsec3Hash),
//#[command(name = "nsec3-hash")]
//Nsec3Hash(self::nsec3hash::Nsec3Hash),
/// Send a NOTIFY packet to DNS servers
///
@@ -62,13 +63,17 @@ pub enum Command {
/// The following file will be created for each key:
/// `K<name>+<alg>+<id>.ds`. The base name `K<name>+<alg>+<id>`
/// will be printed to stdout.
#[command(name = "key2ds")]
Key2ds(key2ds::Key2ds),
//#[command(name = "key2ds")]
//Key2ds(key2ds::Key2ds),
/// Send an UPDATE packet
#[command(name = "update")]
Update(self::update::Update),
/// Maintain a set of DNSSEC keys
#[command(name = "keyset")]
Keyset(self::keyset::Keyset),
/// Show the manual pages
Help(self::help::Help),
@@ -83,11 +88,12 @@ pub enum Command {
impl Command {
pub fn execute(self, env: impl Env) -> Result<(), Error> {
match self {
Self::Keygen(keygen) => keygen.execute(env),
Self::Nsec3Hash(nsec3hash) => nsec3hash.execute(env),
Self::Key2ds(key2ds) => key2ds.execute(env),
//Self::Keygen(keygen) => keygen.execute(env),
//Self::Nsec3Hash(nsec3hash) => nsec3hash.execute(env),
//Self::Key2ds(key2ds) => key2ds.execute(env),
Self::Notify(notify) => notify.execute(env),
Self::Update(update) => update.execute(env),
Self::Keyset(keyset) => keyset.execute(env),
Self::Help(help) => help.execute(),
Self::Report(s) => {
writeln!(env.stdout(), "{s}");
+6 -6
View File
@@ -2,10 +2,10 @@ use std::ffi::OsString;
use std::path::Path;
use clap::Parser;
use commands::key2ds::Key2ds;
use commands::keygen::Keygen;
//use commands::key2ds::Key2ds;
//use commands::keygen::Keygen;
use commands::notify::Notify;
use commands::nsec3hash::Nsec3Hash;
//use commands::nsec3hash::Nsec3Hash;
use commands::update::Update;
use commands::LdnsCommand;
use env::Env;
@@ -35,10 +35,10 @@ pub fn try_ldns_compatibility<I: IntoIterator<Item = OsString>>(
};
let res = match binary_name {
"key2ds" => Key2ds::parse_ldns_args(args_iter),
//"key2ds" => Key2ds::parse_ldns_args(args_iter),
"notify" => Notify::parse_ldns_args(args_iter),
"keygen" => Keygen::parse_ldns_args(args_iter),
"nsec3-hash" => Nsec3Hash::parse_ldns_args(args_iter),
//"keygen" => Keygen::parse_ldns_args(args_iter),
//"nsec3-hash" => Nsec3Hash::parse_ldns_args(args_iter),
"update" => Update::parse_ldns_args(args_iter),
_ => return Err(format!("Unrecognized ldns command 'ldns-{binary_name}'").into()),
};