[control] Fix round 2: Caddy rereads its files on every load and the served certificate is checked, Caddy trials get a deadline outside control (caddy-guard, caddy-revert), the watch under Caddy judges upstreams as edge does, a reload of Caddy during the watch is noticed and device changes wait for the apply, stricter root key scan, IPv4-mapped trusted proxies
This commit is contained in:
@@ -166,6 +166,9 @@ impl Control {
|
||||
/// The device files changed (issue or revoke): rewrite them and tell the engine at once.
|
||||
pub async fn devices_changed(&self) -> Result<(), String> {
|
||||
let Some(p) = &self.pki else { return Ok(()) };
|
||||
// Behind a running apply (QC round 2, M2): a reload during a Caddy trial's watch would
|
||||
// drop the trial; afterwards it loads whatever is current.
|
||||
let _apply = self.apply_lock.lock().await;
|
||||
let _engine = self.engine_lock.lock().await;
|
||||
let t = now();
|
||||
let mut result = Ok(());
|
||||
@@ -180,7 +183,7 @@ impl Control {
|
||||
// Tell the serving engine every time, changed or not: a repeated Revoke nudges again.
|
||||
if result.is_ok() {
|
||||
result = if self.engine_running() == "caddy" {
|
||||
self.caddy_reload()
|
||||
self.caddy_reload_checked()
|
||||
.await
|
||||
.map_err(|e| format!("Caddy did not reload the device list: {e}"))
|
||||
} else if self.edge.attached() {
|
||||
@@ -204,7 +207,7 @@ impl Control {
|
||||
async fn reload_serving_engine(&self) {
|
||||
let _engine = self.engine_lock.lock().await;
|
||||
if self.engine_running() == "caddy" {
|
||||
if let Err(e) = self.caddy_reload().await {
|
||||
if let Err(e) = self.caddy_reload_checked().await {
|
||||
log::error!(target: "ianitor::pki", "Caddy did not reload the new certificates: {e}");
|
||||
}
|
||||
} else if self.edge.attached()
|
||||
|
||||
Reference in New Issue
Block a user