From f8c1453bdb2ea3ff1ceb53caa41164b063d819ee Mon Sep 17 00:00:00 2001 From: Philip Homburg Date: Thu, 17 Apr 2025 13:37:25 +0200 Subject: [PATCH] Initial version of keyset. --- Cargo.toml | 10 +++++++--- src/commands/mod.rs | 32 +++++++++++++++++++------------- src/lib.rs | 12 ++++++------ 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ff61413..8257c68 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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", ] } diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 8d2a211..0001de0 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -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 { /// is the 16-bit tag of the key, zero-padded to 5 digits. /// /// Upon completion, 'K++' 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++.ds`. The base name `K++` /// 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}"); diff --git a/src/lib.rs b/src/lib.rs index c8b435f..c3871b6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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>( }; 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()), };