Persist the exact Windows echo scope across recovery and process restarts
Rust development slice / linux (push) Failing after 6s
Rust development slice / linux (push) Failing after 6s
This commit is contained in:
@@ -166,11 +166,19 @@ mod windows {
|
||||
args.len() == 1
|
||||
&& matches!(
|
||||
args[0].as_str(),
|
||||
"prepare" | "read" | "verify-receipt" | "apply"
|
||||
"prepare"
|
||||
| "read"
|
||||
| "verify-receipt"
|
||||
| "apply"
|
||||
| "echo-read"
|
||||
| "echo-verify-receipt"
|
||||
| "echo-apply"
|
||||
),
|
||||
"use prepare, read, verify-receipt or apply"
|
||||
);
|
||||
let apply = args[0] == "apply";
|
||||
let echo = args[0].starts_with("echo-");
|
||||
let mode = args[0].strip_prefix("echo-").unwrap_or(&args[0]);
|
||||
let apply = mode == "apply";
|
||||
let key_readers = [ipc::service_sid(SERVICE_NAME)?];
|
||||
let _root = PinnedFile::open(Path::new(ROOT), true, &key_readers, &[], false)?;
|
||||
let mut binding_file = PinnedFile::open(
|
||||
@@ -196,16 +204,28 @@ mod windows {
|
||||
&[],
|
||||
false,
|
||||
)?;
|
||||
ensure!(
|
||||
config.sha256()? == PASSIVE,
|
||||
"operator must restore passive config first"
|
||||
);
|
||||
if echo {
|
||||
let expected = serde_json::json!({
|
||||
"server_name":"discovery.ease-technologies.de","connect_address":"88.99.80.202:443",
|
||||
"ca_file":Path::new(ROOT).join("server-ca.pem"),"state_directory":STATE,
|
||||
"enrollment_token_file":Path::new(STATE).join("enrollment.token"),"transport":"auto",
|
||||
"job_binding_file":Path::new(ROOT).join("binding.json"),"enable_jobs":true,
|
||||
"windows_execution_profile":"powershell_51_remote_signed","windows_echo_probe_only":true});
|
||||
let actual: serde_json::Value =
|
||||
serde_json::from_slice(&data(&mut config.file, 32768)?)?;
|
||||
ensure!(actual == expected, "expected exact Echo-only configuration");
|
||||
} else {
|
||||
ensure!(
|
||||
config.sha256()? == PASSIVE,
|
||||
"operator must restore passive config first"
|
||||
);
|
||||
}
|
||||
let boot = tokio::runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()?
|
||||
.block_on(native::boot_id())?;
|
||||
ensure!(boot == BOOT, "unexpected Windows boot");
|
||||
let review = if matches!(args[0].as_str(), "verify-receipt" | "apply") {
|
||||
let review = if matches!(mode, "verify-receipt" | "apply") {
|
||||
let _folder = PinnedFile::open(
|
||||
Path::new(RECEIPT).parent().context("bootstrap path")?,
|
||||
true,
|
||||
@@ -214,12 +234,13 @@ mod windows {
|
||||
false,
|
||||
)?;
|
||||
let mut file = PinnedFile::open(Path::new(RECEIPT), false, &[], &[], false)?;
|
||||
Some(Reviewed::verify(
|
||||
data(&mut file.file, 65536)?,
|
||||
&agent,
|
||||
&settings.binding,
|
||||
&witness,
|
||||
)?)
|
||||
let bytes = data(&mut file.file, 65536)?;
|
||||
Some(if echo {
|
||||
let scope = rmm_agent_windows::echo_probe::protected_scope()?;
|
||||
Reviewed::verify_echo(bytes, &agent, &settings.binding, &witness, &scope)?
|
||||
} else {
|
||||
Reviewed::verify(bytes, &agent, &settings.binding, &witness)?
|
||||
})
|
||||
} else {
|
||||
None
|
||||
};
|
||||
@@ -315,7 +336,10 @@ mod windows {
|
||||
);
|
||||
if let Some(review) = &review {
|
||||
review.timely(chrono::Utc::now())?;
|
||||
println!("valid human review for the verified local history");
|
||||
println!(
|
||||
"valid {} review for the verified local history",
|
||||
if echo { "simulated Echo-only" } else { "human" }
|
||||
);
|
||||
}
|
||||
println!(
|
||||
"verified contracted history; fault={}",
|
||||
|
||||
Reference in New Issue
Block a user