[control] QC minors: device install links open a page and download on POST (never listed), approve and install failures show on the request and the CLI waits, PBKDF2 floor, private pki dirs or an error, trusted_proxies for a proxy in front, a placeholder keeps the device allow list from being empty (Caddy refuses that)

This commit is contained in:
2026-11-08 11:02:50 +01:00
parent bc336d1188
commit 3bf5fa0e1a
27 changed files with 548 additions and 46 deletions
+1
View File
@@ -180,6 +180,7 @@ impl Env {
caddy_credentials_dir: self.dir.str("creds"),
caddy_admin: None,
caddy_admin_socket: None,
trusted_proxies: Vec::new(),
}
}
+1
View File
@@ -41,6 +41,7 @@ mod unix {
caddy_credentials_dir: o.caddy_credentials_dir.clone(),
caddy_admin: o.caddy_admin,
caddy_admin_socket: o.caddy_admin_socket.clone(),
trusted_proxies: o.trusted_proxies.clone(),
}
}
+54 -2
View File
@@ -19,8 +19,8 @@ fn skipped_on_windows() {
#[cfg(unix)]
mod unix {
use ianitor_diff::{
Env, break_caddy, break_edge, compile_pair, corpus, run_corpus, settle, start_caddy,
start_edge,
Action, Env, break_caddy, break_edge, compile_pair, corpus, run_cases, run_corpus, settle,
start_caddy, start_edge,
};
use ianitor_testkit::proc::require_binary;
@@ -61,6 +61,58 @@ mod unix {
}
}
/// No device enrolled yet (or every one revoked). Caddy refuses a leaf list with no
/// certificate in it (QC, fix round 1: the whole config fails to load), so control writes
/// a placeholder no one holds the key to. Both engines start, serve the other hosts, and
/// let no device in.
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn with_no_device_enrolled_both_engines_start_and_let_no_device_in() {
let Some(caddy_bin) = require_binary("caddy") else {
return;
};
let env = Env::start().await;
std::fs::write(
env.dir.join(&format!(
"certs/{}",
ianitor_core::compile::DEVICE_ALLOW_FILE
)),
ianitor_core::pki::no_device_placeholder(0).unwrap(),
)
.unwrap();
let (edge_cfg, caddy_cfg) = compile_pair(&env);
let ianitor = start_edge(&env, "ianitor", &edge_cfg);
let caddy = start_caddy(&env, "caddy", &caddy_bin, &caddy_cfg);
settle().await;
let report = run_cases(&ianitor, &caddy, env.roots(), |c| {
matches!(c.action, Action::HttpsDevice { .. }) || c.name == "plain GET"
})
.await;
println!("{}", report.render("Ianitor vs Caddy, empty allow list"));
assert!(
report.mismatches().is_empty(),
"{}",
report.render("Ianitor vs Caddy, empty allow list")
);
let get = |name: &str| {
report
.outcomes
.iter()
.find(|o| o.name == name)
.unwrap_or_else(|| panic!("no case {name}"))
};
assert_eq!(
get("plain GET").caddy.status,
200,
"Caddy serves the others"
);
let listed = get("Domi device certificate on the allow list");
assert!(
!(200..300).contains(&listed.ianitor.status),
"a device got in with an empty allow list: {}",
listed.ianitor.status
);
}
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn a_deliberately_broken_compiler_is_caught() {
let Some(caddy_bin) = require_binary("caddy") else {