[control] Design review: Caddy differences per host in fallback_ready, active apply kind, hosts and watch end, capped device end date, CSR fingerprint for signing by hand, crash points exit without SIGABRT

This commit is contained in:
2026-11-08 11:21:43 +01:00
parent 3bf5fa0e1a
commit b24ffdf9db
9 changed files with 106 additions and 17 deletions
+16
View File
@@ -79,6 +79,9 @@ pub struct PkiRequestView {
pub name: Option<String>,
/// Renewals: the request to sign offline (also `GET /pki-requests/{id}/csr`).
pub csr_pem: Option<String>,
/// Renewals: SHA-256 of the request (DER, lowercase hex), what
/// `openssl req -in X.csr -outform DER | openssl dgst -sha256` prints on the offline computer.
pub csr_sha256: Option<String>,
/// Renewals, once installed: the new intermediate's expiry.
pub not_after: Option<String>,
/// What to tell the user now (`pki.waiting.manual`, `pki.renew.manual`, `pki.denied`, …).
@@ -138,6 +141,11 @@ pub fn request_view(c: &Control, r: &Request) -> PkiRequestView {
device_id: r.device_id.clone(),
name: r.name.clone(),
csr_pem: r.csr_pem.clone(),
csr_sha256: r
.csr_pem
.as_deref()
.and_then(|c| ianitor_core::pki::csr_der(c).ok())
.map(|d| ianitor_core::pki::sha256_hex(&d)),
not_after: r.not_after.map(|t| rfc3339(t.max(0) as u64)),
message_code,
message: message_text,
@@ -247,6 +255,9 @@ pub struct CertsView {
pub root: RootView,
pub devices: Vec<DeviceView>,
pub device_lifetime_days: u32,
/// When a device certificate issued now would end: a year, but never past the
/// intermediate's end (decision Q7). None without an intermediate.
pub device_valid_until: Option<String>,
pub server_lifetime_days: u32,
/// `manual` (on the server, until Custos can) or `custos`.
pub approval: String,
@@ -283,6 +294,11 @@ pub async fn get_certs(State(st): Shared) -> Result<Response, ApiError> {
.map(|d| device_view(d, t))
.collect(),
device_lifetime_days: ianitor_core::pki::DEVICE_DAYS,
device_valid_until: p.intermediate_info().map(|i| {
let end = (t as i64 + i64::from(ianitor_core::pki::DEVICE_DAYS) * 86_400)
.min(i.not_after);
rfc3339(end.max(0) as u64)
}),
server_lifetime_days: ianitor_core::pki::SERVER_DAYS,
approval: c
.cfg