Wire preserved update control, health evidence and record publication
Rust development slice / linux (push) Failing after 7s

This commit is contained in:
2026-11-14 23:51:59 +01:00
parent 328e440f73
commit 8e93c9ead5
34 changed files with 7071 additions and 97 deletions
+80
View File
@@ -299,3 +299,83 @@ pub fn general_supported(binding: &Binding, job: &rmm_domain::jobs::JobPayload)
})()
.unwrap_or(false)
}
impl Helpers {
/// Evidence-only delivery to the actual new Fullhelper. The independent
/// helper reads its own applied control/retained inventory before writing.
pub fn submit_update_health(
&self,
header: &rmm_updater_handoff::Handoff,
key: [u8; 32],
receipt: &rmm_updater_handoff::SignedHealth,
) -> Result<()> {
use rmm_agent_core::update_handoff::{
NativeControlOperation, NativeControlReply, NativeControlRequest,
};
let endpoint = self
.endpoints
.iter()
.find(|e| e.profile == "full_maintenance_v1")
.context("UPDATE_FULL_HELPER_REQUIRED")?;
ensure!(
endpoint.socket == Path::new("/run/rmm-helper-maintenance/control.sock"),
"UPDATE_FIXED_FULL_SOCKET_REQUIRED"
);
let challenge = Uuid::new_v4();
let request = NativeControlRequest {
operation: "agent_update_control_v1".into(),
schema_version: 1,
challenge,
tenant_id: self.binding.tenant_id,
asset_id: self.binding.asset_id,
agent_id: self.binding.agent_id,
enrollment_generation: self.binding.enrollment_generation,
assignment_version: self.binding.assignment_version,
grant_id: header.attempt.grant_id,
owner_nonce: header.owner_nonce,
handoff_sha256: rmm_domain::jobs::hash(&header.bytes()?),
method: NativeControlOperation::Health {
receipt: receipt.clone(),
},
};
let reply: NativeControlReply = control::exchange(
&endpoint.socket,
&request,
std::time::Duration::from_secs(10),
1536 * 1024,
)?;
ensure!(
reply.schema_version == 1
&& reply.challenge == challenge
&& reply.tenant_id == request.tenant_id
&& reply.asset_id == request.asset_id
&& reply.agent_id == request.agent_id
&& reply.enrollment_generation == request.enrollment_generation
&& reply.assignment_version == request.assignment_version
&& reply.grant_id == request.grant_id
&& reply.owner_nonce == request.owner_nonce
&& reply.handoff_sha256 == request.handoff_sha256
&& !reply.ready
&& reply.claim.is_none()
&& reply.original_start_base64url.is_none()
&& reply.original_outcome_base64url.is_none(),
"UPDATE_HEALTH_REPLY_BINDING"
);
let proof = reply.proof.context("UPDATE_HEALTH_REPLY_PROOF_REQUIRED")?;
let (bound, journal) = rmm_domain::agent_update::verify_inflight_proof(&proof, key)
.map_err(anyhow::Error::msg)?;
ensure!(
bound.bytes()? == header.bytes()?
&& journal.phase() == rmm_updater_handoff::Phase::HealthVerified,
"UPDATE_HEALTH_REPLY_ORIGINAL_PHASE"
);
let decoded = proof.decode().map_err(anyhow::Error::msg)?;
let event: rmm_updater_handoff::Event =
serde_json::from_slice(decoded.events.last().context("UPDATE_HEALTH_REPLY_EVENT")?)?;
ensure!(
matches!(event.evidence,rmm_updater_handoff::Evidence::HealthVerified{receipt:ref saved} if saved==receipt),
"UPDATE_HEALTH_REPLY_RECEIPT_CHANGED"
);
Ok(())
}
}