Implement guarded Linux updater runtime and compatible baseline tooling
Rust development slice / linux (push) Failing after 8s

This commit is contained in:
2026-11-16 15:25:46 +01:00
parent 6497c79a91
commit 96a2b6e5ae
44 changed files with 6986 additions and 1024 deletions
+75
View File
@@ -36,6 +36,81 @@ pub struct FullFiles {
rendered: LinuxFullTransition,
}
impl FullFiles {
/// Pure read/render of the fixed protected Full transition. No staging,
/// download, grant, ledger intent, service control or filesystem mutation.
pub fn preview(
new_helper_sha256: &str,
job_key_path: &Path,
job_key_raw_sha256: &str,
budget: &Budget,
) -> Result<rmm_domain::agent_update::LinuxFullTransition> {
budget.check()?;
let key_directory = Directory::open(
job_key_path.parent().context("UPDATE_FULL_KEY_PARENT")?,
0,
false,
)?;
let mut key_file = key_directory.inspect(
job_key_path.file_name().context("UPDATE_FULL_KEY_NAME")?,
0,
4096,
)?;
ensure!(
key_file.proof().sha256 == job_key_raw_sha256,
"UPDATE_FULL_KEY_RAW_HASH"
);
let key_record: SigningKeyRecord = serde_json::from_slice(&key_file.bytes(4096)?)?;
let raw = hex::decode(&key_record.public_key_hex)?;
ensure!(
key_record.schema_version == 1
&& key_record.algorithm == "Ed25519"
&& key_record.key_id == hash(&raw),
"UPDATE_FULL_KEY_IDENTITY"
);
let key = VerifyingKey::from_bytes(
&raw.try_into()
.map_err(|_| anyhow::anyhow!("UPDATE_FULL_KEY_SIZE"))?,
)?;
ensure!(!key.is_weak(), "UPDATE_FULL_WEAK_KEY");
let directory = Directory::open(Path::new("/etc/rmm-remote"), 0, false)?;
let mut config = directory.inspect(OsStr::new("helper-full-maintenance.json"), 0, 16384)?;
let mut pin =
directory.inspect(OsStr::new("full-maintenance-helper-proof.json"), 0, 8192)?;
let config_bytes = config.bytes(16384)?;
let value: serde_json::Value = serde_json::from_slice(&config_bytes)?;
if let Some(path) = value.get("signing_key_file").and_then(|v| v.as_str()) {
ensure!(
Path::new(path) == job_key_path,
"UPDATE_FULL_KEY_PATH_CHANGED"
);
} else {
ensure!(
value["binding"]["public_key_hex"].as_str() == Some(&hex::encode(key.as_bytes())),
"UPDATE_FULL_INLINE_KEY_CHANGED"
);
}
let rendered =
render_linux_full(&config_bytes, &pin.bytes(8192)?, new_helper_sha256, &key)?;
directory.file(
OsStr::new("helper-full-maintenance.json"),
config.proof(),
16384,
)?;
directory.file(
OsStr::new("full-maintenance-helper-proof.json"),
pin.proof(),
8192,
)?;
key_directory.file(
job_key_path.file_name().context("UPDATE_FULL_KEY_NAME")?,
key_file.proof(),
4096,
)?;
budget.check()?;
Ok(serde_json::from_slice(&serde_json::to_vec(
rendered.proof(),
)?)?)
}
/// `job_key_path` and `job_key_raw_sha256` come from independently protected
/// LOCAL policy, not an update job, IPC request or manifest. The exact key
/// identity is additionally bound to the approved Full transition proof.