Verify signed time independently of job admission for passive Windows clients
Rust development slice / linux (push) Failing after 7s

This commit is contained in:
2026-11-15 14:35:22 +01:00
parent 94b912df8d
commit 656102bd25
3 changed files with 90 additions and 15 deletions
+20 -15
View File
@@ -458,9 +458,13 @@ impl Agent {
identity: &crate::certificate_rotation::DeviceIdentity,
) -> Result<()> {
ensure!(self.time_refresh.is_none(), "TIME_REFRESH_ALREADY_RUNNING");
if !self.config.enable_jobs {
use rmm_agent_windows::signed_clock::{CONFIG_PATH, SamplingMode};
// Presence opts into sampling only. Each role opens and verifies the
// protected profile and signed response itself before accepting time.
let Some(mode) = SamplingMode::configured(self.config.enable_jobs, Path::new(CONFIG_PATH))?
else {
return Ok(());
}
};
let client = crate::https_channel::mtls_client(
self.config.connect_address,
&self.ca,
@@ -495,12 +499,7 @@ impl Agent {
if result.is_err() {
let _ = own_clock.close_generation(generation);
}
tokio::time::sleep(if result.is_ok() {
Duration::from_millis(20)
} else {
Duration::from_millis(500)
})
.await;
tokio::time::sleep(mode.interval(result.is_ok())).await;
}
let _ = own_clock.close_generation(generation);
}));
@@ -521,12 +520,7 @@ impl Agent {
if result.is_err() {
let _ = time_helper.time_close(generation).await;
}
tokio::time::sleep(if result.is_ok() {
Duration::from_millis(20)
} else {
Duration::from_millis(500)
})
.await;
tokio::time::sleep(mode.interval(result.is_ok())).await;
}
let _ = time_helper.time_close(generation).await;
}));
@@ -1554,7 +1548,9 @@ impl Agent {
);
self.clock = self.clock.for_generation(generation);
#[cfg(feature = "system-helper")]
self.start_time_refresh(generation, &identity)?;
if self.config.enable_jobs {
self.start_time_refresh(generation, &identity)?;
}
self.queue_inventory(generation)?;
self.queue_update_observation(generation)?;
self.replay(&channel, generation).await?;
@@ -1673,6 +1669,15 @@ impl Agent {
}
}
if heartbeat.elapsed() >= heartbeat_after {
#[cfg(feature = "system-helper")]
if !self.config.enable_jobs
&& self.time_refresh.is_none()
&& self.start_time_refresh(generation, &identity).is_err()
{
// An absent or unreadable profile must never take passive
// inventory offline. Retry setup at the next heartbeat.
eprintln!("PASSIVE_SIGNED_TIME_UNAVAILABLE");
}
let payload = Payload::Heartbeat(Heartbeat {
instance_id: self.instance.clone(),
uptime_seconds: self.started.elapsed().as_secs(),