Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keygen command. #9

Merged
merged 42 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
fdb4cb1
Keygen skeleton.
ximon18 Oct 17, 2024
c914a7c
[keygen] Implement the basic features
bal-e Oct 29, 2024
7dc6b82
[keygen] synchronize files before exiting
bal-e Oct 29, 2024
5746c3b
[keygen] Add help documentation
bal-e Oct 29, 2024
0333288
[keygen] Generate '.ds' files for KSKs
bal-e Oct 29, 2024
b313809
[keygen] Use 'display_as_bind()'
bal-e Oct 30, 2024
4f2fd8e
[keygen] Add support for symlinks (Unix only)
bal-e Oct 30, 2024
51cdb1c
Merge branch 'main' into keygen
bal-e Nov 11, 2024
73550b4
[keygen] Improve errors and support '.ds' symlinks
bal-e Nov 13, 2024
086246b
Implement ldns-specific parsing for 'keygen'
bal-e Nov 15, 2024
0ef9f0a
Merge branch 'main' into keygen
bal-e Nov 15, 2024
643ab86
[keygen] Implement '-v' with version info
bal-e Nov 15, 2024
a062704
[keygen] Add 'cfg(unix)' in ldns-parsing
bal-e Nov 15, 2024
d450192
[keygen] Correctly handle duplicate options in ldns parsing
bal-e Nov 15, 2024
f503fc8
Revert "[keygen] Implement '-v' with version info"
bal-e Nov 15, 2024
a5052ac
Merge branch 'main' into keygen
bal-e Nov 19, 2024
76d604a
[keygen] Integrate the use of 'Env'
bal-e Nov 19, 2024
bf09e96
[workflows/ci] Add OpenSSL installation steps
bal-e Nov 19, 2024
532a399
[workflows/ci] Integrate OpenSSL for 'minimal_versions'
bal-e Nov 19, 2024
eb171c4
Merge branch 'main' into keygen
bal-e Nov 19, 2024
f524f89
[keygen] Improve the 'dnst' interface
bal-e Nov 21, 2024
84977fb
[keygen] Satisfy clippy
bal-e Nov 21, 2024
a2224e6
[keygen] Simplify symlink CLI
bal-e Nov 25, 2024
9772177
Merge branch 'main' into keygen
bal-e Nov 25, 2024
4158fb8
Add basic filesystem operations to 'Env'
bal-e Nov 25, 2024
cf85404
[keygen] Use symlink ops provided by 'Env'
bal-e Nov 25, 2024
114b931
[keygen] Add basic tests for argument parsing
bal-e Nov 25, 2024
4a3fb18
[keygen] Add tests
bal-e Nov 26, 2024
1a0aa79
[keygen] Satisfy 'minimal-versions'
bal-e Nov 26, 2024
c531ec7
[keygen] Satisfy clippy
bal-e Nov 26, 2024
dbaf113
[keygen] Add Windows-specific missing branch
bal-e Nov 27, 2024
8bbd0f9
[keygen] Document parsing for 'symlink'
bal-e Nov 27, 2024
9752b69
[keygen] Report error on '-r'
bal-e Nov 28, 2024
59ca8d2
[env] Refactor util fns into a 'util' module
bal-e Nov 28, 2024
fae388e
[keygen::symlink] Mark params as used, for Windows
bal-e Nov 28, 2024
f8a545a
[keygen] Fix double error message
bal-e Nov 29, 2024
639a835
Merge branch 'main' into keygen
bal-e Nov 29, 2024
9e9aec2
[keygen] Use 'Args::Report'
bal-e Nov 29, 2024
6a4646a
[keygen] Allow invalid HTML in docs for Clap
bal-e Nov 29, 2024
2ce049d
Use 'domain'-style imports
bal-e Nov 29, 2024
f5aba21
[keygen] Use uppercase for expected clap values
bal-e Nov 29, 2024
faffc71
[keygen] use lowercase value names in Clap
bal-e Dec 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/commands/keygen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use std::ffi::OsString;
use std::io::Write;
use std::path::Path;

use clap::{builder::ValueParser, ValueEnum};
use clap::builder::ValueParser;
use clap::ValueEnum;
use domain::base::iana::{DigestAlg, SecAlg};
use domain::base::name::Name;
use domain::base::zonefile_fmt::ZonefileFmt;
Expand All @@ -27,6 +28,7 @@ pub struct Keygen {
/// - ECDSAP384SHA384: An ECDSA P-384 SHA-384 key (algorithm 14)
/// - ED25519: An Ed25519 key (algorithm 15)
/// - ED448: An Ed448 key (algorithm 16)
#[allow(rustdoc::invalid_html_tags)]
#[arg(
short = 'a',
long = "algorithm",
Expand Down Expand Up @@ -63,7 +65,7 @@ pub struct Keygen {
symlink: SymlinkArg,

/// The domain name to generate a key for
#[arg(value_name = "domain name", value_parser = ValueParser::new(parse_name))]
#[arg(value_name = "DOMAIN_NAME", value_parser = ValueParser::new(parse_name))]
bal-e marked this conversation as resolved.
Show resolved Hide resolved
name: Name<Vec<u8>>,
}

Expand Down
1 change: 1 addition & 0 deletions src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ 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),

Expand Down
6 changes: 4 additions & 2 deletions src/util.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
//! A utility module for common operations.

use std::{fs::File, path::Path};
use std::fs::File;
use std::path::Path;

use crate::{env::Env, error::Result};
use crate::env::Env;
use crate::error::Result;

/// Create and open a file.
pub fn create_new_file(env: &impl Env, path: impl AsRef<Path>) -> Result<File> {
Expand Down