Bind Windows script contexts to the installed signed helper
This commit is contained in:
@@ -289,6 +289,25 @@ impl Device {
|
||||
}
|
||||
}
|
||||
|
||||
/// Report the signed release layout of the already authenticated live SCM/IPC pair.
|
||||
/// The server independently verifies the pair's catalog release and helper digest.
|
||||
pub(crate) fn managed_script_release(pin: &crate::helper_ipc::Pin) -> Result<Uuid> {
|
||||
let dir = pin.helper.binary.parent().context("missing installed helper directory")?;
|
||||
let release = dir.file_name().and_then(|n| n.to_str()).context("missing release directory")?;
|
||||
let id = Uuid::parse_str(release)?;
|
||||
ensure!(release == id.to_string() && dir == generation(id)
|
||||
&& pin.agent.binary == dir.join(AGENT) && pin.helper.binary == dir.join(HELPER),
|
||||
"managed scripts require a pinned release pair");
|
||||
let path = dir.join("manifest.json");
|
||||
let raw = protected(&path, rmm_updater::MAX_MANIFEST_BYTES)?;
|
||||
let manifest: ReleaseManifest = serde_json::from_slice(&raw)?;
|
||||
ensure!(manifest.platform == VERIFY && manifest.release_id == id
|
||||
&& manifest.artifacts[0].sha256 == pin.agent.binary_sha256
|
||||
&& manifest.artifacts[1].sha256 == pin.helper.binary_sha256,
|
||||
"managed helper differs from installed release manifest");
|
||||
Ok(id)
|
||||
}
|
||||
|
||||
fn local_manifest(installed: &Installed) -> Result<ReleaseManifest> {
|
||||
let root = generation(installed.release_id);
|
||||
let raw = protected(&root.join("manifest.json"), rmm_updater::MAX_MANIFEST_BYTES)?;
|
||||
|
||||
Reference in New Issue
Block a user