Rodolphe Bréard
2 months ago
Failed to extract signature
6 changed files with
431 additions and
417 deletions
-
Cargo.lock
-
acme_common/Cargo.toml
-
acmed/Cargo.toml
-
acmed/src/account/storage.rs
-
acmed/src/certificate.rs
-
acmed/src/duration.rs
|
|
@ -35,7 +35,7 @@ punycode = "0.4.1" |
|
|
|
reqwest = { version = "0.12.1", default-features = false } |
|
|
|
serde_json = "1.0.114" |
|
|
|
syslog = "7.0.0" |
|
|
|
toml = "0.8.12" |
|
|
|
toml = "0.9.5" |
|
|
|
|
|
|
|
[target.'cfg(unix)'.dependencies] |
|
|
|
nix = "0.29.0" |
|
|
|
nix = "0.30.1" |
|
|
@ -24,23 +24,23 @@ openssl_vendored = ["crypto_openssl", "acme_common/openssl_vendored"] |
|
|
|
acme_common = { path = "../acme_common" } |
|
|
|
async-lock = "3.3.0" |
|
|
|
async-process = "2.1.0" |
|
|
|
bincode = "1.3.3" |
|
|
|
bincode = { version = "2.0.1", features = ["serde"] } |
|
|
|
clap = { version = "4.5.3", features = ["string"] } |
|
|
|
futures = "0.3.30" |
|
|
|
glob = "0.3.1" |
|
|
|
log = "0.4.21" |
|
|
|
nom = { version = "7.1.3", default-features = false, features = [] } |
|
|
|
nom = { version = "8.0.0", default-features = false, features = [] } |
|
|
|
serde = { version = "1.0.197", features = ["derive"] } |
|
|
|
serde_json = "1.0.114" |
|
|
|
toml = "0.8.12" |
|
|
|
toml = "0.9.5" |
|
|
|
tokio = { version = "1.36.0", features = ["full"] } |
|
|
|
rand = "0.8.5" |
|
|
|
rand = "0.9.2" |
|
|
|
reqwest = "0.12.1" |
|
|
|
minijinja = "2.5.0" |
|
|
|
|
|
|
|
[target.'cfg(unix)'.dependencies] |
|
|
|
nix = { version = "0.29.0", features = ["fs", "user"] } |
|
|
|
nix = { version = "0.30.1", features = ["fs", "user"] } |
|
|
|
|
|
|
|
[build-dependencies] |
|
|
|
serde = { version = "1.0.197", features = ["derive"] } |
|
|
|
toml = "0.8.12" |
|
|
|
toml = "0.9.5" |
|
|
@ -104,8 +104,10 @@ struct AccountStorage { |
|
|
|
async fn do_fetch(file_manager: &FileManager, name: &str) -> Result<Option<Account>, Error> {
|
|
|
|
if account_files_exists(file_manager) {
|
|
|
|
let data = get_account_data(file_manager).await?;
|
|
|
|
let obj: AccountStorage = bincode::deserialize(&data[..])
|
|
|
|
.map_err(|e| Error::from(&e.to_string()).prefix(name))?;
|
|
|
|
let cfg = bincode::config::legacy();
|
|
|
|
let obj: AccountStorage = bincode::serde::decode_from_slice(&data[..], cfg)
|
|
|
|
.map_err(|e| Error::from(&e.to_string()).prefix(name))?
|
|
|
|
.0;
|
|
|
|
let endpoints = obj
|
|
|
|
.endpoints
|
|
|
|
.iter()
|
|
|
@ -168,7 +170,8 @@ async fn do_save(file_manager: &FileManager, account: &Account) -> Result<(), Er |
|
|
|
past_keys,
|
|
|
|
external_account,
|
|
|
|
};
|
|
|
|
let encoded: Vec<u8> = bincode::serialize(&account_storage)
|
|
|
|
let cfg = bincode::config::legacy();
|
|
|
|
let encoded: Vec<u8> = bincode::serde::encode_to_vec(&account_storage, cfg)
|
|
|
|
.map_err(|e| Error::from(&e.to_string()).prefix(&account.name))?;
|
|
|
|
set_account_data(file_manager, &encoded).await
|
|
|
|
}
|
|
|
|
|
|
@ -6,7 +6,7 @@ use crate::storage::{certificate_files_exists, get_certificate, FileManager}; |
|
|
|
use acme_common::crypto::{HashFunction, KeyType, SubjectAttribute, X509Certificate};
|
|
|
|
use acme_common::error::Error;
|
|
|
|
use log::{debug, info, trace, warn};
|
|
|
|
use rand::{thread_rng, Rng};
|
|
|
|
use rand::{rng, Rng};
|
|
|
|
use std::collections::{HashMap, HashSet};
|
|
|
|
use std::fmt;
|
|
|
|
use std::time::Duration;
|
|
|
@ -82,7 +82,7 @@ impl Certificate { |
|
|
|
let expires_in = expires_in.saturating_sub(self.renew_delay);
|
|
|
|
let expires_in = if !self.random_early_renew.is_zero() {
|
|
|
|
expires_in
|
|
|
|
.saturating_sub(thread_rng().gen_range(Duration::ZERO..self.random_early_renew))
|
|
|
|
.saturating_sub(rng().random_range(Duration::ZERO..self.random_early_renew))
|
|
|
|
} else {
|
|
|
|
expires_in
|
|
|
|
};
|
|
|
|
|
|
@ -3,7 +3,7 @@ use nom::bytes::complete::take_while_m_n; |
|
|
|
use nom::character::complete::digit1;
|
|
|
|
use nom::combinator::map_res;
|
|
|
|
use nom::multi::fold_many1;
|
|
|
|
use nom::IResult;
|
|
|
|
use nom::{IResult, Parser};
|
|
|
|
use std::time::Duration;
|
|
|
|
|
|
|
|
fn is_duration_chr(c: char) -> bool {
|
|
|
@ -24,7 +24,7 @@ fn get_multiplicator(input: &str) -> IResult<&str, u64> { |
|
|
|
}
|
|
|
|
|
|
|
|
fn get_duration_part(input: &str) -> IResult<&str, Duration> {
|
|
|
|
let (input, nb) = map_res(digit1, |s: &str| s.parse::<u64>())(input)?;
|
|
|
|
let (input, nb) = map_res(digit1, |s: &str| s.parse::<u64>()).parse(input)?;
|
|
|
|
let (input, mult) = get_multiplicator(input)?;
|
|
|
|
Ok((input, Duration::from_secs(nb * mult)))
|
|
|
|
}
|
|
|
@ -37,7 +37,8 @@ fn get_duration(input: &str) -> IResult<&str, Duration> { |
|
|
|
acc += item;
|
|
|
|
acc
|
|
|
|
},
|
|
|
|
)(input)
|
|
|
|
)
|
|
|
|
.parse(input)
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn parse_duration(input: &str) -> Result<Duration, Error> {
|
|
|
|