diff options
author | Galen Guyer <galen@galenguyer.com> | 2022-11-17 15:35:50 -0500 |
---|---|---|
committer | Galen Guyer <galen@galenguyer.com> | 2022-11-17 15:35:50 -0500 |
commit | 74a078e515e6f272c928deba3ee41130b164c447 (patch) | |
tree | aa8cc2c0a708fc0f19b56fa9f690e383d8d4f062 | |
parent | 9ac1daf2e77869a52d20aa59436b00c653d2587d (diff) |
Update dependencies
-rw-r--r-- | Cargo.lock | 229 | ||||
-rw-r--r-- | Cargo.toml | 12 | ||||
-rw-r--r-- | src/cli.rs | 4 | ||||
-rw-r--r-- | src/lib/mod.rs | 2 | ||||
-rw-r--r-- | src/lib/ops.rs | 68 |
5 files changed, 190 insertions, 125 deletions
@@ -49,27 +49,25 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "3.1.6" +version = "4.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8c93436c21e4698bacadf42917db28b23017027a4deccb35dbe47a7e7840123" +checksum = "2148adefda54e14492fb9bddcc600b4344c5d1a3123bd666dcb939c6f0e0e57e" dependencies = [ "atty", "bitflags", "clap_derive", - "indexmap", - "lazy_static", - "os_str_bytes", + "clap_lex", + "once_cell", "strsim", "termcolor", "terminal_size", - "textwrap", ] [[package]] name = "clap_derive" -version = "3.1.4" +version = "4.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da95d038ede1a964ce99f49cbe27a7fb538d1da595e4b4f70b8c8f338d17bf16" +checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014" dependencies = [ "heck", "proc-macro-error", @@ -79,22 +77,21 @@ dependencies = [ ] [[package]] -name = "dirs" -version = "4.0.0" +name = "clap_lex" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" +checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8" dependencies = [ - "dirs-sys", + "os_str_bytes", ] [[package]] -name = "dirs-next" -version = "2.0.0" +name = "dirs" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" dependencies = [ - "cfg-if", - "dirs-sys-next", + "dirs-sys", ] [[package]] @@ -109,23 +106,30 @@ dependencies = [ ] [[package]] -name = "dirs-sys-next" -version = "0.1.2" +name = "dotenvy" +version = "0.15.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03d8c417d7a8cb362e0c37e5d815f5eb7c37f79ff93707329d5a194e42e54ca0" + +[[package]] +name = "errno" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" dependencies = [ + "errno-dragonfly", "libc", - "redox_users", "winapi", ] [[package]] -name = "dotenvy" -version = "0.15.1" +name = "errno-dragonfly" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e851a83c30366fd01d75b913588e95e74a1705c1ecc5d58b1f8e1a6d556525f" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" dependencies = [ - "dirs", + "cc", + "libc", ] [[package]] @@ -156,7 +160,7 @@ dependencies = [ [[package]] name = "hancock" -version = "1.5.0" +version = "1.5.1" dependencies = [ "caps", "clap", @@ -168,12 +172,6 @@ dependencies = [ ] [[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" - -[[package]] name = "heck" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -189,58 +187,60 @@ dependencies = [ ] [[package]] -name = "indexmap" -version = "1.8.0" +name = "io-lifetimes" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" -dependencies = [ - "autocfg", - "hashbrown", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" [[package]] name = "libc" -version = "0.2.121" +version = "0.2.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" +checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" [[package]] -name = "memchr" -version = "2.4.1" +name = "linux-raw-sys" +version = "0.0.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" [[package]] name = "once_cell" -version = "1.10.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" +checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" [[package]] name = "openssl" -version = "0.10.38" +version = "0.10.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" +checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13" dependencies = [ "bitflags", "cfg-if", "foreign-types", "libc", "once_cell", + "openssl-macros", "openssl-sys", ] [[package]] +name = "openssl-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] name = "openssl-sys" -version = "0.9.72" +version = "0.9.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb" +checksum = "b03b84c3b2d099b81f0953422b4d4ad58761589d0229b5506356afca05a3670a" dependencies = [ "autocfg", "cc", @@ -254,24 +254,21 @@ name = "os_str_bytes" version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" -dependencies = [ - "memchr", -] [[package]] name = "path-absolutize" -version = "3.0.12" +version = "3.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a2a79d7c1c4eab523515c4561459b10516d6e7014aa76edc3ea05680d5c5d2d" +checksum = "0f1d4993b16f7325d90c18c3c6a3327db7808752db8d208cea0acee0abd52c52" dependencies = [ "path-dedot", ] [[package]] name = "path-dedot" -version = "3.0.16" +version = "3.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f326e2a3331685a5e3d4633bb9836bd92126e08037cb512252f3612f616a0b28" +checksum = "9a81540d94551664b72b72829b12bd167c73c9d25fbac0e04fafa8023f7e4901" dependencies = [ "once_cell", ] @@ -308,11 +305,11 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.36" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" +checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] @@ -345,12 +342,26 @@ dependencies = [ ] [[package]] +name = "rustix" +version = "0.35.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] name = "shellexpand" -version = "2.1.0" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83bdb7831b2d85ddf4a7b148aa19d0587eddbe8671a436b7bd1182eaad0f2829" +checksum = "7ccc8076840c4da029af4f87e4e8daeb0fca6b87bbb02e10cb60b791450e11e4" dependencies = [ - "dirs-next", + "dirs", ] [[package]] @@ -381,21 +392,12 @@ dependencies = [ [[package]] name = "terminal_size" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "textwrap" -version = "0.15.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" +checksum = "40ca90c434fd12083d1a6bdcbe9f92a14f96c8a1ba600ba451734ac334521f7a" dependencies = [ - "terminal_size", + "rustix", + "windows-sys", ] [[package]] @@ -419,6 +421,12 @@ dependencies = [ ] [[package]] +name = "unicode-ident" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" + +[[package]] name = "unicode-xid" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -472,3 +480,60 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" @@ -1,7 +1,7 @@ [package] name = "hancock" authors = ["Galen Guyer <galen@galenguyer.com>"] -version = "1.5.0" +version = "1.5.1" edition = "2021" license = "MIT" @@ -16,9 +16,9 @@ path = "src/cli.rs" [dependencies] caps = "0.5.5" -clap = { version = "3.1.6", features = ["cargo", "derive", "env", "wrap_help"] } +clap = { version = "4.0.26", features = ["cargo", "derive", "env", "wrap_help"] } dirs = "4.0.0" -dotenvy = "0.15.1" -openssl = "0.10.38" -path-absolutize = "3.0.12" -shellexpand = "2.1.0" +dotenvy = "0.15.6" +openssl = "0.10.42" +path-absolutize = "3.0.14" +shellexpand = "2.1.2" @@ -4,8 +4,8 @@ use std::path::Path; use hancock::ops::*; #[derive(Parser, Debug)] -#[clap(author, version, about, long_about = None)] -#[clap(propagate_version = true)] +#[command(author, version, about, long_about = None)] +#[command(propagate_version = true)] pub struct Cli { #[clap(subcommand)] pub command: Commands, diff --git a/src/lib/mod.rs b/src/lib/mod.rs index 56a7b42..1b413ef 100644 --- a/src/lib/mod.rs +++ b/src/lib/mod.rs @@ -5,7 +5,7 @@ pub mod pkey; pub mod req; pub mod root; -#[derive(Clone, Copy)] +#[derive(Debug, Clone, Copy)] pub enum KeyType { Ecdsa, Rsa(u32), diff --git a/src/lib/ops.rs b/src/lib/ops.rs index 43fcede..021797d 100644 --- a/src/lib/ops.rs +++ b/src/lib/ops.rs @@ -9,125 +9,125 @@ use crate::KeyType; use crate::*; #[derive(Args, Debug)] -#[clap(about = "Generate a new root certificate")] +#[command(about = "Generate a new root certificate")] pub struct Init { /// Base directory to store certificates - #[clap(long, default_value = "~/.hancock", env = "CA_BASE_DIR")] + #[arg(long, default_value = "~/.hancock", env = "CA_BASE_DIR")] pub base_dir: String, /// Algorithm to generate private keys ('RSA' or 'ECDSA') - #[clap(long, short = 't', default_value = "RSA", validator = validate_key_type)] + #[arg(long, short = 't', default_value = "RSA", value_parser = type_parser)] pub key_type: String, /// Length to use when generating an RSA key. Ignored for ECDSA - #[clap(long, short = 'b', default_value_t = 4096)] + #[arg(long, short = 'b', default_value_t = 4096)] pub key_length: u32, /// Lifetime in days of the generated certificate - #[clap(long, short = 'd', default_value_t = 365 * 10)] + #[arg(long, short = 'd', default_value_t = 365 * 10)] pub lifetime: u32, /// Certificate CommonName - #[clap(long, short = 'n')] + #[arg(long, short = 'n')] pub common_name: Option<String>, /// Certificate Country - #[clap(long, short = 'c')] + #[arg(long, short = 'c')] pub country: Option<String>, /// Certificate State or Province - #[clap(long, short = 's')] + #[arg(long, short = 's')] pub state: Option<String>, /// Certificate Locality - #[clap(long, short = 'l')] + #[arg(long, short = 'l')] pub locality: Option<String>, /// Certificate Organization - #[clap(long, short = 'o')] + #[arg(long, short = 'o')] pub organization: Option<String>, /// Certificate Organizational Unit - #[clap(long, short = 'u')] + #[arg(long, short = 'u')] pub organizational_unit: Option<String>, /// Password for private key - #[clap(long, short = 'p', env = "CA_PASSWORD")] + #[arg(long, short = 'p', env = "CA_PASSWORD")] pub password: Option<String>, } #[derive(Args, Debug)] -#[clap(about = "Issue a new certificate")] +#[command(about = "Issue a new certificate")] pub struct Issue { /// Base directory to store certificates - #[clap(long, default_value = "~/.hancock", env = "CA_BASE_DIR")] + #[arg(long, default_value = "~/.hancock", env = "CA_BASE_DIR")] pub base_dir: String, /// Algorithm to generate private keys ('RSA' or 'ECDSA') - #[clap(long, short = 't', default_value = "RSA", validator = validate_key_type)] + #[arg(long, short = 't', default_value = "RSA")] pub key_type: String, /// Length to use when generating an RSA key. Ignored for ECDSA - #[clap(long, short = 'b', default_value_t = 2048)] + #[arg(long, short = 'b', default_value_t = 2048)] pub key_length: u32, /// Lifetime in days of the generated certificate - #[clap(long, short = 'd', default_value_t = 90)] + #[arg(long, short = 'd', default_value_t = 90)] pub lifetime: u32, /// Certificate CommonName - #[clap(long, short = 'n')] + #[arg(long, short = 'n')] pub common_name: String, /// Certificate Country - #[clap(long, short = 'c')] + #[arg(long, short = 'c')] pub country: Option<String>, /// Certificate State or Province - #[clap(long, short = 's')] + #[arg(long, short = 's')] pub state: Option<String>, /// Certificate Locality - #[clap(long, short = 'l')] + #[arg(long, short = 'l')] pub locality: Option<String>, /// Certificate Organization - #[clap(long, short = 'o')] + #[arg(long, short = 'o')] pub organization: Option<String>, /// Certificate Organizational Unit - #[clap(long, short = 'u')] + #[arg(long, short = 'u')] pub organizational_unit: Option<String>, /// Subject Alternative Names - #[clap(long)] + #[arg(long)] pub subject_alt_names: Option<String>, /// Password for private key - #[clap(long, short = 'p', env = "CA_PASSWORD")] + #[arg(long, short = 'p', env = "CA_PASSWORD")] pub password: Option<String>, } #[derive(Args, Debug)] -#[clap(about = "List all known certificates")] +#[command(about = "List all known certificates")] pub struct List { - #[clap(long, default_value = "~/.hancock", env = "CA_BASE_DIR")] + #[arg(long, default_value = "~/.hancock", env = "CA_BASE_DIR")] pub base_dir: String, } #[derive(Args, Debug)] -#[clap(about = "Renew a certificate or all if no Common Name is specified")] +#[command(about = "Renew a certificate or all if no Common Name is specified")] pub struct Renew { /// Base directory to store certificates - #[clap(long, default_value = "~/.hancock", env = "CA_BASE_DIR")] + #[arg(long, default_value = "~/.hancock", env = "CA_BASE_DIR")] pub base_dir: String, /// Certificate CommonName - #[clap(long, short = 'n')] + #[arg(long, short = 'n')] pub common_name: Option<String>, /// Password for private key - #[clap(long, short = 'p', env = "CA_PASSWORD")] + #[arg(long, short = 'p', env = "CA_PASSWORD")] pub password: Option<String>, } @@ -345,13 +345,13 @@ fn cert_info(crt: openssl::x509::X509) -> String { format!("{cn} - expires {ex} (originally {orig} days)") } -fn validate_key_type(input: &str) -> Result<(), String> { +fn type_parser(input: &str) -> Result<String, String> { let input = input.to_string().to_uppercase(); if input == "RSA" || input == "ECDSA" { - Ok(()) + Ok(input) } else { Err(format!( - "{} is not a valid key type ['rsa', 'ecdsa']", + "{} is not a valid key type ['RSA', 'ECDSA']", input )) } |