From 148563b9a67152d8b58c6ddcc7a51a045b5fc0bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Br=C3=A9ard?= Date: Mon, 20 Jan 2025 10:21:47 +0100 Subject: [PATCH] Update dependencies --- Cargo.lock | 129 ++++++++++++++----------- Cargo.toml | 2 +- src/config.rs | 4 +- src/config/account.rs | 31 +++++- src/config/certificate.rs | 6 +- src/config/global.rs | 4 +- src/config/log.rs | 2 + tests/config/override/01_override.toml | 6 +- 8 files changed, 111 insertions(+), 73 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3007d85..b9c2e91 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -77,11 +77,12 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "3.0.6" +version = "3.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" +checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" dependencies = [ "anstyle", + "once_cell", "windows-sys 0.59.0", ] @@ -144,9 +145,9 @@ checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" [[package]] name = "cc" -version = "1.2.6" +version = "1.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d6dbb628b8f8555f86d0323c2eb39e3ec81901f4b83e091db8a6a76d316a333" +checksum = "13208fcbb66eaeffe09b99fffbe1af420f00a7b35aa99ad683dfc1aa76145229" dependencies = [ "shlex", ] @@ -165,9 +166,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "clap" -version = "4.5.23" +version = "4.5.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" +checksum = "a8eb5e908ef3a6efbe1ed62520fb7287959888c88485abe072543190ecc66783" dependencies = [ "clap_builder", "clap_derive", @@ -175,9 +176,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.23" +version = "4.5.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" +checksum = "96b01801b5fc6a0a232407abc821660c9c6d25a1cafc0d4f85f29fb8d9afc121" dependencies = [ "anstream", "anstyle", @@ -186,9 +187,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.18" +version = "4.5.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +checksum = "54b755194d6389280185988721fffba69495eed5ee9feeee9a599b53db80318c" dependencies = [ "heck", "proc-macro2", @@ -210,14 +211,14 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "config" -version = "0.14.1" +version = "0.15.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68578f196d2a33ff61b27fae256c3164f65e36382648e30666dde05b8cc9dfdf" +checksum = "e329294a796e9b22329669c1f433a746983f9e324e07f4ef135be81bb2262de4" dependencies = [ - "nom", "pathdiff", "serde", "toml", + "winnow", ] [[package]] @@ -597,9 +598,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.7.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" +checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" dependencies = [ "equivalent", "hashbrown", @@ -607,9 +608,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.10.1" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" [[package]] name = "is_terminal_polyfill" @@ -625,9 +626,9 @@ checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "js-sys" -version = "0.3.76" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ "once_cell", "wasm-bindgen", @@ -653,9 +654,9 @@ checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" [[package]] name = "log" -version = "0.4.22" +version = "0.4.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" [[package]] name = "memchr" @@ -677,9 +678,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ffbe83022cedc1d264172192511ae958937694cd57ce297164951b8b3568394" +checksum = "b8402cab7aefae129c6977bb0ff1b8fd9a04eb5b51efc50a70bea51cda0c7924" dependencies = [ "adler2", ] @@ -750,9 +751,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project-lite" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -771,9 +772,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.92" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" dependencies = [ "unicode-ident", ] @@ -871,9 +872,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.11" +version = "0.12.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe060fe50f524be480214aba758c71f99f90ee8c83c5a36b5e9e1d568eb4eb3" +checksum = "43e734407157c3c2034e0258f5e4473ddb361b1e85f95a66690d67264d7cd1da" dependencies = [ "base64", "bytes", @@ -943,9 +944,9 @@ checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" [[package]] name = "rustls" -version = "0.23.20" +version = "0.23.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5065c3f250cbd332cd894be57c40fa52387247659b14a2d6041d121547903b1b" +checksum = "8f287924602bf649d949c63dc8ac8b235fa5387d394020705b80c4eb597ce5b8" dependencies = [ "once_cell", "ring", @@ -984,6 +985,12 @@ dependencies = [ "untrusted", ] +[[package]] +name = "rustversion" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" + [[package]] name = "ryu" version = "1.0.18" @@ -1021,9 +1028,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.134" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d00f4175c42ee48b15416f6193a959ba3a0d67fc699a0db9ad12df9f83991c7d" +checksum = "930cfb6e6abf99298aaad7d29abbef7a9999a9a8806a40088f55f0dcec03146b" dependencies = [ "itoa", "memchr", @@ -1112,9 +1119,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.93" +version = "2.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c786062daee0d6db1132800e623df74274a0a87322d8e183338e01b3d98d058" +checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" dependencies = [ "proc-macro2", "quote", @@ -1154,18 +1161,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.9" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f072643fd0190df67a8bab670c20ef5d8737177d6ac6b2e9a236cb096206b2cc" +checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.9" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4" +checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" dependencies = [ "proc-macro2", "quote", @@ -1209,9 +1216,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.42.0" +version = "1.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" +checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e" dependencies = [ "backtrace", "bytes", @@ -1412,9 +1419,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "valuable" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" [[package]] name = "walkdir" @@ -1443,20 +1450,21 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", @@ -1468,9 +1476,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.49" +version = "0.4.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2" +checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" dependencies = [ "cfg-if", "js-sys", @@ -1481,9 +1489,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1491,9 +1499,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", @@ -1504,15 +1512,18 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] [[package]] name = "web-sys" -version = "0.3.76" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" dependencies = [ "js-sys", "wasm-bindgen", @@ -1682,9 +1693,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.20" +version = "0.6.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +checksum = "c8d71a593cc5c42ad7876e2c1fda56f314f3754c084128833e64f1345ff8a03a" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index 1bd6387..90f9006 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ ed448 = [] [dependencies] anyhow = { version = "1.0.94", default-features = false, features = ["std"] } clap = { version = "4.5.23", default-features = false, features = ["color", "derive", "help", "std", "string"] } -config = { version = "0.14.0", default-features = false, features = ["toml"] } +config = { version = "0.15.6", default-features = false, features = ["toml"] } daemonize = { version = "0.5.0", default-features = false } nom = { version = "7.1.3", default-features = false } reqwest = { version = "0.12.10", default-features = false, features = ["http2", "charset", "rustls-tls"] } diff --git a/src/config.rs b/src/config.rs index 9dd29f1..e213818 100644 --- a/src/config.rs +++ b/src/config.rs @@ -292,12 +292,12 @@ mod tests { ); assert!(cfg.rate_limit.is_empty()); assert_eq!(cfg.endpoint.len(), 2); - let ac1 = cfg.endpoint.get("test ac 1").unwrap(); + let ac1 = cfg.endpoint.get("test AC 1").unwrap(); assert_eq!(ac1.url, "https://acme-v02.ac1.example.org/directory"); assert_eq!(ac1.tos_agreed, true); assert!(ac1.random_early_renew.is_none()); assert!(ac1.root_certificates.is_empty()); - let ac2 = cfg.endpoint.get("test ac 2").unwrap(); + let ac2 = cfg.endpoint.get("test AC 2").unwrap(); assert_eq!(ac2.url, "https://acme-v02.ac2.example.org/directory"); assert_eq!(ac2.tos_agreed, false); assert_eq!(ac2.random_early_renew, Some(Duration::from_secs(10))); diff --git a/src/config/account.rs b/src/config/account.rs index ddc344d..5a0d5ae 100644 --- a/src/config/account.rs +++ b/src/config/account.rs @@ -46,18 +46,23 @@ pub struct ExternalAccount { } #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq)] +#[serde(rename_all = "lowercase")] pub enum AccountKeyType { Ed25519, Ed448, + #[serde(rename = "ecdsa_p256")] #[default] EcDsaP256, + #[serde(rename = "ecdsa_p384")] EcDsaP384, + #[serde(rename = "ecdsa_p521")] EcDsaP521, Rsa2048, Rsa4096, } #[derive(Clone, Debug, Deserialize, Eq, PartialEq)] +#[serde(rename_all = "UPPERCASE")] pub enum AccountSignatureAlgorithm { Hs256, Hs384, @@ -66,6 +71,7 @@ pub enum AccountSignatureAlgorithm { } #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq)] +#[serde(rename_all = "UPPERCASE")] pub enum ExternalAccountSignatureAlgorithm { #[default] Hs256, @@ -84,6 +90,29 @@ mod tests { assert!(res.is_err()); } + #[test] + fn account_key_types() { + let tests = [ + (AccountKeyType::Ed25519, "ed25519"), + (AccountKeyType::Ed448, "ed448"), + (AccountKeyType::EcDsaP256, "ecdsa_p256"), + (AccountKeyType::EcDsaP384, "ecdsa_p384"), + (AccountKeyType::EcDsaP521, "ecdsa_p521"), + (AccountKeyType::Rsa2048, "rsa2048"), + (AccountKeyType::Rsa4096, "rsa4096"), + ]; + let cfg = r#" +contacts = [ + { mailto = "acme@example.org" } +] +"#; + for (ref_val, str_val) in tests { + let cfg_str = format!("{cfg}\nkey_type = \"{str_val}\"\n"); + let a: Account = load_str(&cfg_str).unwrap(); + assert_eq!(a.key_type, ref_val); + } + } + #[test] fn account_minimal() { let cfg = r#" @@ -120,7 +149,7 @@ key_type = "rsa2048" signature_algorithm = "HS512" "#; let mut env = HashMap::with_capacity(2); - env.insert("test".to_string(), "Test".to_string()); + env.insert("TEST".to_string(), "Test".to_string()); let ea = ExternalAccount { identifier: "toto".to_string(), key: "VGhpcyBpcyBhIHRlc3Q=".to_string(), diff --git a/src/config/certificate.rs b/src/config/certificate.rs index 92bb2cf..cd355d2 100644 --- a/src/config/certificate.rs +++ b/src/config/certificate.rs @@ -49,6 +49,7 @@ impl<'de> Deserialize<'de> for Certificate { } #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq)] +#[serde(rename_all = "lowercase")] pub enum CsrDigest { #[default] Sha256, @@ -106,10 +107,9 @@ pub enum AcmeChallenge { } #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq)] +#[serde(rename_all = "lowercase")] pub enum KeyType { - #[serde(rename = "ed25519")] Ed25519, - #[serde(rename = "ed448")] Ed448, #[serde(rename = "ecdsa_p256")] EcDsaP256, @@ -118,9 +118,7 @@ pub enum KeyType { #[serde(rename = "ecdsa_p521")] EcDsaP521, #[default] - #[serde(rename = "rsa2048")] Rsa2048, - #[serde(rename = "rsa4096")] Rsa4096, } diff --git a/src/config/global.rs b/src/config/global.rs index d379a11..501370f 100644 --- a/src/config/global.rs +++ b/src/config/global.rs @@ -118,8 +118,8 @@ root_certificates = ["root_cert.pem"] "#; let mut env = HashMap::with_capacity(2); - env.insert("test".to_string(), "Test".to_string()); - env.insert("http_root".to_string(), "/srv/http".to_string()); + env.insert("TEST".to_string(), "Test".to_string()); + env.insert("HTTP_ROOT".to_string(), "/srv/http".to_string()); let go: GlobalOptions = load_str(cfg).unwrap(); assert_eq!(go.accounts_directory, PathBuf::from("/tmp/accounts")); assert_eq!(go.cert_file_group, Some("acme_test".to_string())); diff --git a/src/config/log.rs b/src/config/log.rs index 6df4210..cad17a5 100644 --- a/src/config/log.rs +++ b/src/config/log.rs @@ -66,6 +66,7 @@ impl<'de> Deserialize<'de> for Facility { } #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq)] +#[serde(rename_all = "lowercase")] pub enum LogFormat { Compact, #[default] @@ -75,6 +76,7 @@ pub enum LogFormat { } #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq)] +#[serde(rename_all = "lowercase")] pub(in crate::config) enum Level { Error, Warn, diff --git a/tests/config/override/01_override.toml b/tests/config/override/01_override.toml index 1e5731f..c6f87be 100644 --- a/tests/config/override/01_override.toml +++ b/tests/config/override/01_override.toml @@ -1,11 +1,9 @@ global.accounts_directory = "/tmp/other/account/dir" -endpoint."test ac 2".random_early_renew = "10s" +endpoint."test AC 2".random_early_renew = "10s" +endpoint."test AC 2".root_certificates = ["test.pem"] endpoint."test AC 1".tos_agreed = true -[endpoint."test AC 2"] -root_certificates = ["test.pem"] - [group] test-grp = ["test-hook"]