Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b5c7292f45 | ||
|
|
1c1685bb40 | ||
|
|
0c970dc6c0 | ||
|
|
8bee0ad5e6 |
@@ -785,38 +785,8 @@ pub(crate) fn msi_test_job() -> JobPayload {
|
||||
}
|
||||
}
|
||||
fn write_current_probe(state: &Path, value: &serde_json::Value) -> Result<()> {
|
||||
write_report(state, PROBE_FILE, ".helper-probe.pending", value)
|
||||
}
|
||||
|
||||
/// A historical observation by the agent. The helper lane calls this only after
|
||||
/// the authenticated peer has acknowledged its own signature verification.
|
||||
pub fn record_verified_time(
|
||||
state: &Path,
|
||||
request: &rmm_time_attestation::Request,
|
||||
response_sha256: &str,
|
||||
observed_at: chrono::DateTime<chrono::Utc>,
|
||||
) -> Result<()> {
|
||||
use sha2::{Digest, Sha256};
|
||||
let (filename, pending) = match request.context.role {
|
||||
rmm_time_attestation::Role::Agent => ("agent-time-sample.json", ".agent-time.pending"),
|
||||
rmm_time_attestation::Role::SystemHelper => {
|
||||
("helper-time-sample.json", ".helper-time.pending")
|
||||
}
|
||||
};
|
||||
let value = json!({
|
||||
"schema_version": 1, "agent_pid": std::process::id(), "observed_at": observed_at,
|
||||
"role": request.context.role, "windows_boot_id": request.context.windows_boot_id,
|
||||
"connection_generation": request.context.connection_generation,
|
||||
"verifier_incarnation": request.context.verifier_incarnation,
|
||||
"request_sha256": format!("{:x}", Sha256::digest(serde_json::to_vec(request)?)),
|
||||
"response_sha256": response_sha256
|
||||
});
|
||||
write_report(state, filename, pending, &value)
|
||||
}
|
||||
|
||||
fn write_report(state: &Path, name: &str, pending: &str, value: &serde_json::Value) -> Result<()> {
|
||||
native::private_path(state, true)?;
|
||||
let path = state.join(name);
|
||||
let path = state.join(PROBE_FILE);
|
||||
if path.try_exists()? {
|
||||
native::private_path(&path, false)?;
|
||||
}
|
||||
@@ -824,7 +794,7 @@ fn write_report(state: &Path, name: &str, pending: &str, value: &serde_json::Val
|
||||
ensure!(bytes.len() <= 8192, "HELPER_PROBE_REPORT_LIMIT");
|
||||
// One fixed create-only staging file bounds even interrupted-report state.
|
||||
// A leftover from a killed process is refused; it is never overwritten.
|
||||
let temporary = state.join(pending);
|
||||
let temporary = state.join(".helper-probe.pending");
|
||||
let mut file = std::fs::OpenOptions::new()
|
||||
.write(true)
|
||||
.create_new(true)
|
||||
|
||||
@@ -177,7 +177,6 @@ struct TimeRefresh {
|
||||
clock: rmm_agent_windows::signed_clock::RuntimeClock,
|
||||
helper: Option<rmm_agent_windows::helper_runtime::Client>,
|
||||
tasks: Vec<tokio::task::JoinHandle<()>>,
|
||||
samples: Vec<Arc<std::sync::OnceLock<VerifiedTimeSample>>>,
|
||||
}
|
||||
#[cfg(feature = "system-helper")]
|
||||
impl Drop for TimeRefresh {
|
||||
@@ -190,30 +189,6 @@ impl Drop for TimeRefresh {
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "system-helper")]
|
||||
struct VerifiedTimeSample {
|
||||
request: rmm_time_attestation::Request,
|
||||
response_hash: String,
|
||||
observed_at: chrono::DateTime<Utc>,
|
||||
}
|
||||
#[cfg(feature = "system-helper")]
|
||||
impl VerifiedTimeSample {
|
||||
fn new(request: rmm_time_attestation::Request, response_hash: String) -> Self {
|
||||
Self {
|
||||
request,
|
||||
response_hash,
|
||||
observed_at: Utc::now(),
|
||||
}
|
||||
}
|
||||
fn persist(&self, state: &Path) -> Result<()> {
|
||||
rmm_agent_windows::helper_runtime::record_verified_time(
|
||||
state,
|
||||
&self.request,
|
||||
&self.response_hash,
|
||||
self.observed_at,
|
||||
)
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "system-helper")]
|
||||
async fn time_response(
|
||||
client: &reqwest::Client,
|
||||
address: std::net::SocketAddr,
|
||||
@@ -483,13 +458,9 @@ impl Agent {
|
||||
identity: &crate::certificate_rotation::DeviceIdentity,
|
||||
) -> Result<()> {
|
||||
ensure!(self.time_refresh.is_none(), "TIME_REFRESH_ALREADY_RUNNING");
|
||||
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 {
|
||||
if !self.config.enable_jobs {
|
||||
return Ok(());
|
||||
};
|
||||
}
|
||||
let client = crate::https_channel::mtls_client(
|
||||
self.config.connect_address,
|
||||
&self.ca,
|
||||
@@ -509,17 +480,6 @@ impl Agent {
|
||||
let own_stop = stop.clone();
|
||||
let own_http = client.clone();
|
||||
let address = self.config.connect_address;
|
||||
// Only the connection owner publishes observations. Dropping it also
|
||||
// discards unfinished samples, so an old worker cannot overwrite a newer report.
|
||||
let sample_slot =
|
||||
|| (mode == SamplingMode::Passive).then(|| Arc::new(std::sync::OnceLock::new()));
|
||||
let own_receipt = sample_slot();
|
||||
let helper_receipt = helper.as_ref().and_then(|_| sample_slot());
|
||||
let samples = own_receipt
|
||||
.iter()
|
||||
.chain(helper_receipt.iter())
|
||||
.cloned()
|
||||
.collect();
|
||||
tasks.push(tokio::spawn(async move {
|
||||
while !own_stop.load(Ordering::SeqCst) {
|
||||
let result = async {
|
||||
@@ -529,18 +489,18 @@ impl Agent {
|
||||
let request = own_clock.begin(generation)?;
|
||||
let bytes = time_response(&own_http, address, &request).await?;
|
||||
ensure!(!own_stop.load(Ordering::SeqCst), "TIME_CONNECTION_CLOSED");
|
||||
own_clock.complete(generation, &bytes)?;
|
||||
if let Some(slot) = own_receipt.as_ref().filter(|s| s.get().is_none()) {
|
||||
let hash = format!("{:x}", Sha256::digest(&bytes));
|
||||
let _ = slot.set(VerifiedTimeSample::new(request, hash));
|
||||
}
|
||||
Ok::<(), anyhow::Error>(())
|
||||
own_clock.complete(generation, &bytes)
|
||||
}
|
||||
.await;
|
||||
if result.is_err() {
|
||||
let _ = own_clock.close_generation(generation);
|
||||
}
|
||||
tokio::time::sleep(mode.interval(result.is_ok())).await;
|
||||
tokio::time::sleep(if result.is_ok() {
|
||||
Duration::from_millis(20)
|
||||
} else {
|
||||
Duration::from_millis(500)
|
||||
})
|
||||
.await;
|
||||
}
|
||||
let _ = own_clock.close_generation(generation);
|
||||
}));
|
||||
@@ -555,20 +515,18 @@ impl Agent {
|
||||
!helper_stop.load(Ordering::SeqCst),
|
||||
"TIME_CONNECTION_CLOSED"
|
||||
);
|
||||
let pending = helper_receipt.as_ref().filter(|s| s.get().is_none());
|
||||
let report =
|
||||
pending.map(|slot| (slot, format!("{:x}", Sha256::digest(&bytes))));
|
||||
time_helper.time_complete(generation, bytes).await?;
|
||||
if let Some((slot, hash)) = report {
|
||||
let _ = slot.set(VerifiedTimeSample::new(request, hash));
|
||||
}
|
||||
Ok::<(), anyhow::Error>(())
|
||||
time_helper.time_complete(generation, bytes).await
|
||||
}
|
||||
.await;
|
||||
if result.is_err() {
|
||||
let _ = time_helper.time_close(generation).await;
|
||||
}
|
||||
tokio::time::sleep(mode.interval(result.is_ok())).await;
|
||||
tokio::time::sleep(if result.is_ok() {
|
||||
Duration::from_millis(20)
|
||||
} else {
|
||||
Duration::from_millis(500)
|
||||
})
|
||||
.await;
|
||||
}
|
||||
let _ = time_helper.time_close(generation).await;
|
||||
}));
|
||||
@@ -579,7 +537,6 @@ impl Agent {
|
||||
clock,
|
||||
helper,
|
||||
tasks,
|
||||
samples,
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
@@ -1597,9 +1554,7 @@ impl Agent {
|
||||
);
|
||||
self.clock = self.clock.for_generation(generation);
|
||||
#[cfg(feature = "system-helper")]
|
||||
if self.config.enable_jobs {
|
||||
self.start_time_refresh(generation, &identity)?;
|
||||
}
|
||||
self.start_time_refresh(generation, &identity)?;
|
||||
self.queue_inventory(generation)?;
|
||||
self.queue_update_observation(generation)?;
|
||||
self.replay(&channel, generation).await?;
|
||||
@@ -1718,15 +1673,6 @@ 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(),
|
||||
@@ -1743,14 +1689,6 @@ impl Agent {
|
||||
)?;
|
||||
channel.poll(poll).await?;
|
||||
}
|
||||
#[cfg(feature = "system-helper")]
|
||||
if let Some(refresh) = &mut self.time_refresh {
|
||||
let state = &self.config.state_directory;
|
||||
refresh.samples.retain(|slot| {
|
||||
slot.get()
|
||||
.is_none_or(|sample| sample.persist(state).is_err())
|
||||
});
|
||||
}
|
||||
heartbeat = Instant::now();
|
||||
heartbeat_after = Duration::from_millis(rand::random_range(27000..33000));
|
||||
}
|
||||
|
||||
@@ -10,29 +10,6 @@ use uuid::Uuid;
|
||||
const SECOND_NS: u64 = 1_000_000_000;
|
||||
const MAX_BASE_ERROR_NS: u64 = 10_000_000;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum SamplingMode {
|
||||
Passive,
|
||||
Jobs,
|
||||
}
|
||||
impl SamplingMode {
|
||||
pub fn configured(jobs: bool, profile: &std::path::Path) -> std::io::Result<Option<Self>> {
|
||||
if jobs {
|
||||
return Ok(Some(Self::Jobs));
|
||||
}
|
||||
Ok(profile.try_exists()?.then_some(Self::Passive))
|
||||
}
|
||||
|
||||
pub fn interval(self, verified: bool) -> std::time::Duration {
|
||||
use std::time::Duration;
|
||||
match (self, verified) {
|
||||
(Self::Passive, _) => Duration::from_secs(30),
|
||||
(Self::Jobs, true) => Duration::from_millis(20),
|
||||
(Self::Jobs, false) => Duration::from_millis(500),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn independent_time_key(time_key_hex: &str, job_key_hex: &str) -> Result<[u8; 32]> {
|
||||
fn decode(value: &str) -> Result<[u8; 32]> {
|
||||
ensure!(
|
||||
@@ -1160,30 +1137,6 @@ pub use installed::{BoundClock, CONFIG_PATH, Comparison, RuntimeClock, SignedClo
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn passive_sampling_requires_a_profile_and_uses_heartbeat_cadence() {
|
||||
let dir = std::env::temp_dir().join(Uuid::new_v4().to_string());
|
||||
std::fs::create_dir(&dir).unwrap();
|
||||
let profile = dir.join("time-attestation.json");
|
||||
assert_eq!(SamplingMode::configured(false, &profile).unwrap(), None);
|
||||
assert_eq!(
|
||||
SamplingMode::configured(true, &profile).unwrap(),
|
||||
Some(SamplingMode::Jobs)
|
||||
);
|
||||
std::fs::write(&profile, b"{}").unwrap();
|
||||
assert_eq!(
|
||||
SamplingMode::configured(false, &profile).unwrap(),
|
||||
Some(SamplingMode::Passive)
|
||||
);
|
||||
for verified in [false, true] {
|
||||
assert_eq!(
|
||||
SamplingMode::Passive.interval(verified),
|
||||
std::time::Duration::from_secs(30)
|
||||
);
|
||||
}
|
||||
std::fs::remove_dir_all(dir).unwrap();
|
||||
}
|
||||
fn sample(ns: u64) -> Sample {
|
||||
Sample {
|
||||
wall_utc_ns: 1_800_000_000_000_000_000 + ns as i64,
|
||||
|
||||
@@ -1,251 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Read two public service observations; never request time or alter the guest."""
|
||||
import argparse
|
||||
import base64
|
||||
import datetime as dt
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
import uuid
|
||||
|
||||
import system_pipe_upgrade as access_bridge
|
||||
import time_route_context as context_reader
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
ACCESS_ROOT = ROOT.parent / 'rust-discovery'
|
||||
STATE = ROOT / 'devstate/windows-passive-time-closeout'
|
||||
FIELDS = {'schema_version', 'agent_pid', 'observed_at', 'role', 'windows_boot_id',
|
||||
'connection_generation', 'verifier_incarnation', 'request_sha256', 'response_sha256'}
|
||||
FILES = {'agent': 'agent-time-sample.json', 'system_helper': 'helper-time-sample.json'}
|
||||
HEX = re.compile(r'[0-9a-f]{64}')
|
||||
SECOND_NS = 1_000_000_000
|
||||
|
||||
# No report is requested from a service. The only content reads on the guest
|
||||
# are these two public JSONs and public executable hashes. CIM/process queries
|
||||
# obtain current boot/SCM/image/birth metadata without starting another binary.
|
||||
SCRIPT = r'''$ErrorActionPreference='Stop';$p=([Console]::In.ReadLine()|ConvertFrom-Json)
|
||||
if((($p.PSObject.Properties.Name|Sort-Object)-join',')-cne'agent_sha256,helper_sha256,id'-or[guid]::ParseExact($p.id,'D').ToString()-cne$p.id-or$p.agent_sha256-cnotmatch'^[0-9a-f]{64}$'-or$p.helper_sha256-cnotmatch'^[0-9a-f]{64}$'){throw 'Fixed public sample read'}
|
||||
$state='C:\ProgramData\RustDiscovery\state';$agent='RmmDiscoveryWindows';$helper='RmmDiscoverySystemHelper'
|
||||
$agentSid=(New-Object Security.Principal.NTAccount('NT SERVICE',$agent)).Translate([Security.Principal.SecurityIdentifier]).Value
|
||||
$allowed=@('S-1-5-18','S-1-5-32-544',$agentSid)
|
||||
function Check($path,[bool]$directory){
|
||||
$i=Get-Item -LiteralPath $path -Force
|
||||
if($i.PSIsContainer-ne$directory-or($i.Attributes-band[IO.FileAttributes]::ReparsePoint)){throw 'Regular public report path'}
|
||||
$ancestor=$i.Directory;if($directory){$ancestor=$i.Parent};while($null-ne$ancestor){if($ancestor.Attributes-band[IO.FileAttributes]::ReparsePoint){throw 'Public report reparse ancestry'};$ancestor=$ancestor.Parent}
|
||||
$acl=Get-Acl -LiteralPath $path;$owner=$acl.GetOwner([Security.Principal.SecurityIdentifier]).Value
|
||||
if($owner-cnotin$allowed-and!(!$directory-and$owner-ceq'S-1-5-19')){throw 'Public report owner'}
|
||||
$rules=@($acl.GetAccessRules($true,$true,[Security.Principal.SecurityIdentifier]));if(!$rules.Count){throw 'Public report empty DACL'}
|
||||
foreach($r in $rules){if($r.AccessControlType-ne'Allow'-or$r.IdentityReference.Value-cnotin$allowed){throw 'Public report broad DACL'}}
|
||||
if($directory-and!$acl.AreAccessRulesProtected){throw 'Protected public report directory'}
|
||||
return @{owner_sid=$owner;sddl=$acl.Sddl;dacl_checked=$true}
|
||||
}
|
||||
Add-Type -TypeDefinition @'
|
||||
using System; using System.Text; using System.Runtime.InteropServices; using Microsoft.Win32.SafeHandles;
|
||||
public static class RmmPassiveTimeRead {
|
||||
[StructLayout(LayoutKind.Sequential)] public struct Info {public uint Attr,CL,CH,AL,AH,WL,WH,Volume,SizeH,SizeL,Links,IndexH,IndexL;}
|
||||
[DllImport("kernel32.dll",SetLastError=true)] public static extern bool GetFileInformationByHandle(SafeFileHandle h,out Info i);
|
||||
[DllImport("kernel32.dll",SetLastError=true)] static extern IntPtr OpenProcess(uint access,bool inherit,int pid);
|
||||
[DllImport("kernel32.dll",SetLastError=true,CharSet=CharSet.Unicode)] static extern bool QueryFullProcessImageName(IntPtr h,uint flags,StringBuilder text,ref uint size);
|
||||
[DllImport("kernel32.dll",SetLastError=true)] static extern bool GetProcessTimes(IntPtr h,out long creation,out long exit,out long kernel,out long user);
|
||||
[DllImport("kernel32.dll",SetLastError=true)] static extern bool GetExitCodeProcess(IntPtr h,out uint code);
|
||||
[DllImport("kernel32.dll")] static extern bool CloseHandle(IntPtr h);
|
||||
public static string[] Process(int pid){IntPtr h=OpenProcess(0x1000,false,pid);if(h==IntPtr.Zero)throw new InvalidOperationException("QUERY_PROCESS");try{long c,e,k,u;uint code,size=32768;StringBuilder image=new StringBuilder((int)size);if(!GetProcessTimes(h,out c,out e,out k,out u)||!QueryFullProcessImageName(h,0,image,ref size)||!GetExitCodeProcess(h,out code)||code!=259)throw new InvalidOperationException("LIVE_PROCESS");return new string[]{c.ToString(System.Globalization.CultureInfo.InvariantCulture),image.ToString()};}finally{CloseHandle(h);}}
|
||||
}
|
||||
'@
|
||||
function Hash([byte[]]$bytes){$h=[Security.Cryptography.SHA256]::Create();try{return([BitConverter]::ToString($h.ComputeHash($bytes))).Replace('-','').ToLowerInvariant()}finally{$h.Dispose()}}
|
||||
function Runtime($role){
|
||||
$name=$agent;$image='C:\Program Files\RustDiscovery\rmm-agent-windows.exe';$owner='NT AUTHORITY\LocalService';$mode='Auto';$sha=$p.agent_sha256
|
||||
if($role-ceq'helper'){$name=$helper;$image='C:\Program Files\RustDiscovery\rmm-helper-windows.exe';$owner='LocalSystem';$mode='Manual';$sha=$p.helper_sha256}
|
||||
$s=Get-CimInstance Win32_Service -Filter ("Name='"+$name+"'") -OperationTimeoutSec 5
|
||||
if(!$s-or$s.State-cne'Running'-or$s.StartName-cne$owner-or$s.StartMode-cne$mode-or$s.ProcessId-le0-or$s.ServiceType-cne'Own Process'){throw 'Current fixed service role'}
|
||||
$expected='"'+$image+'" --service';if($role-ceq'agent'){$expected+=' --config "C:\ProgramData\RustDiscovery\config.json"'}
|
||||
if($s.PathName-cne$expected){throw 'Current fixed service command'}
|
||||
$native=[RmmPassiveTimeRead]::Process([int]$s.ProcessId)
|
||||
if($native[1]-cne$image-or(Get-FileHash -LiteralPath $image -Algorithm SHA256).Hash.ToLowerInvariant()-cne$sha){throw 'Current fixed service image'}
|
||||
return [ordered]@{pid=[uint32]$s.ProcessId;birth_filetime=$native[0];image=$native[1];sha256=$sha;start_name=$s.StartName;start_mode=$s.StartMode;command=$s.PathName}
|
||||
}
|
||||
function Boot{return (Get-CimInstance Win32_OperatingSystem -Property LastBootUpTime -OperationTimeoutSec 5).LastBootUpTime.ToUniversalTime().Ticks.ToString([Globalization.CultureInfo]::InvariantCulture)}
|
||||
$null=Check 'C:\ProgramData\RustDiscovery' $true;$directory=Check $state $true
|
||||
$boot=Boot;$before=[ordered]@{agent=(Runtime 'agent');helper=(Runtime 'helper')};$reports=[ordered]@{}
|
||||
foreach($name in @('agent-time-sample.json','helper-time-sample.json')){
|
||||
$path=Join-Path $state $name
|
||||
if(!(Test-Path -LiteralPath $path)){$reports[$name]=$null;continue}
|
||||
$stream=[IO.File]::Open($path,[IO.FileMode]::Open,[IO.FileAccess]::Read,[IO.FileShare]::Read)
|
||||
try{
|
||||
$meta=Check $path $false;$info=New-Object RmmPassiveTimeRead+Info
|
||||
if(![RmmPassiveTimeRead]::GetFileInformationByHandle($stream.SafeFileHandle,[ref]$info)-or$info.Links-ne1-or($info.Attr-band0x410)-ne0-or$info.SizeH-ne0-or$info.SizeL-lt1-or$info.SizeL-gt8192-or$stream.Length-ne$info.SizeL){throw 'Single-link bounded public report'}
|
||||
$raw=New-Object byte[] $info.SizeL;$offset=0;while($offset-lt$raw.Length){$count=$stream.Read($raw,$offset,$raw.Length-$offset);if($count-le0){throw 'Complete held public report'};$offset+=$count}
|
||||
$after=New-Object RmmPassiveTimeRead+Info
|
||||
if(![RmmPassiveTimeRead]::GetFileInformationByHandle($stream.SafeFileHandle,[ref]$after)-or$after.IndexH-ne$info.IndexH-or$after.IndexL-ne$info.IndexL-or$after.WH-ne$info.WH-or$after.WL-ne$info.WL-or$after.SizeL-ne$info.SizeL-or$after.Links-ne1){throw 'Stable held public report'}
|
||||
$again=Check $path $false;if($again.sddl-cne$meta.sddl-or$again.owner_sid-cne$meta.owner_sid){throw 'Stable public report security'}
|
||||
$meta['volume']=$info.Volume;$meta['index_high']=$info.IndexH;$meta['index_low']=$info.IndexL;$meta['last_write_filetime']=(([uint64]$info.WH-shl32)-bor$info.WL).ToString([Globalization.CultureInfo]::InvariantCulture)
|
||||
$reports[$name]=@{raw_base64=[Convert]::ToBase64String($raw);sha256=(Hash $raw);metadata=$meta}
|
||||
}finally{$stream.Dispose()}
|
||||
}
|
||||
$after=[ordered]@{agent=(Runtime 'agent');helper=(Runtime 'helper')}
|
||||
$directoryAfter=Check $state $true
|
||||
if(($before|ConvertTo-Json -Depth 8 -Compress)-cne($after|ConvertTo-Json -Depth 8 -Compress)-or(Boot)-cne$boot-or$directory.sddl-cne$directoryAfter.sddl){throw 'Stable process, directory and boot during public read'}
|
||||
@{id=$p.id;read_only=$true;boot_ticks=$boot;runtime=$after;state_metadata=$directory;reports=$reports;observed_at=[DateTime]::UtcNow.ToString('o')}|ConvertTo-Json -Depth 12 -Compress
|
||||
'''
|
||||
|
||||
|
||||
def need(value, tag):
|
||||
if not value:
|
||||
raise ValueError(tag)
|
||||
|
||||
|
||||
def strict(pairs):
|
||||
value = {}
|
||||
for key, item in pairs:
|
||||
need(key not in value, 'DUPLICATE_PUBLIC_FIELD')
|
||||
value[key] = item
|
||||
return value
|
||||
|
||||
|
||||
def stamp(value):
|
||||
need(type(value) is str, 'UTC_TIMESTAMP_REQUIRED')
|
||||
match = re.fullmatch(r'(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(?:\.(\d{1,9}))?Z', value)
|
||||
need(match is not None, 'UTC_TIMESTAMP_REQUIRED')
|
||||
base = dt.datetime.strptime(match[1], '%Y-%m-%dT%H:%M:%S').replace(tzinfo=dt.timezone.utc)
|
||||
elapsed = base - dt.datetime(1970, 1, 1, tzinfo=dt.timezone.utc)
|
||||
return (elapsed.days * 86400 + elapsed.seconds) * SECOND_NS + int((match[2] or '').ljust(9, '0'))
|
||||
|
||||
|
||||
def utc_ns(value):
|
||||
return stamp(value.astimezone(dt.timezone.utc).isoformat().replace('+00:00', 'Z'))
|
||||
|
||||
|
||||
def canonical_uuid(value):
|
||||
need(type(value) is str and str(uuid.UUID(value)) == value and uuid.UUID(value).int > 0, 'UUID_REQUIRED')
|
||||
return value
|
||||
|
||||
|
||||
def sha(path):
|
||||
return hashlib.sha256(Path(path).read_bytes()).hexdigest()
|
||||
|
||||
|
||||
def save(folder, name, value):
|
||||
fd = os.open(folder / name, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o600)
|
||||
with os.fdopen(fd, 'w') as stream:
|
||||
json.dump(value, stream, indent=2)
|
||||
stream.flush()
|
||||
os.fsync(stream.fileno())
|
||||
|
||||
|
||||
def windows_boot(ticks):
|
||||
need(type(ticks) is str and ticks.isascii() and ticks.isdigit() and 17 <= len(ticks) <= 19, 'BOOT_TICKS')
|
||||
raw = bytearray(hashlib.sha256(('rmm.windows.boot.cim.ticks.v1:' + ticks).encode()).digest()[:16])
|
||||
raw[6] = (raw[6] & 15) | 0x80
|
||||
raw[8] = (raw[8] & 63) | 0x80
|
||||
return str(uuid.UUID(bytes=bytes(raw)))
|
||||
|
||||
|
||||
def filetime(value):
|
||||
need(type(value) is str and value.isascii() and value.isdigit(), 'FILETIME_REQUIRED')
|
||||
return (int(value) - 116444736000000000) * 100
|
||||
|
||||
|
||||
def validate(native, server, since, observed_now):
|
||||
need(native['read_only'] is True and server['sql_read_only'] is True and server['secrets_read'] is False, 'READ_ONLY_WITNESSES')
|
||||
current = server['installation']
|
||||
caps = current['capabilities']
|
||||
need(type(caps) is list and len(caps) == 3 and set(caps) == {'windows.base/1', 'heartbeat/1', 'agent.update/1'}, 'PASSIVE_SERVER_CAPABILITIES')
|
||||
boot = windows_boot(native['boot_ticks'])
|
||||
need(current['windows_boot_id'] == boot, 'CURRENT_SERVER_WINDOWS_BOOT')
|
||||
generation = current['connection_generation']
|
||||
need(type(generation) is int and generation > 0, 'CURRENT_POSITIVE_GENERATION')
|
||||
now = stamp(native['observed_at'])
|
||||
need(abs(now - utc_ns(observed_now)) <= 10 * SECOND_NS, 'CURRENT_WINDOWS_UTC')
|
||||
records = []
|
||||
for role, filename in FILES.items():
|
||||
wrapped = native['reports'][filename]
|
||||
need(wrapped is not None, 'PUBLIC_SERVICE_SAMPLE_MISSING')
|
||||
raw = base64.b64decode(wrapped['raw_base64'], validate=True)
|
||||
need(len(raw) <= 8192 and hashlib.sha256(raw).hexdigest() == wrapped['sha256'], 'PUBLIC_SAMPLE_RAW_HASH')
|
||||
record = json.loads(raw, object_pairs_hook=strict)
|
||||
need(set(record) == FIELDS and type(record['schema_version']) is int and record['schema_version'] == 1, 'PUBLIC_SAMPLE_SCHEMA')
|
||||
need(record['role'] == role and type(record['agent_pid']) is int and record['agent_pid'] == native['runtime']['agent']['pid'], 'SAMPLE_PROCESS_ROLE')
|
||||
need(record['windows_boot_id'] == boot and type(record['connection_generation']) is int and record['connection_generation'] == generation, 'SAMPLE_BOOT_GENERATION')
|
||||
canonical_uuid(record['verifier_incarnation'])
|
||||
for field in ('request_sha256', 'response_sha256'):
|
||||
need(type(record[field]) is str and HEX.fullmatch(record[field]) is not None, 'SAMPLE_HASH_FORMAT')
|
||||
observed = stamp(record['observed_at'])
|
||||
modified = filetime(wrapped['metadata']['last_write_filetime'])
|
||||
birth = filetime(native['runtime']['agent']['birth_filetime'])
|
||||
need(since <= observed <= now + 2 * SECOND_NS and birth <= observed, 'SAMPLE_CURRENT_INSTALL_WINDOW')
|
||||
need(0 <= now - modified <= 180 * SECOND_NS and 0 <= now - observed <= 180 * SECOND_NS, 'SAMPLE_FILE_AGE')
|
||||
need(-2 * SECOND_NS <= modified - observed <= 90 * SECOND_NS, 'SAMPLE_PUBLICATION_DELAY')
|
||||
need(wrapped['metadata']['dacl_checked'] is True, 'SAMPLE_PROTECTED_METADATA')
|
||||
records.append(record)
|
||||
for field in ('verifier_incarnation', 'request_sha256', 'response_sha256'):
|
||||
need(records[0][field] != records[1][field], 'INDEPENDENT_ROLE_' + field.upper())
|
||||
return records
|
||||
|
||||
|
||||
def collect(args):
|
||||
need(HEX.fullmatch(args.agent_sha256) and HEX.fullmatch(args.helper_sha256), 'QUALIFIED_RUNTIME_HASHES_REQUIRED')
|
||||
since = stamp(args.profile_after)
|
||||
need(0 <= utc_ns(dt.datetime.now(dt.timezone.utc)) - since <= 600 * SECOND_NS, 'RECENT_PROFILE_INSTALL_WINDOW')
|
||||
STATE.mkdir(parents=True, mode=0o700, exist_ok=True)
|
||||
ident = str(uuid.uuid4())
|
||||
folder = STATE / ident
|
||||
folder.mkdir(mode=0o700)
|
||||
save(folder, 'intent.json', dict(id=ident, operator_sha256=sha(__file__), source_commit='cc821246ccd98ee6d3dc5c1b12c7303d3010e8a7',
|
||||
read_only=True, agent_sha256=args.agent_sha256, helper_sha256=args.helper_sha256, profile_after=args.profile_after,
|
||||
wait_seconds=180, in_progress_read_budget_seconds=105, sample_max_age_seconds=180, no_requests_to_services=True))
|
||||
access_bridge.STATE.mkdir(parents=True, mode=0o700, exist_ok=True)
|
||||
access = access_bridge.Access(ACCESS_ROOT)
|
||||
deadline = time.monotonic() + 180
|
||||
attempt = 0
|
||||
last = 'PUBLIC_SERVICE_SAMPLE_MISSING'
|
||||
while time.monotonic() < deadline:
|
||||
attempt += 1
|
||||
before = context_reader.rpc(access, dict(id=ident, deployment_result_sha256=context_reader.DEPLOYMENT_RESULT_SHA, image=context_reader.IMAGE), folder)
|
||||
native = access.powershell(SCRIPT, dict(id=ident, agent_sha256=args.agent_sha256, helper_sha256=args.helper_sha256), timeout=45)
|
||||
save(folder, f'{attempt:02d}-native.json', native) # persist before assertions
|
||||
after = context_reader.rpc(access, dict(id=ident, deployment_result_sha256=context_reader.DEPLOYMENT_RESULT_SHA, image=context_reader.IMAGE), folder)
|
||||
save(folder, f'{attempt:02d}-server.json', dict(before=before, after=after))
|
||||
try:
|
||||
need(before == after, 'SERVER_CONTEXT_CHANGED_DURING_READ')
|
||||
records = validate(native, after, since, dt.datetime.now(dt.timezone.utc))
|
||||
except ValueError as error:
|
||||
last = str(error)
|
||||
save(folder, f'{attempt:02d}-not-accepted.json', dict(reason=last, read_only=True))
|
||||
if last not in ('PUBLIC_SERVICE_SAMPLE_MISSING', 'SAMPLE_BOOT_GENERATION', 'SAMPLE_PROCESS_ROLE', 'SAMPLE_CURRENT_INSTALL_WINDOW', 'SAMPLE_FILE_AGE', 'SERVER_CONTEXT_CHANGED_DURING_READ'):
|
||||
raise
|
||||
time.sleep(min(5, max(0, deadline-time.monotonic())))
|
||||
continue
|
||||
links = {name: sha(folder/name) for name in ('intent.json', f'{attempt:02d}-native.json', f'{attempt:02d}-server.json')}
|
||||
save(folder, 'receipt.json', dict(id=ident, operator_sha256=sha(__file__), verified=True, read_only=True,
|
||||
historical_role_samples_only=True, current_job_clock_proven=False, records=records, links=links))
|
||||
print(json.dumps(dict(id=ident, verified=True, read_only=True, receipt_sha256=sha(folder/'receipt.json'))))
|
||||
return
|
||||
save(folder, 'incomplete.json', dict(id=ident, verified=False, read_only=True, reason=last, no_diagnostic_triggered=True))
|
||||
print(json.dumps(dict(id=ident, verified=False, reason=last, read_only=True)))
|
||||
raise SystemExit(1)
|
||||
|
||||
|
||||
def guards():
|
||||
forbidden = ('Start-Service', 'Stop-Service', 'Restart-Service', 'Remove-Item', 'WriteAll', 'WriteNew', 'TimeBegin', 'TimeComplete', '--native-probe', 'Snapshot', 'Execute')
|
||||
need(all(item not in SCRIPT for item in forbidden), 'READ_ONLY_SOURCE_ONLY')
|
||||
need(all(name in SCRIPT for name in FILES.values()), 'TWO_FIXED_REPORT_NAMES')
|
||||
print('PASS local source guards; no target call')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('action', choices=('guards', 'collect'))
|
||||
parser.add_argument('--agent-sha256')
|
||||
parser.add_argument('--helper-sha256')
|
||||
parser.add_argument('--profile-after')
|
||||
args = parser.parse_args()
|
||||
if args.action == 'guards':
|
||||
guards()
|
||||
else:
|
||||
need(all((args.agent_sha256, args.helper_sha256, args.profile_after)), 'ROOT_ACTUAL_PROFILE_AND_RUNTIME_REQUIRED')
|
||||
guards()
|
||||
collect(args)
|
||||
@@ -70,19 +70,6 @@ def controller():
|
||||
# calibration/public-time-pin file or changes the six-field passive config.
|
||||
marker = 'function State([bool]$new){\n'
|
||||
prefix = replace_once(prefix, marker, marker + " if(Test-Path -LiteralPath (Join-Path $helperRoot 'time-attestation.json')){throw 'Separate time-pin provisioning required; passive bootstrap does not adopt it'}\n")
|
||||
# Compare JSON objects by their contents; serialized member order is not
|
||||
# identity. Arrays retain exact order and empty/null values stay distinct.
|
||||
prefix = replace_once(prefix,
|
||||
"function JsonEqual($a,$b){return(($a|ConvertTo-Json -Depth 40 -Compress)-ceq($b|ConvertTo-Json -Depth 40 -Compress))}",
|
||||
r'''function CanonicalStateValue($value,[int]$depth=0){
|
||||
if($depth-gt40){throw 'Bounded state comparison depth'}
|
||||
if($null-eq$value){return $null}
|
||||
if($value-is[Collections.IDictionary]){$result=[ordered]@{};foreach($key in @($value.Keys|Sort-Object -CaseSensitive)){if($key-isnot[string]-or$result.Contains($key)){throw 'Nonunique state object key'};$result[$key]=CanonicalStateValue $value[$key] ($depth+1)};return $result}
|
||||
if($value-is[pscustomobject]){$result=[ordered]@{};foreach($property in @($value.PSObject.Properties|Sort-Object -Property Name -CaseSensitive)){if($property.Name-isnot[string]-or$result.Contains($property.Name)){throw 'Nonunique state object key'};$result[$property.Name]=CanonicalStateValue $property.Value ($depth+1)};return $result}
|
||||
if($value-is[Collections.IEnumerable]-and$value-isnot[string]){$result=New-Object 'Collections.Generic.List[object]';foreach($item in $value){$result.Add((CanonicalStateValue $item ($depth+1)))};return ,$result.ToArray()}
|
||||
return $value
|
||||
}
|
||||
function JsonEqual($a,$b){return((ConvertTo-Json -InputObject (CanonicalStateValue $a) -Depth 40 -Compress)-ceq(ConvertTo-Json -InputObject (CanonicalStateValue $b) -Depth 40 -Compress))}''')
|
||||
native = prior.NATIVE.replace('RmmPipeNative', 'RmmSignedClockPairNative')
|
||||
phases = prior.PHASES.replace('SystemPipeUpgrade.ps1', 'SignedClockPairUpgrade.ps1').replace('RmmPipeNative', 'RmmSignedClockPairNative')
|
||||
# No implicit fallthrough may become an effect, even if a future caller
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
"""Local public-record binding fixtures; no SSH, file staging or clock query."""
|
||||
import base64
|
||||
import copy
|
||||
import datetime as dt
|
||||
import hashlib
|
||||
import json
|
||||
import unittest
|
||||
import passive_time_closeout as c
|
||||
|
||||
class Binding(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.now = dt.datetime(2026,11,15,14,0,tzinfo=dt.timezone.utc)
|
||||
self.since = c.utc_ns(self.now - dt.timedelta(seconds=50))
|
||||
ticks='638987472000000000'
|
||||
boot=c.windows_boot(ticks)
|
||||
epoch=dt.datetime(1601,1,1,tzinfo=dt.timezone.utc)
|
||||
ft=lambda value:str(int((value-epoch).total_seconds())*10000000)
|
||||
self.native=dict(read_only=True,boot_ticks=ticks,observed_at=self.now.isoformat().replace('+00:00','Z'),runtime=dict(agent=dict(pid=1234,birth_filetime=ft(self.now-dt.timedelta(minutes=1)))),reports={})
|
||||
self.server=dict(sql_read_only=True,secrets_read=False,installation=dict(windows_boot_id=boot,connection_generation=10,capabilities=['windows.base/1','heartbeat/1','agent.update/1']))
|
||||
for i,(role,name) in enumerate(c.FILES.items()):
|
||||
record=dict(schema_version=1,agent_pid=1234,observed_at=(self.now-dt.timedelta(seconds=20)).isoformat().replace('+00:00','Z'),role=role,windows_boot_id=boot,connection_generation=10,verifier_incarnation=f'11111111-1111-4111-8111-{i+1:012d}',request_sha256=str(i+1)*64,response_sha256=str(i+3)*64)
|
||||
raw=json.dumps(record).encode()
|
||||
self.native['reports'][name]=dict(raw_base64=base64.b64encode(raw).decode(),sha256=hashlib.sha256(raw).hexdigest(),metadata=dict(last_write_filetime=ft(self.now-dt.timedelta(seconds=2)),dacl_checked=True))
|
||||
def modify(self,name,field,value):
|
||||
wrapped=self.native['reports'][name]
|
||||
record=json.loads(base64.b64decode(wrapped['raw_base64']))
|
||||
record[field]=value
|
||||
raw=json.dumps(record).encode()
|
||||
wrapped.update(raw_base64=base64.b64encode(raw).decode(),sha256=hashlib.sha256(raw).hexdigest())
|
||||
def test_current_independent_pair(self):
|
||||
self.assertEqual(len(c.validate(self.native,self.server,self.since,self.now)),2)
|
||||
def test_pid_boot_generation_and_expired_sample_are_denied(self):
|
||||
good=copy.deepcopy(self.native)
|
||||
for field,value in [('agent_pid',1233),('windows_boot_id','11111111-1111-4111-8111-111111111111'),('connection_generation',9),('observed_at','2026-11-15T13:00:00Z'),('role','system_helper')]:
|
||||
self.native=copy.deepcopy(good);self.modify('agent-time-sample.json',field,value)
|
||||
with self.assertRaises(ValueError):c.validate(self.native,self.server,self.since,self.now)
|
||||
def test_same_verifier_request_or_response_is_denied(self):
|
||||
good=copy.deepcopy(self.native)
|
||||
first=json.loads(base64.b64decode(good['reports']['agent-time-sample.json']['raw_base64']))
|
||||
for field in ['verifier_incarnation','request_sha256','response_sha256']:
|
||||
self.native=copy.deepcopy(good);self.modify('helper-time-sample.json',field,first[field])
|
||||
with self.assertRaises(ValueError):c.validate(self.native,self.server,self.since,self.now)
|
||||
def test_duplicate_json_field_and_unprotected_metadata_are_denied(self):
|
||||
wrapped=self.native['reports']['agent-time-sample.json'];raw=base64.b64decode(wrapped['raw_base64'])
|
||||
changed=raw[:-1]+b',"schema_version":1}'
|
||||
wrapped.update(raw_base64=base64.b64encode(changed).decode(),sha256=hashlib.sha256(changed).hexdigest())
|
||||
with self.assertRaises(ValueError):c.validate(self.native,self.server,self.since,self.now)
|
||||
self.setUp();self.native['reports']['agent-time-sample.json']['metadata']['dacl_checked']=False
|
||||
with self.assertRaises(ValueError):c.validate(self.native,self.server,self.since,self.now)
|
||||
def test_missing_sample_is_explicit(self):
|
||||
self.native['reports']['helper-time-sample.json']=None
|
||||
with self.assertRaisesRegex(ValueError,'PUBLIC_SERVICE_SAMPLE_MISSING'):c.validate(self.native,self.server,self.since,self.now)
|
||||
def test_native_seven_and_chrono_nine_digits_keep_exact_install_boundary(self):
|
||||
native='2026-11-15T13:59:40.1234567Z'
|
||||
chrono='2026-11-15T13:59:40.123456701Z'
|
||||
self.assertEqual(c.stamp(chrono)-c.stamp(native),1)
|
||||
self.modify('agent-time-sample.json','observed_at',native)
|
||||
self.modify('helper-time-sample.json','observed_at',chrono)
|
||||
since=c.stamp(native)
|
||||
self.assertEqual(len(c.validate(self.native,self.server,since,self.now)),2)
|
||||
with self.assertRaisesRegex(ValueError,'SAMPLE_CURRENT_INSTALL_WINDOW'):
|
||||
c.validate(self.native,self.server,since+1,self.now)
|
||||
|
||||
if __name__=='__main__':unittest.main()
|
||||
@@ -0,0 +1,103 @@
|
||||
"""Local contract fixtures only; no native qualification or target calls."""
|
||||
import base64
|
||||
import copy
|
||||
import json
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
import time_profile_config as t
|
||||
from vm_mvp_acceptance import GuardError
|
||||
|
||||
|
||||
def fixture():
|
||||
binding = {'tenant_id':'11111111-1111-4111-8111-111111111111',
|
||||
'agent_id':'22222222-2222-4222-8222-222222222222',
|
||||
'asset_id':'33333333-3333-4333-8333-333333333333',
|
||||
'enrollment_generation':1,'assignment_version':1,'public_key_hex':'11'*32}
|
||||
public = {'public-binding.json':binding,'qualified-time-public-key.json':{
|
||||
'key_generation':1,'server_instance':'44444444-4444-4444-8444-444444444444',
|
||||
'key_id':'local_fixture_only','public_key_hex':'22'*32},'public-platform.json':{'fixture_only':True}}
|
||||
agent_sid = 'S-1-5-80-1-2-3-4-5';helper_sid = 'S-1-5-80-1-2-3-4-6'
|
||||
result = {'id':'55555555-5555-4555-8555-555555555555','verified':True,'completed':True,
|
||||
'no_jobs':True,'windows_jobs_enabled':False,'helper_effects_enabled':False,
|
||||
'clock_authority_not_proven':True,'private_key_read':False}
|
||||
native = dict(agent_id=binding['agent_id'],asset_id=binding['asset_id'],
|
||||
binary_sha256=t.IMAGES['agent'],helper_sha256=t.IMAGES['system_helper'],
|
||||
policy_sha256='a'*64,pin_sha256='b'*64,files={})
|
||||
for role, service, kernel, label, user, image in (
|
||||
('agent','service','agent_kernel','agent','S-1-5-19','rmm-agent-windows.exe'),
|
||||
('system_helper','helper_service','helper_kernel','helper','S-1-5-18','rmm-helper-windows.exe')):
|
||||
native[service] = dict(state='Running',pid=42,creation_filetime='123',owner_sid=user)
|
||||
native[kernel] = dict(pid=42,creation_filetime='123',owner_sid=user,service_sid=agent_sid if role=='agent' else helper_sid,
|
||||
kernel_handle_bound=True,service_sid_enabled=True,
|
||||
image='C:\\Program Files\\RustDiscovery\\'+image)
|
||||
native['files'][label] = dict(file_id='a'*32,sha256=t.IMAGES[role])
|
||||
result['native'] = native
|
||||
settings = dict(binding=binding,enable_effects=False,agent=dict(service_sid=agent_sid),helper=dict(service_sid=helper_sid))
|
||||
payload = dict(new_agent=t.IMAGES['agent'],new_helper=t.IMAGES['system_helper'],
|
||||
new_policy='a'*64,new_pin='b'*64,qualification_sha256=t.LINK_RECEIPT,
|
||||
manifest_sha256=t.LINK_RECEIPT,settings_base64=base64.b64encode(t.canonical(settings)).decode())
|
||||
return public,result,payload,{'local-service':{'fixture_only':True},'system':{'fixture_only':True}}
|
||||
|
||||
|
||||
class PublicProfileContract(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.values = fixture()
|
||||
self.pair = patch.object(t,'PAIR_ID',self.values[1]['id']);self.pair.start();self.addCleanup(self.pair.stop)
|
||||
|
||||
def render(self, values=None):
|
||||
return t.produce(*(values or self.values),'c'*64,'d'*64)[0]
|
||||
|
||||
def test_v2_fixture_links_both_exact_roles_without_runtime_success(self):
|
||||
items = self.render();config=json.loads(items['time-attestation.json'])
|
||||
self.assertEqual(config['schema_version'],2)
|
||||
self.assertNotIn('base_error_ns',config)
|
||||
for role in config['trusted_os_active_guest']['qualifications']:
|
||||
raw=items[role['role']+'-qualification.json'];value=json.loads(raw)
|
||||
self.assertEqual(t.sha(raw),role['qualification_sha256'])
|
||||
self.assertFalse(value['signed_runtime_verified']);self.assertFalse(value['physical_calibration_claimed'])
|
||||
self.assertEqual(value['source_sha256'],t.SOURCE_SHA if role['role']=='agent' else t.ORIGINAL_SOURCE_SHA)
|
||||
|
||||
def test_missing_or_not_completed_actual_pair_is_denied(self):
|
||||
for field in ('verified','completed','no_jobs'):
|
||||
values=copy.deepcopy(self.values);values[1].pop(field)
|
||||
with self.assertRaises(GuardError):self.render(values)
|
||||
|
||||
def test_wrong_kernel_birth_account_sid_image_or_fileid_is_denied(self):
|
||||
for field,value in [('creation_filetime','124'),('owner_sid','S-1-5-18'),
|
||||
('service_sid_enabled',False),('kernel_handle_bound',False),
|
||||
('service_sid','S-1-5-18'),('image','C:\\wrong.exe')]:
|
||||
values=copy.deepcopy(self.values);values[1]['native']['agent_kernel'][field]=value
|
||||
with self.assertRaises(GuardError):self.render(values)
|
||||
values=copy.deepcopy(self.values);values[1]['native']['files']['agent']['file_id']='bad'
|
||||
with self.assertRaises(GuardError):self.render(values)
|
||||
|
||||
def test_image_build_policy_and_identity_drift_is_denied(self):
|
||||
for field in ('new_agent','new_helper','new_policy','new_pin','qualification_sha256','manifest_sha256'):
|
||||
values=copy.deepcopy(self.values);values[2][field]='0'*64
|
||||
with self.assertRaises(GuardError):self.render(values)
|
||||
values=copy.deepcopy(self.values);values[0]['public-binding.json']['agent_id']='99999999-9999-4999-8999-999999999999'
|
||||
with self.assertRaises(GuardError):self.render(values)
|
||||
|
||||
def test_no_actual_pair_pins_blocks_before_creating_any_case(self):
|
||||
with tempfile.TemporaryDirectory() as root, patch.object(t,'STATE',Path(root)/'absent'),patch.object(t,'PAIR_ID',None):
|
||||
with self.assertRaises(GuardError):t.prepare()
|
||||
self.assertFalse(t.STATE.exists())
|
||||
|
||||
def test_bounded_nofollow_read_duplicate_json_and_createonce(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
path=Path(root)/'value.json';t.write(path,b'{"a":1}\n')
|
||||
self.assertEqual(t.read(path)[1],{'a':1})
|
||||
with self.assertRaises(FileExistsError):t.write(path,b'{}')
|
||||
with self.assertRaises(GuardError):t.read(path,'0'*64)
|
||||
link=Path(root)/'link';link.symlink_to(path)
|
||||
with self.assertRaises(OSError):t.read(link)
|
||||
bad=Path(root)/'duplicate.json';t.write(bad,b'{"a":1,"a":2}')
|
||||
with self.assertRaises(GuardError):t.read(bad)
|
||||
with self.assertRaises(GuardError):t.read(path,limit=1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,531 @@
|
||||
#!/usr/bin/env python3
|
||||
"""First public V2 time pin for one actual qualified Windows product pair.
|
||||
|
||||
prepare/guards are local only. No target operation happens on import.
|
||||
Missing native product-role/readback evidence blocks preparation; diagnostics
|
||||
are never relabelled as calibrated product clocks or signed runtime success.
|
||||
"""
|
||||
import argparse
|
||||
import base64
|
||||
import copy
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import stat
|
||||
import uuid
|
||||
|
||||
import system_pipe_upgrade as prior
|
||||
import signed_clock_capture_acceptance as raw_capture
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
CLOCK = ROOT.parent / 'rust-discovery-signed-clock'
|
||||
MAIN = ROOT.parent / 'rust-discovery'
|
||||
STATE = ROOT / 'devstate/windows-time-profile-config'
|
||||
PUBLIC = CLOCK / 'devstate/windows-time-profile-public-preparation/c3077acf-12da-410e-9f55-e75a1cd0a75f'
|
||||
PAIR_ID = '4887940a-4c9c-4807-aaf2-6fbc94faad46'
|
||||
PAIR_RESULT_SHA = '2898a72b4b0d84159cc11d80765cbfa4206faf7038d0e860429c8b1a57538ee2'
|
||||
PAIR_INTENT_SHA = '40e9cd557225504429b51dcecd4322b32d7f0973bcbb8e2a2e52516917907b85'
|
||||
PAIR_READBACK_SHA = '63e453fb915cadee028407a6aeaa8c7d209ae88ed12a6d4d4307d4fd25e4c539'
|
||||
PAIR_ROOT = CLOCK / 'devstate/windows-signed-clock/passive-pair-upgrade'
|
||||
SOURCE_CASE = CLOCK / 'devstate/windows-signed-clock/trusted-os-qualification-c4679433-b632-4d6e-8668-f0f2fb54a542'
|
||||
LINK_CASE = MAIN / 'devstate/windows-client/operator-window-20261115/observed-agent-build'
|
||||
ORIGINAL_SOURCE_SHA = 'd8594c1eba2c2cc5d5fde4a462b2110aa2e7e64081452b742c4ed81a2cfb477d'
|
||||
SOURCE_SHA = '342494c4f9e7eca439c059745591a8e907026da20f56b223fcb0eb0707aa6d82'
|
||||
SOURCE_RECEIPT = '96b05fe13f4d459b4b3ef78292beea33827b1ea47293ffb5921c685940e82a4d'
|
||||
LINK_RECEIPT = 'f04024f78c2f11f5c66bbdf9278467f5bcc50da5c2bd7336623851bca42dd446'
|
||||
LINK_INPUTS = '11717fab51bd1d6bf103b1821cc1e2a84699f46cac21f2cc614acf4b68381fa4'
|
||||
ORIGINAL_LINK_RECEIPT = '04ed34e6e850aca77c1fd4677ddb271f7ccd9492a97f5d4e00ead4c1f032f29d'
|
||||
NATIVE_RESULTS = {
|
||||
'linux': ('84592e7a-6554-4a7d-a73f-2bdebdb9e9a8', '150954b0ab290d8e9fbda5616f6df071168efd88a9f1d8b48b2bd8a5f5de7c20'),
|
||||
'windows': ('44059065-c17e-43c3-86aa-d4d131454ccb', 'b235bdd444c112ff91cbc5f160d39d69ef79fb419b9b2ab7ccdcec06009d5c6b')}
|
||||
ORIGINAL_IMAGES = {'agent': '26dc9d2f6928c5a41050ac9324e041c065e7a9ae52324416f3bb6222c002ae6b',
|
||||
'system_helper': '59675a3cbb3a5d213fc764f38379d6b81baaf9d47a7124470cc2767d4985763e'}
|
||||
IMAGES = {'agent': '0549d9ebea73cff996938f859b92192cc333de194128d7c6859a3f1d2e85893c',
|
||||
'system_helper': ORIGINAL_IMAGES['system_helper']}
|
||||
ASSUMPTION = 'active_guest_no_pause_save_restore_snapshot_migration_host_suspend'
|
||||
PUBLIC_SHAS = {'qualified-time-public-key.json': 'c31d31d2d61f881d04f55f704abbbf98f4822650c016f39e39d4d2318bc3f6e2',
|
||||
'public-platform.json': '94ae865e0e3449f6901f4d5f593aacbd5829b06340e296e19e6f0159a157cba3',
|
||||
'public-binding.json': '9239ee9f4142735867e77451478bf309fbf449d730a0ede6c958bc8018830dde',
|
||||
'input-provenance.json': '1c0db66cd0692024f68bddd71949692d274380a86e4b880fea0756479ceb5d0c',
|
||||
'receipt.json': '97e4db147f31f3cff134d2bc596d7d73ea5330b8b5a87971f215bb03a9751391'}
|
||||
RAW = CLOCK / 'devstate/windows-signed-clock-capture-completion/ccba6d8f-c58f-4d2d-a51c-1efb3bfbabdf'
|
||||
RAW_RECEIPTS = {'local-service': '10dd411be265d018489bf9477747ce2d5846ac04128f583425aec4b3c9d5252b',
|
||||
'system': '7409309ea6d586566373f570d6950c60ce2597cf939f261e6d2ea4def004a22f'}
|
||||
require = prior.require
|
||||
|
||||
def sha(raw):
|
||||
return hashlib.sha256(raw).hexdigest()
|
||||
|
||||
def canonical(value):
|
||||
return (json.dumps(value, sort_keys=True, separators=(',', ':'), ensure_ascii=False) + '\n').encode()
|
||||
|
||||
def strict_object(items):
|
||||
value = {}
|
||||
for key, item in items:
|
||||
require(key not in value, 'duplicate public JSON field')
|
||||
value[key] = item
|
||||
return value
|
||||
|
||||
def read(path, expected=None, limit=2*1024*1024, decode=True, public=False):
|
||||
fd = os.open(path, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK)
|
||||
with os.fdopen(fd, 'rb') as stream:
|
||||
before = os.fstat(stream.fileno())
|
||||
modes = (0o600,0o644,0o664) if public and expected is not None else (0o600,)
|
||||
require(stat.S_ISREG(before.st_mode) and before.st_uid == os.getuid() and before.st_nlink == 1
|
||||
and stat.S_IMODE(before.st_mode) in modes and 0 < before.st_size <= limit,
|
||||
'private bounded actual public evidence')
|
||||
raw = stream.read(limit + 1); after = os.fstat(stream.fileno())
|
||||
require((before.st_dev,before.st_ino,before.st_size,before.st_mtime_ns,before.st_ctime_ns)
|
||||
== (after.st_dev,after.st_ino,after.st_size,after.st_mtime_ns,after.st_ctime_ns)
|
||||
and len(raw) == before.st_size and (expected is None or sha(raw) == expected),
|
||||
'unchanged independently pinned public evidence')
|
||||
return raw, json.loads(raw, object_pairs_hook=strict_object) if decode else None
|
||||
|
||||
def write(path, raw):
|
||||
fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o600)
|
||||
with os.fdopen(fd,'wb') as stream:
|
||||
stream.write(raw); stream.flush(); os.fsync(stream.fileno())
|
||||
fd = os.open(path.parent,os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW)
|
||||
try: os.fsync(fd)
|
||||
finally: os.close(fd)
|
||||
|
||||
def public_inputs():
|
||||
values = {name: read(PUBLIC/name,digest)[1] for name,digest in PUBLIC_SHAS.items()}
|
||||
pin, platform, binding = (values[n] for n in ('qualified-time-public-key.json','public-platform.json','public-binding.json'))
|
||||
require(set(pin) == {'algorithm','schema_version','key_generation','key_id','server_instance','public_key_hex'}
|
||||
and pin['algorithm'] == 'Ed25519' and pin['schema_version'] == 1
|
||||
and type(pin['key_generation']) is int and pin['key_generation'] > 0
|
||||
and re.fullmatch('[A-Za-z0-9_-]{1,64}',pin['key_id'])
|
||||
and re.fullmatch('[a-f0-9]{64}',pin['public_key_hex']), 'actual separate public time key')
|
||||
require(str(uuid.UUID(pin['server_instance'])) == pin['server_instance'] and uuid.UUID(pin['server_instance']).int > 0,
|
||||
'actual server instance')
|
||||
require(set(binding) == {'tenant_id','asset_id','agent_id','enrollment_generation','assignment_version','public_key_hex'}
|
||||
and all(str(uuid.UUID(binding[k])) == binding[k] and uuid.UUID(binding[k]).int > 0 for k in ('tenant_id','asset_id','agent_id'))
|
||||
and type(binding['enrollment_generation']) is int and binding['enrollment_generation'] == 1
|
||||
and type(binding['assignment_version']) is int and binding['assignment_version'] == 1
|
||||
and bytes.fromhex(pin['public_key_hex']) != bytes.fromhex(binding['public_key_hex']), 'unchanged actual identity and distinct time/job keys')
|
||||
require(platform['schema'] == 1 and platform['hypervisor'] == 'kvm' and platform['state'] == 'running'
|
||||
and platform['domain_uuid'] == '1ec0d319-24bc-4953-a6b2-52b85449be07'
|
||||
and platform['has_genid'] is False
|
||||
and {'name':'hypervclock','present':'yes'} in platform['timers'], 'actual selectively observed active KVM platform')
|
||||
provenance = values['input-provenance.json']
|
||||
require(provenance['candidate_images'] == ORIGINAL_IMAGES and provenance['operating_assumption'] == ASSUMPTION
|
||||
and provenance['platform'] == 'kvm_qemu_hypervclock' and provenance['roles_qualified'] is False
|
||||
and provenance['time_config_created'] is False and provenance['target_called'] is False,
|
||||
'original incomplete public preparation stays incomplete and unchanged')
|
||||
return values
|
||||
|
||||
def source_inputs():
|
||||
_, source = read(SOURCE_CASE/'receipt.json',SOURCE_RECEIPT)
|
||||
read(SOURCE_CASE/'source/crates/agent-windows/src/signed_clock.rs',ORIGINAL_SOURCE_SHA,decode=False)
|
||||
_, link = read(LINK_CASE/'receipt.json',LINK_RECEIPT)
|
||||
_, inputs = read(LINK_CASE/'source-inputs.json',LINK_INPUTS)
|
||||
require(len(inputs) == 202 and len({item['path'] for item in inputs}) == 202,
|
||||
'exact updated source input set')
|
||||
clock = [item for item in inputs if item['path'] == 'crates/agent-windows/src/signed_clock.rs']
|
||||
require(len(clock) == 1 and clock[0]['sha256'] == SOURCE_SHA, 'same qualified V2 clock source')
|
||||
read(LINK_CASE/'source/crates/agent-windows/src/signed_clock.rs',SOURCE_SHA,decode=False)
|
||||
original_path = CLOCK/'devstate/windows-signed-clock/trusted-os-candidate-link-542cbf43-afb2-4994-b141-06e003e5e2e8'
|
||||
_, original = read(original_path/'receipt.json',ORIGINAL_LINK_RECEIPT)
|
||||
require(source['source_sha256'] == original['source_sha256'] == ORIGINAL_SOURCE_SHA
|
||||
and source['input_count'] == link['input_count'] == 202
|
||||
and source['inputs_sha256'] == original['inputs_sha256']
|
||||
and original['source_receipt_sha256'] == SOURCE_RECEIPT
|
||||
and link['source_receipt_sha256'] == ORIGINAL_LINK_RECEIPT
|
||||
and link['source_inputs_sha256'] == LINK_INPUTS
|
||||
and source['inputs_verified_before_after'] is True and link['source_verified_before_after'] is True
|
||||
and source['checks']['linux_signed_clock_guards']['passed'] == 8
|
||||
and link['link_exit'] == 0 and link['original_helper_sha256'] == IMAGES['system_helper']
|
||||
and link['target'] == 'x86_64-pc-windows-gnu' and link['patches'] == ['656102b','cc82124'],
|
||||
'actual fixed V2 source and linked product pair, no runtime success inferred')
|
||||
for artifact, role in ((link['artifacts']['rmm-agent-windows.exe'],'agent'),
|
||||
(original['artifacts']['rmm-helper-windows.exe'],'system_helper')):
|
||||
require(artifact['sha256'] == IMAGES[role] and artifact['machine'] == 'PE_AMD64', 'same actual linked role image')
|
||||
for platform in ('linux','windows'):
|
||||
case, binary_sha = NATIVE_RESULTS[platform]
|
||||
_, result = read(LINK_CASE.parent/case/'result.json',link[platform+'_result_sha256'],public=True)
|
||||
output = result['stdout'] if platform == 'linux' else '\n'.join(result['lines'])
|
||||
names = re.findall(r'^test (signed_clock::tests::[a-z_]+) \.\.\. ok$', output, re.MULTILINE)
|
||||
expected = set(source['checks']['linux_signed_clock_guards']['selected']) | {
|
||||
'signed_clock::tests::passive_sampling_requires_a_profile_and_uses_heartbeat_cadence'}
|
||||
require(result['test_binary_sha256'] == binary_sha
|
||||
and result['exit' if platform=='linux' else 'exit_code'] == 0
|
||||
and len(names) == 9 and set(names) == expected
|
||||
and '9 passed; 0 failed; 0 ignored' in output, 'same-source actual native nine guards')
|
||||
return source,link
|
||||
|
||||
def raw_inputs():
|
||||
require(sha(Path(raw_capture.__file__).read_bytes()) ==
|
||||
'dd6c575a119751429448e40e6f306cf79efa3a86c49bf2cd32a7783937177770',
|
||||
'unchanged original raw-role decoder')
|
||||
records = {}
|
||||
for role, digest in RAW_RECEIPTS.items():
|
||||
_, receipt = read(RAW/('start-'+role+'-receipt.json'),digest)
|
||||
raw_link = receipt['raw_reply']
|
||||
require(raw_link['filename'] == 'start-'+role+'-reply.json', 'fixed original raw role namespace')
|
||||
_, reply = read(RAW/raw_link['filename'],raw_link['sha256'])
|
||||
require(receipt['calibrated'] is False and receipt['clock_authority'] is False
|
||||
and reply['calibrated'] is False and reply['clock_authority'] is False,
|
||||
'raw probe is never a product calibration')
|
||||
for key in ('native_witness','server_witness','preservation'):
|
||||
item = receipt[key]
|
||||
require(Path(item['filename']).name == item['filename'], 'fixed sibling evidence leaf')
|
||||
read(RAW/item['filename'],item['sha256'])
|
||||
raw_capture.validate_role(role,reply['roles'][role],'efd17b43-7e04-49a7-9bd4-862d13365eec')
|
||||
records[role] = {'receipt_sha256':digest,'probe_image_sha256':raw_capture.EXE_SHA,
|
||||
'raw_report_sha256':reply['roles'][role]['raw_report_sha256']}
|
||||
return records
|
||||
|
||||
def validate_pair(result, intent):
|
||||
require(result.get('id') == PAIR_ID and result.get('verified') is True and result.get('completed') is True
|
||||
and result.get('no_jobs') is True and result.get('windows_jobs_enabled') is False
|
||||
and result.get('helper_effects_enabled') is False and result.get('clock_authority_not_proven') is True
|
||||
and result.get('private_key_read') is False, 'actual completed passive pair required; no missing or dummy result')
|
||||
payload = intent.get('payload',intent)
|
||||
require(payload['new_agent'] == IMAGES['agent'] and payload['new_helper'] == IMAGES['system_helper']
|
||||
and payload['qualification_sha256'] == LINK_RECEIPT and payload['manifest_sha256'] == LINK_RECEIPT,
|
||||
'actual exact V2 pair source chain')
|
||||
native = result['native']
|
||||
require(native['binary_sha256'] == IMAGES['agent'] and native['helper_sha256'] == IMAGES['system_helper']
|
||||
and native['policy_sha256'] == payload['new_policy'] and native['pin_sha256'] == payload['new_pin'], 'complete native image/pin pair')
|
||||
qualifications = []
|
||||
for role,service,kernel,label,user in [('agent','service','agent_kernel','agent','S-1-5-19'),('system_helper','helper_service','helper_kernel','helper','S-1-5-18')]:
|
||||
s,k,f = native[service],native[kernel],native['files'][label]
|
||||
require(s['state'] == 'Running' and type(s['pid']) is int and s['pid'] > 0
|
||||
and k['pid'] == s['pid'] and k['creation_filetime'] == s['creation_filetime']
|
||||
and k['owner_sid'] == s['owner_sid'] == user and k['service_sid_enabled'] is True
|
||||
and k['kernel_handle_bound'] is True and f['sha256'] == IMAGES[role]
|
||||
and k['image'] == ('C:\\Program Files\\RustDiscovery\\rmm-agent-windows.exe' if role=='agent'
|
||||
else 'C:\\Program Files\\RustDiscovery\\rmm-helper-windows.exe')
|
||||
and re.fullmatch(r'S-1-5-80-(?:[0-9]+-){4}[0-9]+',k['service_sid'])
|
||||
and re.fullmatch('[0-9]+',k['creation_filetime']) and re.fullmatch('[a-f0-9]{32}',f['file_id']),
|
||||
'actual SCM/kernel account, enabled service SID, birth and image FileID')
|
||||
qualifications.append({'role':role,'binary_sha256':IMAGES[role],'service':copy.deepcopy(s),
|
||||
'kernel':copy.deepcopy(k),'image_file':copy.deepcopy(f)})
|
||||
return native,payload,qualifications
|
||||
|
||||
def produce(public, pair_result, pair_intent, raw, result_sha, intent_sha):
|
||||
native,payload,roles = validate_pair(pair_result,pair_intent)
|
||||
binding = public['public-binding.json']; pin=public['qualified-time-public-key.json']
|
||||
require(native['agent_id'] == binding['agent_id'] and native['asset_id'] == binding['asset_id'], 'same actual device binding')
|
||||
settings = json.loads(base64.b64decode(payload['settings_base64'],validate=True),object_pairs_hook=strict_object)
|
||||
require(settings['binding'] == binding and settings['enable_effects'] is False
|
||||
and settings['agent']['service_sid'] == roles[0]['kernel']['service_sid']
|
||||
and settings['helper']['service_sid'] == roles[1]['kernel']['service_sid']
|
||||
and settings['agent']['service_sid'] != settings['helper']['service_sid'], 'actual reciprocal settings and distinct service roles')
|
||||
platform = {'profile':'rmm.windows.trusted-os.platform-provenance.v1','operating_assumption':ASSUMPTION,
|
||||
'platform':'kvm_qemu_hypervclock','public_platform_sha256':PUBLIC_SHAS['public-platform.json'],
|
||||
'original_public_preparation_sha256':PUBLIC_SHAS['input-provenance.json'],
|
||||
'source_sha256':SOURCE_SHA,'source_receipt_sha256':SOURCE_RECEIPT,
|
||||
'product_pair_receipt_sha256':LINK_RECEIPT,'pair_result_sha256':result_sha,
|
||||
'pair_intent_sha256':intent_sha,'independent_pair_readback_sha256':PAIR_READBACK_SHA,
|
||||
'independent_physical_calibration_claimed':False}
|
||||
items={'platform-provenance.json':canonical(platform),'public-platform.json':canonical(public['public-platform.json'])}
|
||||
# The original platform file is separately retained below using its actual
|
||||
# bytes; this canonical descriptive copy is never mislabelled as its hash.
|
||||
references=[]
|
||||
for role in roles:
|
||||
role.update(profile='rmm.windows.trusted-os.product-role-prerequisite.v1',pair_case_id=PAIR_ID,
|
||||
pair_result_sha256=result_sha,pair_intent_sha256=intent_sha,
|
||||
independent_pair_readback_sha256=PAIR_READBACK_SHA,
|
||||
source_sha256=SOURCE_SHA if role['role']=='agent' else ORIGINAL_SOURCE_SHA,
|
||||
original_source_receipt_sha256=SOURCE_RECEIPT,product_pair_receipt_sha256=LINK_RECEIPT,
|
||||
platform_provenance_sha256=sha(items['platform-provenance.json']),
|
||||
raw_capture=raw['local-service' if role['role']=='agent' else 'system'],
|
||||
signed_runtime_verified=False,physical_calibration_claimed=False)
|
||||
name=role['role']+'-qualification.json';items[name]=canonical(role)
|
||||
references.append({'role':role['role'],'binary_sha256':role['binary_sha256'],'qualification_sha256':sha(items[name])})
|
||||
value={'schema_version':2,'key_generation':pin['key_generation'],'server_instance':pin['server_instance'],
|
||||
'binding':binding,'public_keys_hex':{pin['key_id']:pin['public_key_hex']},
|
||||
'trusted_os_active_guest':{'operating_assumption':ASSUMPTION,'platform':'kvm_qemu_hypervclock',
|
||||
'platform_provenance_sha256':sha(items['platform-provenance.json']),'qualifications':references}}
|
||||
items['time-attestation.json']=canonical(value)
|
||||
require(len(items['time-attestation.json'])<=16384, 'real bounded public V2 configuration')
|
||||
return items,native,payload
|
||||
|
||||
# Controller and transport are defined below; no remote action on import.
|
||||
|
||||
HEADER = r'''
|
||||
$ErrorActionPreference='Stop';$request=$global:RmmTimeProfilePayload
|
||||
if(!$request-or$request.action-isnot[string]-or$request.action-cnotin@('install','read')-or[guid]::ParseExact($request.id,'D').ToString()-cne$request.id-or$request.profile-cne'rmm.windows.initial-public-time-profile.v2'){throw 'Exact initial time-profile operation'}
|
||||
$p=$request.pair_payload
|
||||
$boot='C:\ProgramData\RustDiscoveryBootstrap';$folder=Join-Path $boot ('time-profile-'+$request.id)
|
||||
$agentRoot='C:\ProgramData\RustDiscovery';$agentState=Join-Path $agentRoot 'state';$helperRoot='C:\ProgramData\RustDiscoverySystem';$helperState=Join-Path $helperRoot 'state'
|
||||
$config=Join-Path $agentRoot 'config.json';$settings=Join-Path $helperRoot 'helper.json';$pin=Join-Path $helperRoot 'agent-pin.json'
|
||||
$agentBinary='C:\Program Files\RustDiscovery\rmm-agent-windows.exe';$helperBinary='C:\Program Files\RustDiscovery\rmm-helper-windows.exe'
|
||||
$agentName='RmmDiscoveryWindows';$helperName='RmmDiscoverySystemHelper';$sys='S-1-5-18';$admin='S-1-5-32-544'
|
||||
$agentSid=(New-Object Security.Principal.NTAccount('NT SERVICE',$agentName)).Translate([Security.Principal.SecurityIdentifier]).Value
|
||||
$helperSid=(New-Object Security.Principal.NTAccount('NT SERVICE',$helperName)).Translate([Security.Principal.SecurityIdentifier]).Value
|
||||
$target=Join-Path $helperRoot 'time-attestation.json';$active=Join-Path $boot 'time-profile-initial-active.json'
|
||||
'''
|
||||
|
||||
BODY = r'''
|
||||
function ReadAcl($path,[bool]$directory){
|
||||
Check $path $directory;$acl=Get-Acl -LiteralPath $path
|
||||
if($acl.GetOwner([Security.Principal.SecurityIdentifier]).Value-cnotin@($sys,$admin)){throw 'Public pin owner must remain SYSTEM/Administrators'}
|
||||
$seen=@{};foreach($rule in $acl.GetAccessRules($true,$true,[Security.Principal.SecurityIdentifier])){
|
||||
$id=$rule.IdentityReference.Value;$rights=[int64]$rule.FileSystemRights
|
||||
if($rule.AccessControlType-cne'Allow'-or$id-cnotin@($sys,$admin,$agentSid,$helperSid)-or($id-cnotin@($sys,$admin)-and($rights-band(-bnot 0x1200a9))-ne0)){throw 'Only exact native reader rights, no foreign writer'}
|
||||
$seen[$id]=$true
|
||||
};foreach($id in @($sys,$admin)){if(!$seen[$id]){throw 'Privileged public-pin role missing'}}
|
||||
return $acl
|
||||
}
|
||||
function GrantRootReaders{
|
||||
$acl=ReadAcl $helperRoot $true
|
||||
foreach($id in @($agentSid,$helperSid)){
|
||||
$present=$false;foreach($rule in $acl.GetAccessRules($true,$true,[Security.Principal.SecurityIdentifier])){if($rule.IdentityReference.Value-ceq$id-and([int64]$rule.FileSystemRights-band0x1200a9)-eq0x1200a9){$present=$true}}
|
||||
if(!$present){$acl.AddAccessRule((New-Object Security.AccessControl.FileSystemAccessRule((New-Object Security.Principal.SecurityIdentifier($id)),[Security.AccessControl.FileSystemRights]0x1200a9,'None','None','Allow')))}
|
||||
}
|
||||
# This-folder-only ACEs: do not expose state/PKI/ledger/intent descendants.
|
||||
Set-Acl -LiteralPath $helperRoot -AclObject $acl;$null=ReadAcl $helperRoot $true
|
||||
}
|
||||
function SetPinAcl($path){
|
||||
$acl=New-Object Security.AccessControl.FileSecurity;$acl.SetSecurityDescriptorSddlForm(('O:BAG:BAD:P(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;'+$agentSid+')(A;;0x1200a9;;;'+$helperSid+')'))
|
||||
Set-Acl -LiteralPath $path -AclObject $acl;$null=ReadAcl $path $false
|
||||
}
|
||||
function NewPrivateCase{
|
||||
[RmmTimeProfileCase]::CreatePrivateOnce($folder);CheckControl $folder $true
|
||||
}
|
||||
function FileVolume($path){
|
||||
$handle=[RmmPipeNative]::CreateFile($path,0x80,7,[IntPtr]::Zero,3,0x2200000,[IntPtr]::Zero)
|
||||
try{if($handle.IsInvalid){throw 'Protected directory identity handle'};$id=New-Object RmmPipeNative+FileId;if(![RmmPipeNative]::GetFileInformationByHandleEx($handle,18,[ref]$id,24)){throw 'Protected directory volume'};return $id.Volume.ToString([Globalization.CultureInfo]::InvariantCulture)}finally{$handle.Dispose()}
|
||||
}
|
||||
function SameLive($before,$after){
|
||||
Preserved $before $after $false
|
||||
foreach($field in @('files','service','helper_service','agent_kernel','helper_kernel')){if(!(JsonEqual $before.$field $after.$field)){throw 'Same original data/PKI/FileIDs/services/process generations required'}}
|
||||
}
|
||||
function ConfigBytes{
|
||||
$bytes=[Convert]::FromBase64String($request.config_base64)
|
||||
if($bytes.Length-gt16384-or$bytes.Length-lt1-or(BytesHash $bytes)-cne$request.config_sha256){throw 'Fixed complete public config bytes'}
|
||||
$value=[Text.Encoding]::UTF8.GetString($bytes)|ConvertFrom-Json
|
||||
if($value.schema_version-ne2-or$value.key_generation-ne$request.key_generation-or$value.server_instance-cne$request.server_instance-or!(JsonEqual $value.binding $request.binding)-or$value.trusted_os_active_guest.operating_assumption-cne'active_guest_no_pause_save_restore_snapshot_migration_host_suspend'-or$value.trusted_os_active_guest.platform-cne'kvm_qemu_hypervclock'-or@($value.trusted_os_active_guest.qualifications).Count-ne2-or$value.trusted_os_active_guest.qualifications[0].role-cne'agent'-or$value.trusted_os_active_guest.qualifications[0].binary_sha256-cne$p.new_agent-or$value.trusted_os_active_guest.qualifications[1].role-cne'system_helper'-or$value.trusted_os_active_guest.qualifications[1].binary_sha256-cne$p.new_helper){throw 'Closed real schema2/profile/role binding'}
|
||||
return ,$bytes
|
||||
}
|
||||
CheckControl $boot $true
|
||||
if($PSCommandPath-cne(Join-Path (Join-Path $boot $request.script_sha256) 'InstallPublicTimeProfile.ps1')-or(Hash $PSCommandPath)-cne$request.script_sha256){throw 'Exact reviewed public-pin controller'}
|
||||
CheckControl $PSCommandPath $false
|
||||
$expected=$request.expected_native
|
||||
$before=ActualState $true;SameLive $expected $before
|
||||
if($before.agent_kernel.service_sid-cne$agentSid-or$before.helper_kernel.service_sid-cne$helperSid){throw 'Same actual qualified service SIDs'}
|
||||
$null=ReadAcl $helperRoot $true
|
||||
if($request.action-ceq'read'){
|
||||
$records=[ordered]@{};if(Test-Path -LiteralPath $folder){CheckControl $folder $true;foreach($name in @('intent.json','directory-acl-intent.json','directory-acl-done.json','publish-intent.json','result.json')){$path=Join-Path $folder $name;$records[$name]=$null;if(Test-Path -LiteralPath $path){CheckControl $path $false;if((Get-Item -LiteralPath $path -Force).Length-gt2097152){throw 'Bounded original public-pin history'};$records[$name]=Get-Content -LiteralPath $path -Raw|ConvertFrom-Json}}}
|
||||
if($records['intent.json']){foreach($field in $request.PSObject.Properties.Name){if($field-cne'action'-and!(JsonEqual $records['intent.json'].request.$field $request.$field)){throw 'Same original public-pin intent only'}}}
|
||||
$activeRecord=$null;if(Test-Path -LiteralPath $active){CheckControl $active $false;if((Get-Item -LiteralPath $active -Force).Length-gt8192){throw 'Bounded public-pin active marker'};$activeRecord=Get-Content -LiteralPath $active -Raw|ConvertFrom-Json;if($activeRecord.id-cne$request.id-or$activeRecord.config_sha256-cne$request.config_sha256-or$activeRecord.script_sha256-cne$request.script_sha256){throw 'Another initial public-pin case; no adoption'}}
|
||||
$current=$null;if(Test-Path -LiteralPath $target){$null=ReadAcl $target $false;$current=FileIdentity $target;if($current.sha256-cne$request.config_sha256){throw 'Unexpected existing configuration; no adoption'}}
|
||||
@{id=$request.id;read_only=$true;records=$records;active=$activeRecord;configuration=$current;native=$before;root_sddl=(Get-Acl -LiteralPath $helperRoot).Sddl;clock_runtime_qualified=$false;no_jobs=$true}|ConvertTo-Json -Depth 50 -Compress;exit0
|
||||
}
|
||||
if($request.action-cne'install'){throw 'Exact install action only'}
|
||||
if((Test-Path -LiteralPath $target)-or(Test-Path -LiteralPath $folder)-or(Test-Path -LiteralPath $active)){throw 'Existing initial time profile or partial attempt: original read only'}
|
||||
$bytes=ConfigBytes
|
||||
$rootSddl=(Get-Acl -LiteralPath $helperRoot).Sddl
|
||||
$heldAgent=[RmmPipeNative]::Open([int]$before.service.pid);$heldHelper=[RmmPipeNative]::Open([int]$before.helper_service.pid)
|
||||
try{
|
||||
$null=Kernel 'agent' $before.service $heldAgent;$null=Kernel 'helper' $before.helper_service $heldHelper
|
||||
$installNotBefore=[DateTime]::UtcNow.ToString('o')
|
||||
NewPrivateCase
|
||||
WriteNew (Join-Path $folder 'intent.json') @{id=$request.id;request=$request;before=$before;original_root_sddl=$rootSddl;install_not_before=$installNotBefore;no_retry=$true}
|
||||
WriteNew $active @{id=$request.id;config_sha256=$request.config_sha256;script_sha256=$request.script_sha256;no_retry=$true}
|
||||
foreach($item in $request.provenance.PSObject.Properties){if($item.Name-cnotmatch'^(platform-provenance|public-platform|original-public-platform|agent-qualification|system_helper-qualification|qualified-time-public-key|public-binding)\.json$'){throw 'Closed public provenance leaves'};$raw=[Convert]::FromBase64String($item.Value);if($raw.Length-gt65536){throw 'Bounded public provenance'};WriteBytes (Join-Path $folder $item.Name) $raw}
|
||||
$staged=Join-Path $folder 'time-attestation.candidate.json';WriteBytes $staged $bytes;SetPinAcl $staged
|
||||
if((FileIdentity $staged).sha256-cne$request.config_sha256-or(FileVolume $folder)-cne(FileVolume $helperRoot)){throw 'Verified complete same-volume public pin'}
|
||||
SameLive $before (ActualState $true)
|
||||
if((Get-Acl -LiteralPath $helperRoot).Sddl-cne$rootSddl){throw 'Immediate directory ACL CAS'}
|
||||
WriteNew (Join-Path $folder 'directory-acl-intent.json') @{old_sddl=$rootSddl;readers=@($agentSid,$helperSid);this_folder_only=$true}
|
||||
GrantRootReaders
|
||||
WriteNew (Join-Path $folder 'directory-acl-done.json') @{sddl=(Get-Acl -LiteralPath $helperRoot).Sddl}
|
||||
SameLive $before (ActualState $true)
|
||||
$null=Kernel 'agent' $before.service $heldAgent;$null=Kernel 'helper' $before.helper_service $heldHelper
|
||||
if(Test-Path -LiteralPath $target){throw 'Target appeared before no-overwrite publication'}
|
||||
$stagedId=FileIdentity $staged
|
||||
WriteNew (Join-Path $folder 'publish-intent.json') @{config_sha256=$request.config_sha256;staged=$stagedId;create_once=$true}
|
||||
[IO.File]::Move($staged,$target)
|
||||
$null=ReadAcl $target $false;$published=FileIdentity $target
|
||||
if(!(JsonEqual $published $stagedId)){throw 'Exact same file identity/hash/ACL after publication'}
|
||||
$after=ActualState $true;SameLive $before $after
|
||||
$null=Kernel 'agent' $before.service $heldAgent;$null=Kernel 'helper' $before.helper_service $heldHelper
|
||||
$result=@{id=$request.id;installed=$true;install_not_before=$installNotBefore;configuration=$published;native=$after;original_root_sddl=$rootSddl;root_sddl=(Get-Acl -LiteralPath $helperRoot).Sddl;no_jobs=$true;clock_runtime_qualified=$false;services_changed=$false;private_key_read=$false}
|
||||
WriteNew (Join-Path $folder 'result.json') $result;$result|ConvertTo-Json -Depth 50 -Compress
|
||||
}finally{$heldAgent.Dispose();$heldHelper.Dispose()}
|
||||
'''.replace('exit0','exit 0')
|
||||
|
||||
|
||||
def controller():
|
||||
"""Reuse only existing read-only witnesses, not any old phase/repair code."""
|
||||
require(sha(Path(prior.__file__).read_bytes()) == 'e466576673a0e5c332cfc1613ae88a62f5b526015ced76b1d22473e292a995e0'
|
||||
and sha(Path(prior.u.__file__).read_bytes()) == 'f8dc1c8fbc064e253b1fbe130fb628afef58cf45c2bafb6837d6716125b42d38', 'unchanged reviewed original readonly witness sources')
|
||||
source = prior.u.SCRIPT
|
||||
# Every selected section ends at the next named function. No StartOnce,
|
||||
# StopPinned, Swap, Backup, original phase, or old payload dispatch is copied.
|
||||
names = ['Check','BytesHash','Hash','AclHash','CheckControl','Service','Probe','Diagnostic','RawAgentProbe','EmptyIntentStore','State','Preserved']
|
||||
functions=[]
|
||||
for name in names:
|
||||
start=source.index('function '+name+'(') if 'function '+name+'(' in source else source.index('function '+name+'{')
|
||||
end=source.find('\nfunction ',start+1)
|
||||
require(end>start, 'closed existing readonly witness boundary')
|
||||
functions.append(source[start:end])
|
||||
# File writers are new, closed by the controller's fixed namespace only.
|
||||
writers=r'''function WriteBytes($path,[byte[]]$bytes){$file=[IO.File]::Open($path,[IO.FileMode]::CreateNew,[IO.FileAccess]::Write,[IO.FileShare]::Read);try{$file.Write($bytes,0,$bytes.Length);$file.Flush($true)}finally{$file.Dispose()}}
|
||||
function WriteNew($path,$value){WriteBytes $path ([Text.Encoding]::UTF8.GetBytes(($value|ConvertTo-Json -Depth 50 -Compress)))}'''
|
||||
return HEADER+'\n'+STRUCTURAL+'\n'+'\n'.join(functions)+'\n'+prior.NATIVE+'\n'+CASE_NATIVE+'\n'+writers+'\n'+BODY
|
||||
|
||||
# Same reviewed structural comparison as e6debe5; member order is not identity.
|
||||
STRUCTURAL = r'''function CanonicalStateValue($value,[int]$depth=0){
|
||||
if($depth-gt40){throw 'Bounded state comparison depth'}
|
||||
if($null-eq$value){return $null}
|
||||
# ETS wrapping does not turn a CLR JSON scalar into a JSON object.
|
||||
$base=$value.PSObject.BaseObject;$culture=[Globalization.CultureInfo]::InvariantCulture
|
||||
if($base-is[string]){return [string]::new($base.ToCharArray())}
|
||||
if($base-is[char]){return [string]::new([char[]]@($base))}
|
||||
if($base-is[bool]){return [bool]::Parse($base.ToString())}
|
||||
if($base-is[sbyte]-or$base-is[int16]-or$base-is[int32]-or$base-is[int64]){return [int64]::Parse($base.ToString($culture),$culture)}
|
||||
if($base-is[byte]-or$base-is[uint16]-or$base-is[uint32]-or$base-is[uint64]){return [uint64]::Parse($base.ToString($culture),$culture)}
|
||||
if($base-is[single]-or$base-is[double]){$number=[double]::Parse($base.ToString('R',$culture),$culture);if([double]::IsNaN($number)-or[double]::IsInfinity($number)){throw 'Finite JSON state number required'};return $number}
|
||||
if($base-is[decimal]){return [decimal]::Parse($base.ToString($culture),$culture)}
|
||||
if($value-is[Collections.IDictionary]){$result=[ordered]@{};foreach($key in @($value.Keys|Sort-Object -CaseSensitive)){if($key-isnot[string]-or$result.Contains($key)){throw 'Nonunique state object key'};$result[$key]=CanonicalStateValue $value[$key] ($depth+1)};return $result}
|
||||
if($value-is[pscustomobject]){$result=[ordered]@{};foreach($property in @($value.PSObject.Properties|Sort-Object -Property Name -CaseSensitive)){if($property.Name-isnot[string]-or$result.Contains($property.Name)){throw 'Nonunique state object key'};$result[$property.Name]=CanonicalStateValue $property.Value ($depth+1)};return $result}
|
||||
if($value-is[Collections.IEnumerable]-and$value-isnot[string]){$result=New-Object 'Collections.Generic.List[object]';foreach($item in $value){$result.Add((CanonicalStateValue $item ($depth+1)))};return ,$result.ToArray()}
|
||||
return $value
|
||||
}
|
||||
function JsonEqual($a,$b){return((ConvertTo-Json -InputObject (CanonicalStateValue $a) -Depth 40 -Compress)-ceq(ConvertTo-Json -InputObject (CanonicalStateValue $b) -Depth 40 -Compress))}'''
|
||||
CASE_NATIVE = r'''Add-Type -TypeDefinition @'
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.AccessControl;
|
||||
public static class RmmTimeProfileCase {
|
||||
[StructLayout(LayoutKind.Sequential)] struct Attributes {public int Length;public IntPtr Descriptor;public int Inherit;}
|
||||
[DllImport("kernel32.dll",EntryPoint="CreateDirectoryW",ExactSpelling=true,CharSet=CharSet.Unicode,SetLastError=true)]
|
||||
[return:MarshalAs(UnmanagedType.Bool)] static extern bool CreateDirectory(string path,ref Attributes security);
|
||||
public static void CreatePrivateOnce(string path){
|
||||
RawSecurityDescriptor sd=new RawSecurityDescriptor("O:BAG:BAD:P(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)");
|
||||
byte[] raw=new byte[sd.BinaryLength];sd.GetBinaryForm(raw,0);GCHandle pin=GCHandle.Alloc(raw,GCHandleType.Pinned);
|
||||
try{Attributes attributes=new Attributes{Length=Marshal.SizeOf(typeof(Attributes)),Descriptor=pin.AddrOfPinnedObject(),Inherit=0};
|
||||
if(!CreateDirectory(path,ref attributes))throw new Win32Exception(Marshal.GetLastWin32Error(),"TIME_PROFILE_PRIVATE_CREATE_ONCE");
|
||||
}finally{pin.Free();}
|
||||
}
|
||||
}
|
||||
'@'''
|
||||
|
||||
LAUNCH = r'''$ErrorActionPreference='Stop';$request=([Console]::In.ReadLine()|ConvertFrom-Json)
|
||||
if(!$request-or$request.action-isnot[string]-or$request.action-cnotin@('install','read')-or$request.script_sha256-cnotmatch'^[a-f0-9]{64}$'){throw 'Fixed public-pin launch'}
|
||||
$script=Join-Path (Join-Path 'C:\ProgramData\RustDiscoveryBootstrap' $request.script_sha256) 'InstallPublicTimeProfile.ps1'
|
||||
$item=Get-Item -LiteralPath $script -Force;if($item.PSIsContainer-or($item.Attributes-band[IO.FileAttributes]::ReparsePoint)-or$item.Length-gt100000-or(Get-FileHash -LiteralPath $script -Algorithm SHA256).Hash.ToLowerInvariant()-cne$request.script_sha256){throw 'Exact bounded immutable time-pin script'}
|
||||
$acl=Get-Acl -LiteralPath $script;if($acl.GetOwner([Security.Principal.SecurityIdentifier]).Value-cnotin@('S-1-5-18','S-1-5-32-544')){throw 'Private launch owner'}
|
||||
foreach($rule in $acl.GetAccessRules($true,$true,[Security.Principal.SecurityIdentifier])){if($rule.AccessControlType-cne'Allow'-or$rule.IdentityReference.Value-cnotin@('S-1-5-18','S-1-5-32-544')){throw 'Private launch DACL'}}
|
||||
$global:RmmTimeProfilePayload=$request;& $script
|
||||
'''
|
||||
|
||||
def guards():
|
||||
script=controller()
|
||||
for forbidden in ('Stop-Service','Start-Service','Restart-Computer','Set-Date','AdjustTokenPrivileges',
|
||||
'function Swap','function Backup','function StartOnce','CreateService(', 'DeleteService('):
|
||||
require(forbidden not in script, 'no service/clock/job effect imported')
|
||||
require("$request.action-cnotin@('install','read')" in script
|
||||
and "if($request.action-cne'install')" in script
|
||||
and '[IO.File]::Move($staged,$target)' in script
|
||||
and script.index("'publish-intent.json') @") < script.index('[IO.File]::Move($staged,$target)')
|
||||
and 'This-folder-only ACEs' in script and '0x1200a9' in script
|
||||
and 'CreatePrivateOnce' in script, 'closed create-once public-pin effects')
|
||||
return script
|
||||
|
||||
def prepare():
|
||||
# All prerequisites are checked BEFORE creating a local installation case.
|
||||
# Source/link/role constants deliberately remain unset until actual evidence.
|
||||
require(PAIR_ID is not None and str(uuid.UUID(PAIR_ID)) == PAIR_ID
|
||||
and all(isinstance(value,str) and re.fullmatch('[a-f0-9]{64}',value)
|
||||
for value in (PAIR_RESULT_SHA,PAIR_INTENT_SHA,PAIR_READBACK_SHA)),
|
||||
'actual completed new pair and independently pinned role readback required')
|
||||
public=public_inputs(); source_inputs(); raw=raw_inputs()
|
||||
pair=PAIR_ROOT/PAIR_ID
|
||||
result_raw,result=read(pair/'result.json',PAIR_RESULT_SHA)
|
||||
intent_path=pair/'intent.json'
|
||||
if not intent_path.exists(): intent_path=pair/'bound-payload.json'
|
||||
intent_raw,intent=read(intent_path,PAIR_INTENT_SHA)
|
||||
_, independent=read(pair/'independent-readback.json',PAIR_READBACK_SHA)
|
||||
require(independent.get('id') == PAIR_ID and independent.get('completed') is True
|
||||
and independent.get('read_only') is True and independent.get('no_job') is True
|
||||
and independent.get('no_service_action') is True
|
||||
and result['independent_readback_sha256'] == PAIR_READBACK_SHA
|
||||
and result['intent_sha256'] == PAIR_INTENT_SHA
|
||||
and all(independent['native'][key] == result['native'][key]
|
||||
for key in ('files','service','helper_service','agent_kernel','helper_kernel')),
|
||||
'original independent same-generation role and file readback')
|
||||
items,native,payload=produce(public,result,intent,raw,sha(result_raw),sha(intent_raw))
|
||||
items['original-public-platform.json']=read(PUBLIC/'public-platform.json',PUBLIC_SHAS['public-platform.json'])[0]
|
||||
for name in ('qualified-time-public-key.json','public-binding.json'):
|
||||
items[name]=read(PUBLIC/name,PUBLIC_SHAS[name])[0]
|
||||
script=guards().encode(); ident=str(uuid.uuid4()); script_sha=sha(script)
|
||||
keep=('old_agent','old_helper','new_agent','new_helper','old_policy','old_pin','new_policy','new_pin',
|
||||
'config_sha256','probe_sha256','system_probe_sha256','intent_leaves')
|
||||
public_payload={key:payload[key] for key in keep}
|
||||
request={'profile':'rmm.windows.initial-public-time-profile.v2','id':ident,'action':'read',
|
||||
'script_sha256':script_sha,'config_sha256':sha(items['time-attestation.json']),
|
||||
'config_base64':base64.b64encode(items.pop('time-attestation.json')).decode(),
|
||||
'pair_payload':public_payload,'expected_native':native,'binding':public['public-binding.json'],
|
||||
'key_generation':public['qualified-time-public-key.json']['key_generation'],
|
||||
'server_instance':public['qualified-time-public-key.json']['server_instance'],
|
||||
'provenance':{name:base64.b64encode(value).decode() for name,value in items.items()}}
|
||||
# Existing transport passes the payload on stdin, not on the command line.
|
||||
require(len(canonical(request))<=128*1024,'bounded public bootstrap request')
|
||||
STATE.mkdir(mode=0o700,parents=True,exist_ok=True);ident_dir=STATE/ident;ident_dir.mkdir(mode=0o700)
|
||||
write(ident_dir/'InstallPublicTimeProfile.ps1',script)
|
||||
write(ident_dir/'time-attestation.json',base64.b64decode(request['config_base64'],validate=True))
|
||||
for name,value in items.items(): write(ident_dir/name,value)
|
||||
manifest={'profile':request['profile'],'id':ident,'generator_sha256':sha(Path(__file__).read_bytes()),
|
||||
'script_sha256':script_sha,'request':request,'pair_result_sha256':sha(result_raw),
|
||||
'pair_intent_sha256':sha(intent_raw),'source_receipt_sha256':SOURCE_RECEIPT,
|
||||
'product_link_receipt_sha256':LINK_RECEIPT,'target_called':False,'clock_runtime_qualified':False,
|
||||
'files':{name:{'sha256':sha(value),'bytes':len(value)} for name,value in items.items()}}
|
||||
write(ident_dir/'manifest.json',canonical(manifest))
|
||||
print(json.dumps({'id':ident,'prepared_locally':True,'target_called':False,
|
||||
'config_sha256':request['config_sha256'],'manifest_sha256':sha(canonical(manifest))}))
|
||||
|
||||
def load_case(ident):
|
||||
require(str(uuid.UUID(ident))==ident and uuid.UUID(ident).version==4,'canonical original time-pin case')
|
||||
folder=STATE/ident; _,manifest=read(folder/'manifest.json')
|
||||
require(manifest['id']==ident and manifest['generator_sha256']==sha(Path(__file__).read_bytes())
|
||||
and manifest['script_sha256']==sha(guards().encode()),'same exact reviewed operator and case')
|
||||
require(read(folder/'InstallPublicTimeProfile.ps1',decode=False)[0]==guards().encode(), 'same controller bytes')
|
||||
request=manifest['request'];read(folder/'time-attestation.json',request['config_sha256'])
|
||||
for name,item in manifest['files'].items(): read(folder/name,item['sha256'])
|
||||
return folder,manifest
|
||||
|
||||
def target(action,ident):
|
||||
"""Only Root invokes these explicit phases after independent review."""
|
||||
folder,manifest=load_case(ident)
|
||||
require(action in ('stage','install','read'),'closed public-pin phase')
|
||||
if action!='read':
|
||||
write(folder/(action+'-attempt.json'),canonical({'id':ident,'action':action,'once':True,'lost_reply_read_original_case_only':True}))
|
||||
access=raw_capture.CaptureAccess(MAIN)
|
||||
if action=='stage':
|
||||
path=folder/'InstallPublicTimeProfile.ps1';digest=manifest['script_sha256']
|
||||
stage=prior.u.transport.PREPARE_SCRIPT.replace('TransportAcceptance.ps1',path.name)
|
||||
observed=access.powershell(stage,{'sha256':digest})
|
||||
if not observed['already_uploaded']:
|
||||
import subprocess
|
||||
config=prior.cb.contract.protected_json(MAIN/'credentials/windows-dev-access.json')
|
||||
prefix=config['ssh_prefix'];args=['sftp']+[p for p in prefix[1:-1] if p!='-T']+['-b','-',prefix[-1]]
|
||||
remote='/C:/ProgramData/RustDiscoveryBootstrap/'+digest+'/'+path.name
|
||||
reply=subprocess.run(args,input=('put '+json.dumps(str(path.resolve()))+' '+json.dumps(remote)+'\n').encode(),capture_output=True,timeout=60)
|
||||
write(folder/'stage-transport.json',canonical({'returncode':reply.returncode,'stdout_b64':base64.b64encode(reply.stdout).decode(),'stderr_b64':base64.b64encode(reply.stderr).decode()}))
|
||||
require(reply.returncode==0,'once-only fixed script transfer; lost reply read only')
|
||||
observed=access.powershell(stage,{'sha256':digest})
|
||||
require(observed['already_uploaded'] is True and observed['sha256']==digest,'exact staged public-pin controller')
|
||||
result={'id':ident,'staged':True,'script_sha256':digest,'configuration_installed':False}
|
||||
else:
|
||||
request=copy.deepcopy(manifest['request']);request['action']=action
|
||||
result=access.powershell(LAUNCH,request,timeout=120)
|
||||
require(result['id']==ident and result.get('no_jobs') is True and result.get('clock_runtime_qualified') is False,
|
||||
'same native public-pin result, never clock readiness')
|
||||
output=folder/((action+'-'+str(uuid.uuid4()) if action=='read' else action)+'-reply.json')
|
||||
write(output,canonical(result))
|
||||
print(json.dumps({'id':ident,'action':action,'reply_sha256':sha(canonical(result)),'clock_runtime_qualified':False}))
|
||||
|
||||
if __name__=='__main__':
|
||||
parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('action',choices=('guards','prepare','stage','install','read'));parser.add_argument('--case');arguments=parser.parse_args()
|
||||
if arguments.action=='guards': guards();print('PASS closed public-profile source guards; no target action')
|
||||
elif arguments.action=='prepare': prepare()
|
||||
else: target(arguments.action,arguments.case)
|
||||
@@ -1,17 +1,5 @@
|
||||
# Tatsächlicher Implementierungsstand
|
||||
|
||||
## Passiver Windows-Zeitabschluss vorbereitet — 2026-11-15
|
||||
|
||||
Ein kleiner rein lesender Collector für die beiden historischen Rollenbelege
|
||||
aus cc82124 ist ausführbar vorbereitet. Er bindet öffentliche Dienstprozesse,
|
||||
Boot, aktuelle Servergeneration, Rollen-/Hashtrennung und enge Datenalter;
|
||||
keine Dienste, IPC, Zeitrequests oder Diagnoseprogramme werden ausgelöst.
|
||||
Lokale Syntax-/Scopeguards und sechs Bindingfixtures bestanden. Der konkrete
|
||||
lokale .NET-/Chrono-Fraktionsparserfehler ist mit exakter Nanosekundenrechnung
|
||||
und +1ns-Grenzfall korrigiert. **Kein VM-Aufruf,
|
||||
keine native Collector-/Rollenabnahme** vor Roots V2-Profil-/Readbacksignal.
|
||||
[Umfang und genaue Grenzen](windows-passive-time-closeout.md).
|
||||
|
||||
## Passiver Windows-Zertifikatspfad — Quellenstand 2026-11-15
|
||||
|
||||
Eigener RotationStore mit geschützten CreateNew-Keydateien und atomarer
|
||||
@@ -39,18 +27,13 @@ Nur portable Logik mit synthetischen KeyFiles, keine echte TLS-Rotation oder
|
||||
LocalService-Keydateiabnahme. Originalfehler und genaue Grenzen bleiben im
|
||||
verlinkten Bericht erhalten.
|
||||
|
||||
Zusätzlich tatsächlich nativ Windows bestanden: eine ausdrücklich ausgewählte
|
||||
Keydatei-Unit im bestehenden Lib-Testbinary (ein PASS/49andere gefiltert,
|
||||
Exit0/0ignored). Geschütztes CreateNew/Flush/Reopen, öffentlicher Keyhash,
|
||||
Nichtüberschreiben, breite DACL an leerer Fixture, gehaltenes Verzeichnis und
|
||||
Hardlinkablehnung geprüft. Eigener Falle0590d96, Rohread-SHA
|
||||
`68dd458a24c2455049b7799f57e30f1e858e323fa82c578e3b962f58282b5e49`.
|
||||
Nach einem lokalen JSON-Formatfehler wurde nur das ursprüngliche beständige
|
||||
Ergebnis nachgelesen, kein zweiter Start. Eigener temporärer Testkey entfernt;
|
||||
keine Dienste/Accounts/Tokenübernahme oder permanente Dateien betroffen.
|
||||
Produktcode unverändert; dieser Administratorlauf ersetzt keinen LocalService-
|
||||
Nachweis und keine echte Renewalabnahme. Im Defaultlauf bleibt die gesonderte
|
||||
Administratorfixture bewusst `ignored`.
|
||||
Zusätzlich vorbereitet, noch nicht nativ ausgeführt: eine ausdrücklich
|
||||
auszuwählende Windows-Keydatei-Unit im bestehenden Lib-Testbinary. Sie prüft
|
||||
geschütztes CreateNew/Flush/Reopen, öffentlichen Keyhash, Nichtüberschreiben,
|
||||
breite DACL an leerer Fixture, gehaltenes Verzeichnis und Hardlinkablehnung.
|
||||
Keine Dienste/Accounts/Tokenübernahme oder permanente Dateien betroffen.
|
||||
Produktcode unverändert; ein Administratorlauf ersetzt keinen LocalService-
|
||||
Nachweis. Default-`ignored` ist hier ein ausdrücklich offenes natives Gate.
|
||||
|
||||
## Windowsfortsetzung: Nichtstart-Kern nativ qualifiziert — 2026-11-14
|
||||
|
||||
|
||||
@@ -129,8 +129,7 @@ und [FlushFileBuffers](https://learn.microsoft.com/en-us/windows/win32/api/filea
|
||||
der öffentliche Selektor übernimmt den vorhandenen
|
||||
[SQLite-WAL/FULL-Vertrag](https://www.sqlite.org/pragma.html#pragma_synchronous).
|
||||
|
||||
Historischer Vorbereitungsstand45b5337: eine weitere enge native Datei-I/O-Unit
|
||||
war **vorbereitet, nicht ausgeführt**:
|
||||
Eine weitere enge native Datei-I/O-Unit ist **vorbereitet, nicht ausgeführt**:
|
||||
`certificate_rotation::tests::protected_key_files_create_new_reopen_acl_and_hardlink_guards`.
|
||||
Sie steckt im vorhandenen Lib-Testbinary; kein zusätzliches Diagnostikbinary,
|
||||
keine Tokenübernahme, Impersonation, Dienste oder Accounts. Wegen ihrer
|
||||
@@ -164,33 +163,3 @@ Filter, Windows-GNU-Lib `--no-run`, Windows-Alltargets-Clippy mit
|
||||
`system-helper`/`-D warnings` und Workspacefmt bestanden. Noch kein neuer
|
||||
Zielaufruf. Das vorbereitete Windows-Testbinary hat SHA256
|
||||
`cd385c3b8696303220d8e601768d70ac96a6e4187a14cbac9d511162a57eee5a`.
|
||||
|
||||
Nach dem ausdrücklichen SSH-Readback-Signal des Orchestrators wurde genau diese
|
||||
Unit tatsächlich einmal auf der Windows-VM ausgeführt. Eigener Fall
|
||||
`e0590d96-7e62-4bdc-a0b1-f53e8a9a9972`, unverändertes Binary `cd385c3b…`,
|
||||
Aufruf `--ignored --exact certificate_rotation::tests::protected_key_files_create_new_reopen_acl_and_hardlink_guards --test-threads=1`.
|
||||
Ergebnis: **ein PASS, null Fehler, null ignored, 49 andere gefiltert**, Exit0,
|
||||
gemeldete Unitlaufzeit0.09s. Der vorhandene Administratorprincipal wurde im
|
||||
Test geprüft; keine Tokenübernahme oder Impersonation.
|
||||
|
||||
Damit sind der wirkliche geschützte Windows-KeyFiles-CreateNew-/Flush-/Reopen-
|
||||
Pfad, bytegleiche private Wiederöffnung, öffentlicher P-256-Keyhashvergleich,
|
||||
Nichtüberschreiben, breite leere DACL-Negativfixture, gehaltenes Verzeichnis
|
||||
und Hardlinkablehnung für diesen Principal bestanden. Die Unit entfernte ihren
|
||||
eigenen temporären Schlüssel, Hardlink und Testordner erfolgreich. Es gab keine
|
||||
Änderung an Client, SCM, Accounts, SSH-Zugang oder dauerhafter Identität. Stagingbinary und
|
||||
eigene öffentliche Ergebnisdateien bleiben geschützt im Bootstraparchiv.
|
||||
|
||||
Der private Aufrufwrapper gab das bereits auf der VM beständig gespeicherte
|
||||
Ergebnis zunächst als PowerShell-Tabelle aus; dadurch schlug ausschließlich das
|
||||
lokale JSON-Einlesen fehl. Es gab **keinen zweiten Teststart**. Ein anschließend
|
||||
streng lesender Aufruf übernahm nur die ursprüngliche eigene `result.json`.
|
||||
Geschützter lokaler Rohread:
|
||||
`devstate/windows-keyfile-fixture/e0590d96-7e62-4bdc-a0b1-f53e8a9a9972/result-read.json`,
|
||||
SHA256 `68dd458a24c2455049b7799f57e30f1e858e323fa82c578e3b962f58282b5e49`.
|
||||
Die separate lokale Acceptancequittung `acceptance.json` bindet Intent,
|
||||
Transfer, Start und diesen Originalread; SHA256
|
||||
`268e3146acfcab55022f9534509e74c80caf7b8ca246bcc5eb3c30e08cfd1383`.
|
||||
Dies bleibt eine Administrator-Fixtureabnahme; tatsächliches
|
||||
LocalService-Keyfile-I/O, Prozessabbruch und echte Zertifikatserneuerung sind
|
||||
weiter offen. Keine bestehende Plattform-/Jobqualifikation wird damit erweitert.
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
# Lesender Abschluss zweier passiver Windows-Zeitbeobachtungen
|
||||
|
||||
Der Collector `deploy/windows/passive_time_closeout.py` ist lokal vorbereitet
|
||||
und ausführbar. **Noch kein Zielaufruf oder nativer Abschlussnachweis.** Die
|
||||
V2-Profileinrichtung und ihr ausdrücklich gemeldetes Zeitfenster stehen vor
|
||||
dem Aufruf. Tunnel-/Zugangserneuerung, Profileinrichtung und Dienstwartung sind
|
||||
keine Aktionen dieses Collectors.
|
||||
|
||||
Der unabhängige Quellreview von `cc821246ccd98ee6d3dc5c1b12c7303d3010e8a7`
|
||||
fand im engen Veröffentlichungsdelta keine konkrete Regression. Der Agent hält
|
||||
pro Verbindung den ersten Vergleich je Rolle erst nach erfolgreichem eigenen
|
||||
`complete` bzw. authentifiziertem Helper-`TimeCompleted` fest. Nur der aktuelle
|
||||
Verbindungsowner schreibt beim Heartbeat. Ein verworfener Worker erhält keinen
|
||||
Publikationspfad. Die JSONs sind historische Beobachtungen, keine aktuellen
|
||||
Clockleases, Jobfreigaben oder unabhängig erneut verifizierbare Signaturpakete.
|
||||
|
||||
Auf der Windows-VM liest der Collector ausschließlich die Inhalte von
|
||||
`C:\ProgramData\RustDiscovery\state\agent-time-sample.json` und
|
||||
`helper-time-sample.json`, jeweils höchstens8192Bytes, durch gehaltene Handles.
|
||||
Singlelink, Nicht-Reparse, Dateigröße, native FileID/LastWrite und die
|
||||
SYSTEM-/Administratoren-/Agent-Service-SID-DACL werden geprüft. Die
|
||||
Verzeichnis-DACL und Dateisicherheit müssen während des Reads gleich bleiben.
|
||||
Reparse-Vorfahren werden verweigert. Keine privaten Schlüssel-, Journal- oder
|
||||
Konfigurationsinhalte werden gelesen. Kurze gehaltene Lesehandles können einen
|
||||
gleichzeitigen atomaren Reporttausch vorübergehend verweigern; der bestehende
|
||||
Publisher behält den Sample für einen späteren Heartbeat.
|
||||
|
||||
Vor und nach diesem Read werden ausschließlich öffentliche CIM-/SCM- und
|
||||
native Prozessmetadaten geprüft: beide festen Dienste Running, richtige
|
||||
Konten/Startarten/Kommandos, Agent-/Helper-PID und Geburt, tatsächlicher
|
||||
Prozessimagepfad und erwartete öffentliche Binaryhashes. Der Boot wird aus
|
||||
demselben festen CIM-LastBootUpTime-Vertrag wie im Agenten abgeleitet. Es wird
|
||||
kein Agent-, Helper-, SQLite-/Statusprobeprogramm oder IPC aufgerufen. Die
|
||||
vorhandenen streng gepinnten Bootstraptransporte werden nur lesend verwendet;
|
||||
C#-Interop enthält lediglich Query-APIs.
|
||||
|
||||
Der bestehende `time_route_context` liest davor und danach ausschließlich den
|
||||
öffentlichen registrierten Gerätekontext in einer Read-only-SQL-Transaktion
|
||||
und die feste Gateway-/Serverbootbindung. Die beiden Serverzeugen müssen
|
||||
identisch sein. Die Capabilitymenge muss exakt passiv bleiben. Beide Reports
|
||||
brauchen dieselbe positive aktuelle Serververbindungsgeneration und denselben
|
||||
aktuellen Windows-Boot; ihre Agent-PIDs müssen dem aktuellen Agentprozess
|
||||
entsprechen. Rollen, Feldschema und Datentypen sind exakt; doppelte JSONkeys
|
||||
werden bereits beim Rohparse verweigert. Verifier-UUID, Request- und
|
||||
Response-SHA256 müssen zwischen den Rollen verschieden sein.
|
||||
|
||||
Die Beobachtung muss nach der von Root belegten V2-Einrichtung und nach der
|
||||
aktuellen Agentgeburt liegen. Beobachtungs- und Dateialter sind höchstens180s;
|
||||
Publikationsverzug höchstens90s bei2s Zukunftstoleranz. Der aktuelle Windows-
|
||||
UTC-Read muss höchstens10s vom lokalen Operatorzeitpunkt abweichen. Dies sind
|
||||
Akzeptanzgrenzen für historische Daten, keine behauptete native Zeitgenauigkeit.
|
||||
Fehlende/stale Belege und ein Generationenwechsel erlauben nur neue Readversuche.
|
||||
Das Wartefenster beträgt180s; ein bereits begonnener vollständiger Readsatz
|
||||
hat zusätzlich höchstens105s Transportbudget. Ein Timeout erzeugt einen
|
||||
unvollständigen eigenen Beleg, niemals eine erfolgreiche Abnahme.
|
||||
|
||||
Lokale private Fälle entstehen unter `devstate/windows-passive-time-closeout/`.
|
||||
Rohantworten stehen vor ihrer Validierung auf dem lokalen Datenträger;
|
||||
Acceptancereceipts binden die aktuellen Native-/Serverzeugen per SHA256. Die
|
||||
Befehlsparameter für den späteren Aufruf sind die tatsächlich installierten,
|
||||
qualifizierten Agent-/Helperhashes und Roots UTC-Untergrenze nach der
|
||||
V2-Einrichtung. Keine frei wählbaren Guestpfade, Aktionen oder Abfrageprogramme.
|
||||
|
||||
**Geplant, nicht ausgeführt:**
|
||||
|
||||
```text
|
||||
python3 deploy/windows/passive_time_closeout.py collect \
|
||||
--agent-sha256 <tatsächlich-installierter-qualifizierter-SHA256> \
|
||||
--helper-sha256 <tatsächlich-installierter-qualifizierter-SHA256> \
|
||||
--profile-after <Roots-tatsächliche-V2-Einrichtung-UTC-mit-Z>
|
||||
```
|
||||
|
||||
Tatsächlich lokal ausgeführt und bestanden:
|
||||
|
||||
```text
|
||||
python3 -m py_compile deploy/windows/passive_time_closeout.py
|
||||
python3 deploy/windows/passive_time_closeout.py guards
|
||||
python3 -m unittest discover -s deploy/windows -p test_passive_time_closeout.py
|
||||
```
|
||||
|
||||
Sechs lokale Fixtures prüfen aktuelle unabhängige Rollen, falsche PID/Boot/
|
||||
Generation/Rolle/Beobachtungsfrist, gleiche Verifier-/Request-/Responsewerte,
|
||||
doppelte JSONfelder, fehlende Sicherheitsprüfung und fehlenden Helperbeleg.
|
||||
Der zusätzliche Grenzfall prüft die tatsächlichen sieben .NET- und neun
|
||||
Chrono-Nachkommastellen. Python3.10s ursprüngliches `fromisoformat` verweigert
|
||||
diese Formen; dieser konkrete lokale Fehler wurde vor jedem Zielaufruf
|
||||
behoben. UTC- und FILETIME-Grenzen werden jetzt vollständig mit Ganzzahl-
|
||||
Nanosekunden verglichen. Ein Sample genau an der Installationsuntergrenze wird
|
||||
akzeptiert, eine um1ns spätere Untergrenze verweigert dasselbe Sample. Keine
|
||||
Native- oder Testzeit wird hierfür erfunden.
|
||||
Danach lokal mit vorhandenem `/tmp/rmm-powershell-parser/pwsh` tatsächlich
|
||||
ausgeführt: vollständiger Reader-AST ohne Parserfehler und Kompilierung der
|
||||
C#-Querydefinitionen ohne Methodenaufruf bestanden. `Info` besitzt die
|
||||
erwartete52-Byte-Interopgröße. Lokale Quittung unter
|
||||
`devstate/windows-passive-time-closeout-local/receipt.json`; kein nativer
|
||||
Win32-Aufruf oder VM-Zugriff. Windows-PowerShell5.1-/tatsächliche Win32-Reads
|
||||
und echte Rollenbelege bleiben offen; lokale Prüfungen ersetzen sie nicht.
|
||||
|
||||
Der konkrete Profileinsatz wurde zusätzlich unabhängig rein im Quellcode
|
||||
geprüft (`time_profile_config.py`, SHA256
|
||||
`36f0451a146ca8dc73d4c66b48f2e65fbaefde5c7643133993d1c136cc3318de`).
|
||||
Kein konkreter Befund im geprüften Schnitt: getrennte öffentliche Source-/
|
||||
Plattform-/Key-/Bindingketten, exakte neue Rollen mit PID/Geburt/Token-/Service-
|
||||
SID/Image/FileID, SameLive-/Kernel-CAS vor und nach Veröffentlichung,
|
||||
Intent-vor-ACL/Move, überschreibungsfreier gleichvolumiger Move und ausschließlich
|
||||
ThisFolderOnly-Leserechte für die zwei Rollen. Die UTC-Untergrenze wird vor
|
||||
dem ersten privaten Fallintent aufgezeichnet. Noch ungesetzte Paarbeleg-
|
||||
Konstanten blockieren die Vorbereitung. Der konkrete spätere Rollen-/
|
||||
Readbackbinding-Delta und die tatsächliche Veröffentlichung bleiben separat
|
||||
nachzuweisen. Dieser Review ist keine Profileinrichtung oder native Abnahme.
|
||||
|
||||
Im laufenden Wartungsfenster folgte ein enger unabhängiger Quellreview des
|
||||
konkreten SCM-ETS-Fixes (Clockoperator-SHA256
|
||||
`90c2708c17903e4bc630f6655dba38ff6448251941abd53f5874e991042b0f2c`).
|
||||
Die tatsächlich gelesenen Int32-SID-Typen trugen PowerShell-ETS-Metadaten und
|
||||
wurden vom bisherigen `PSCustomObject`-Zweig als Objekt behandelt. Der Fix
|
||||
behandelt die primitiven CLR-BaseObjects zuerst und rekonstruiert reine
|
||||
JSONskalare. Stringcase und vollständige Integerwerte bleiben erhalten;
|
||||
NaN/Infinity werden verweigert. Arrayreihenfolge, Null, Keykollisions-/Tiefe-
|
||||
und Wirkungs-CAS bleiben unverändert. Keine weiteren konkreten Findings im
|
||||
geprüften Schnitt. Derselbe vollständige Comparator wurde im Profiloperator
|
||||
SHA256 `8588241eac3036e665b6010e4bf9fac1547be88d68f95b4c02cb24e425267c68`
|
||||
per reinem AST-Literalvergleich bytegleich bestätigt. Das ist ausschließlich
|
||||
Source-Review, kein Zielaufruf oder Beleg einer ausgeführten Wartung.
|
||||
|
||||
Falls Reports fehlen, können die bereits vorhandenen passiven Dateien
|
||||
`helper-probe.json` und `pipe-last-error.json` getrennt nur lesend bei der
|
||||
Pipeeingrenzung helfen. Sie enthalten keinen vollständigen Timeworkerfehler;
|
||||
auch Metadaten vorhandener fester `.agent-time.pending`/`.helper-time.pending`
|
||||
können eine unterbrochene Publikation erklären. Dieser Collector liest oder
|
||||
ändert diese zusätzlichen Dateien nicht und löst keine Diagnose aus.
|
||||
@@ -159,91 +159,3 @@ den Windowsgast weiterhin als `online`. Der Agent hatte den permanenten Server
|
||||
am 15. November 2026 um 14:06:34 MEZ kontaktiert. Die Daten wurden ausschließlich
|
||||
über `inventory.get_device` gelesen. Beleg
|
||||
`003f000e16e53ce3ff8799694e7138e014689e741f69be6577519c616aee6bab`.
|
||||
|
||||
## Neues bestätigtes Fenster: Staging und Baseline tatsächlich bestanden
|
||||
|
||||
Nach erneuter ausdrücklicher Freigabe, tatsächlicher Konsolenbestätigung beider
|
||||
ursprünglichen Dienst-PIDs und Konto-/Konfigurationsablauf15:30UTC entstand der
|
||||
neue Fall5c627d08-aff0-42a1-a922-dcf7eebccb15. Der alte0406-Stagingversuch bleibt
|
||||
unverändert als unvollständiger Versuch ohne Dienständerung erhalten.
|
||||
|
||||
Tatsächlich native Stagingprüfung bestanden: Helper5967… (bereits eigener
|
||||
Bootstraphashpfad), Agent26dc… und fester Controller
|
||||
`d808f47b5de8563e7e32d49dc5a0ad83c988c7de12cc286f1814b3a69e7e27a6`.
|
||||
Danach vollständige native Baseline ohne Timeout: Config-/PKI-/Datei-/ACLbindung
|
||||
und tatsächlicher Helper-DB-/Lock-/Intentzustand stimmen mit dem angenommenen
|
||||
ursprünglichen14fb-Beleg überein. AgentRunning5528, HelperRunning9464.
|
||||
BaselineSHA `cc876073b87086021ba449748deebff8309e06977438bb1854565f5d58cbba88`.
|
||||
Geschlossene Serverflags und Job-/Outbox-/Permitzähler unverändert.
|
||||
Bis zu diesem Beleg kein ServiceStop/Start/Swap, kein Job, kein Zeitprofil.
|
||||
Die anschließende einmalige Enterphase ist ein gesonderter noch offener Schritt.
|
||||
|
||||
## Erste Enterphase vor jeder Wirkung verweigert; Ursache nachgewiesen
|
||||
|
||||
Im Fall5c627d08… wurde Enter genau einmal aufgerufen und mit
|
||||
`Preserved identity config or ACL` verweigert. Kein erneuter Enteraufruf.
|
||||
Die feste unabhängige Originalfallnachlese bestätigt: Fallordner absent,
|
||||
active-intent absent, sämtliche Intent-/Stop-/Swap-/Startmarker absent;
|
||||
ursprüngliche Dienste weiterhinRunning5528/9464. Es gab keine Dienständerung.
|
||||
Der erste Versuch bleibt fehlgeschlagen und wird nicht nachträglich geheilt.
|
||||
|
||||
Eine frische vollständige native Baseline bestätigte alle betroffenen Werte
|
||||
semantisch exakt identisch. Der konkrete Fehler lag im bisherigen PS-`JsonEqual`:
|
||||
Er verglich JSON-Texte einschließlich Objektmemberreihenfolge. Die Python-
|
||||
kanonisch sortierte gespeicherte Baseline und die native PS-Ordered-Ausgabe
|
||||
ordnen `public_hashes`, `identity_acls` und `private_key_metadata` anders an.
|
||||
Das war ein falscher Unterschied trotz unveränderter Werte, kein ACLwechsel.
|
||||
|
||||
Der enge Quellfix normalisiert nur Objektmember für den Inhaltsvergleich;
|
||||
Arrayreihenfolge sowie Null gegenüber leeren Arrays bleiben unterschieden,
|
||||
Tiefe bleibt auf40 begrenzt. Tatsächlich fünf native In-Memory-Gegenfälle
|
||||
bestanden: umgeordnetes Objekt akzeptiert, Scalaränderung, umgekehrtes Array,
|
||||
Null gegenüber leerem Array und Null-Element gegenüber leerem Array verweigert.
|
||||
Keine Dienste, Produktdateien oder Jobs wurden vom Guard verändert. Unabhängiger
|
||||
Quellenreview läuft getrennt; noch keine neue mutierende Controllerausführung.
|
||||
|
||||
Inzwischen behebt Main656102b die passive Zeitprüfung ohne Jobopt-in. Weil das
|
||||
ursprüngliche Paar nachweislich noch unmutiert ist, wird26dc nicht mehr installiert:
|
||||
Root qualifiziert zuerst das notwendige neue Agentimage; Helper5967 bleibt
|
||||
unverändert. Danach neue feste Image-/Controllerbindung und neue Baseline vor
|
||||
**einem** tatsächlichen Paarwechsel. Der fehlgeschlagene5c-Versuch wird dabei
|
||||
weder wiederholt noch als Erfolg ausgegeben.
|
||||
|
||||
## JsonEqual-Korrektur eng geprüft und nativ belegt
|
||||
|
||||
Der unabhängige Quellenreview fand im ersten Normalisierer einen zusätzlichen
|
||||
Randfehler: ein case-sensitives IDictionary mit `A` und `a` hätte beim Kopieren
|
||||
in eine case-insensitive OrderedDictionary einen Wert verlieren können. Beide
|
||||
Objektzweige verweigern nun vor dem Einfügen Nichtstringkeys oder bereits
|
||||
vorhandene kollidierende Namen. Bestehende feste Native-State-DTOs erzeugen
|
||||
solche Kollisionen nicht; der zusätzliche Pfad ist trotzdem geschlossen.
|
||||
|
||||
Unabhängiger enger Re-review der Quelle
|
||||
`4ef8c6787fd3defdd8416401b3b40dd63be0e3afffc195736eed0ce350286201`
|
||||
ohne weiteren konkreten Befund. Nativ anschließend sechs feste In-Memory-Guards
|
||||
bestanden: ursprüngliche fünf Fälle plus case-kollidierendes
|
||||
`Dictionary(StringComparer.Ordinal)` wird verweigert. ResultSHA
|
||||
`2429b869792854ac799c403422e26561df2b2c5310b408e6a7287751129c2a94`
|
||||
im erhaltenen5c-Fall, `comparison-collision-guard-result.json`.
|
||||
Pythoncompile und bestehende Quellguards ebenfalls PASS. Kein Service-/Datei-/
|
||||
Jobeffekt und weiterhin keine26dc-Installation. Der folgende Agentkandidat wird
|
||||
separat durch Root qualifiziert; Controller-/Payloadbindung und neuer echter
|
||||
Baselinebeleg werden erst mit dessen endgültigem Artefakt erzeugt.
|
||||
|
||||
## Ein Austausch mit passiver Zeitprüfung
|
||||
|
||||
Nach der Verweigerung vor dem ersten Dienststopp wurde der ursprüngliche
|
||||
202-Dateien-Quellstand erneut gegen sein Manifest geprüft. Nur drei Quellen
|
||||
haben sich für den Installationskandidaten geändert: Zeitabfrage im Agenten,
|
||||
Auswahl des Abfrageintervalls und Schreiben der zwei historischen
|
||||
Dienstbelege. Die Änderungen kommen aus den Commits `656102b` und `cc82124`.
|
||||
Das Manifest dieser 202 Inputs hat den SHA-256-Wert
|
||||
`11717fab51bd1d6bf103b1821cc1e2a84699f46cac21f2cc614acf4b68381fa4`.
|
||||
Der isolierte Offline-Releasebuild für AMD64 ergab das Agentbild
|
||||
`0549d9ebea73cff996938f859b92192cc333de194128d7c6859a3f1d2e85893c`.
|
||||
Für den Helper wird das bereits qualifizierte Image `59675a3c…` verwendet.
|
||||
Der Agent-Zwischenbuild `34b7458d…` wurde nicht installiert.
|
||||
|
||||
Die neun gezielten Zeitprüfungen aus diesem konkreten Quellstand bestanden auf
|
||||
der Cloud-Linux-VM als UID 65534, Exit 0. SHA-256 der Ergebnisquittung
|
||||
`333f8d2dba3b35dcd79faafd8faf5c88da321942c9672c0a80f1f2c8fceb24a3`.
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
# Erste öffentliche Windows-Zeitkonfiguration V2
|
||||
|
||||
Stand 2026-11-15: Der reale Paarfall `4887940a-4c9c-4807-aaf2-6fbc94faad46`
|
||||
ist nach abgeschlossener unabhängiger Nachlese gebunden (Result `2898a72b…`,
|
||||
Originalintent `40e9cd55…`, separater Read `63e453fb…`). Die vorherige
|
||||
Verweigerung mit fehlenden Rollenbelegen bleibt als historischer lokaler Test
|
||||
nachgewiesen. Ein Zeitvertrauen oder durchgehende Heartbeats sind durch den
|
||||
Paarabschluss ausdrücklich nicht bewiesen.
|
||||
|
||||
Der Operator prüft die unveränderten öffentlichen Vorbereitungsbelege
|
||||
`c3077acf-12da-410e-9f55-e75a1cd0a75f`, deren getrennten Ed25519-Zeitschlüssel,
|
||||
Gerätebindung und tatsächlich gelesene KVM-Plattform. Die ursprüngliche
|
||||
Vorbereitung bleibt mit `roles_qualified=false` unverändert. Die akzeptierte
|
||||
Betriebsannahme ist ausdrücklich
|
||||
`active_guest_no_pause_save_restore_snapshot_migration_host_suspend`; das ist
|
||||
keine physikalische Kalibrierung und keine automatische Überwachung dieser
|
||||
Betriebsannahme.
|
||||
|
||||
Der neue Agent ist an SHA256
|
||||
`0549d9ebea73cff996938f859b92192cc333de194128d7c6859a3f1d2e85893c`
|
||||
und Buildreceipt `f04024f78c2f11f5c66bbdf9278467f5bcc50da5c2bd7336623851bca42dd446`
|
||||
gebunden. Seine 202 Quellinputs sind durch `11717fab…` fixiert; das tatsächlich
|
||||
erweiterte Zeitmodul hat SHA256 `342494c4…`. Gegen die ursprüngliche Quelle
|
||||
`d8594c1e…` kamen die passive Sampling-Auswahl und deren neunte Prüfung hinzu.
|
||||
Der Helper bleibt `59675a3c…`, aus dem ursprünglichen Linkbeleg `04ed34e6…`
|
||||
und Quellbeleg `96b05fe1…`. Diese unterschiedlichen Provenienzen werden nicht
|
||||
gleichgesetzt. Der tatsächliche neue Paar-Payload verwendet für
|
||||
`qualification_sha256` und `manifest_sha256` jeweils den neuen Beleg `f04024f7…`;
|
||||
der alte Helper-Quellbeleg ist kein Ersatz dafür.
|
||||
|
||||
Bevor ein Fall erstellt werden kann, müssen ein abgeschlossener passiver
|
||||
Paarwechsel und unabhängig fixierte Originalbelege vorliegen. Für beide Rollen
|
||||
werden SCM-Status, PID, Kernel-Prozessgeburt, tatsächliches Konto, aktivierte
|
||||
Service-SID, gehaltener Prozesshandle, Imagepfad, Imagehash und native FileID
|
||||
verknüpft. Die alten numerischen 601-Proben bleiben ausdrücklich rohe
|
||||
Voraussetzungsbelege; sie qualifizieren kein Produktimage. Der Producer erzeugt
|
||||
öffentliche Rollen- und Plattformbelege und daraus das vorhandene strikte
|
||||
V2-Format mit genau beiden Rollen. Er behauptet weder signierte Laufzeitprüfung
|
||||
noch physikalische Genauigkeit. Fehlende oder widersprüchliche Belege sperren.
|
||||
|
||||
## Geplanter Ablauf nach neuem realem Paar-Readback
|
||||
|
||||
Die folgenden Phasen sind **vorbereitet, nicht auf dem Ziel ausgeführt**:
|
||||
|
||||
1. Root bestätigt Original-Paarfall und Originalbeleg-Hashes; diese werden als
|
||||
konkrete Quellenkonstanten gebunden und nochmals geprüft.
|
||||
2. `prepare` liest ausschließlich öffentliche lokale Belege und erzeugt einen
|
||||
privaten, einmaligen Fall. `stage --case <id>` überträgt ausschließlich den
|
||||
fixierten Controller über den bestehenden bestätigten SSH-Transport.
|
||||
3. `install --case <id>` darf genau eine bisher fehlende feste öffentliche Datei
|
||||
veröffentlichen. Bereits vorhandene Datei, aktiver Marker oder Teilfall
|
||||
verweigern einen neuen Installationsversuch. Ein verlorener Antwortweg führt
|
||||
ausschließlich zu `read --case <id>`, nicht zu Wiederholung oder Rollback.
|
||||
4. Root liest den ursprünglichen Fall separat und prüft danach die echten
|
||||
passiven Agent-/Helper-Zeitbelege. Eine erfolgreiche Veröffentlichung allein
|
||||
setzt `clock_runtime_qualified` ausdrücklich nicht auf true.
|
||||
|
||||
## Begrenzte Wirkung und Erhaltungsnachweis
|
||||
|
||||
Der Controller verwendet ausschließlich die vorhandenen lesenden SCM-,
|
||||
Kernel-, FileID-, PKI-Metadaten- und Journalzeugen. Er importiert keine alten
|
||||
Stop-/Start-/Swap-/Repair-Phasen. Die aktuelle Prozessgeneration, beide Images,
|
||||
vier Code-/Policydateien, Konfiguration, Geräteidentität, Zertifikat,
|
||||
Schlüsselmetadaten, Telemetrieidentität, Sequenzmonotonie und leere
|
||||
Job-/Helper-Intents werden vor, während und nach der Veröffentlichung geprüft.
|
||||
Der private Schlüssel wird weder gelesen noch gehasht.
|
||||
|
||||
Eine neue private Bootstrap-Falldirectory wird nativ exklusiv mit geschützter
|
||||
SYSTEM-/Administrators-DACL angelegt. Alle Originalmarker werden create-only
|
||||
geschrieben und geflusht. Nur der öffentliche Helper-Stamm erhält bei Bedarf
|
||||
fehlende `0x001200a9`-Leserechte für beide **Service-SIDs**, ausschließlich für
|
||||
diesen Ordner, ohne Vererbung auf State/PKI/Ledger. Fremde oder weiter gehende
|
||||
Service-Rechte werden verweigert. Die Kandidatdatei erhält vor Veröffentlichung
|
||||
SYSTEM/Administrators-Vollzugriff und dieselben begrenzten Leser. Die feste
|
||||
Zieldatei wird nach durablem Publish-Intent mit einem gleichvolumigen,
|
||||
überschreibungsfreien Move veröffentlicht; anschließend müssen FileID, Hash
|
||||
und DACL unverändert sein. Keine allgemeine Stromausfall-Atomizität wird daraus
|
||||
abgeleitet. Teilzustände bleiben im Originalfall lesbar, ohne automatische
|
||||
Reparatur oder Rechte-Rücksetzung.
|
||||
|
||||
Unmittelbar vor der ersten Erstellung wird `install_not_before` aus der
|
||||
nativen VM-UTC gelesen und im ursprünglichen Intent sowie Ergebnis erhalten.
|
||||
Das ist eine Herkunftsuntergrenze für die nachfolgende separate Nachlese und
|
||||
den passiven Collector, keine eigenständige Uhrvertrauensbehauptung.
|
||||
|
||||
## Laden und tatsächliche Grenzen
|
||||
|
||||
Das vorhandene `signed_clock::native::SignedClock::open` lädt bei jedem Öffnen
|
||||
geschützte Settings, beweist den eigenen Dienstprozess und öffnet den festen
|
||||
Stamm sowie die maximal 16384 Byte große Datei über `PinnedFile`. Besitzer
|
||||
müssen SYSTEM/Administrators bleiben; zusätzliche Leser dürfen nur die
|
||||
festgelegte Lesemaske besitzen. Beide Images müssen zu den Settings passen.
|
||||
Die Prüfung bindet Dateiinhalt und FileID; spätere Rechecks öffnen denselben
|
||||
Namen erneut und verwerfen Austausch oder Änderungen. Fehlerhaft beobachtete
|
||||
Konfigurationen oder fehlgeschlagene Reads stellen alte Autorität nicht wieder
|
||||
her; geänderte Bytes derselben Generation gelten als Fork.
|
||||
|
||||
Im neuen Agenten versucht die passive Heartbeat-Schleife das Setup bei bisher
|
||||
fehlendem Profil erneut. Ein erster Pin benötigt daher nach Quellenvertrag
|
||||
keinen Dienstneustart. Das ist **noch kein VM-Nachweis**. Der Agent schreibt erst
|
||||
nach tatsächlich erfolgreichem `complete` pro Verbindung öffentliche historische
|
||||
`agent-time-sample.json` und `helper-time-sample.json` in sein bestehendes
|
||||
geschütztes State-Verzeichnis. Der Helper-State bleibt unverändert. Root muss
|
||||
diese Originalbelege noch für die tatsächlich installierten Rollen und
|
||||
Konfigurationsbytes prüfen. Ein Statusfile ersetzt kein aktuelles Job-Startgate.
|
||||
|
||||
## Tatsächlich lokal ausgeführt
|
||||
|
||||
- Python-Syntaxprüfung und geschlossene Sourceguards: PASS.
|
||||
- Sechs lokale Vertragsfälle: PASS. Sie prüfen die reinen Referenzbytes,
|
||||
fehlende Paarbelege, falsche Rollen/Images/Geburt/SID/FileID/Policy/Identität,
|
||||
create-only, begrenztes Lesen, Symlink- und Duplicate-JSON-Verweigerung.
|
||||
Positive In-Memory-Fixtures sind ausdrücklich keine native Qualifikation.
|
||||
- Beide erzeugten PowerShell-ASTs mit vorhandenem lokalem Parser: PASS.
|
||||
- Lokale ETS-Integer-/Bool-/String-Reproduktion sowie Objekt-/Arrayreihenfolge:
|
||||
PASS. Der unveränderte Vergleich aus `e6debe5` war unter Windows PowerShell 5
|
||||
unzureichend: ETS-verpacktes `System.Int32=1` konnte im Objektzweig zu `{}`
|
||||
werden. Der exakt übernommene Comparator aus der getrennt geprüften
|
||||
Clockquelle `90c2708c…` rekonstruiert CLR-Skalare vor dem Objektzweig als
|
||||
unadornierte Werte. Der Clockoperator hat diesen Vergleich außerdem tatsächlich
|
||||
gegen den vollständigen alten Livezustand und ETS-Positiv-/Negativfälle
|
||||
geprüft (`82c4ebe7…`). Das ist kein Profilinstallationsnachweis.
|
||||
- Die festgehaltenen öffentlichen Eingänge, rohen Rollenbelege und realen
|
||||
Quell-/Buildbelege werden vom Operator lokal erfolgreich gelesen. Die durch
|
||||
Root tatsächlich ausgeführten neun Linux- und neun Windows-Zeitmodulprüfungen
|
||||
sind über deren Originalbeleg-Hashes und exakte Testnamen angebunden.
|
||||
- `prepare` ohne reale Paarbelege: erwartete Verweigerung ohne angelegten Fall.
|
||||
|
||||
Im ursprünglichen lokalen Quellprüfstand noch nicht ausgeführt: Übertragung,
|
||||
ACL-Änderung, Konfigurationsinstallation,
|
||||
Produktdienst-Laden/Reopen auf der VM, signierte passive Laufzeitabnahme,
|
||||
WebUI-Genehmigung oder RMM-Job. Der damalige Transportausfall nach Notebook-Suspend war später im
|
||||
bestätigten Wartungsfenster behoben. Der vorbereitete Fall `570c7a86…` bleibt
|
||||
unverändert ohne neue Rollenbelege; der tatsächliche neue Paarbeleg ist4887.
|
||||
|
||||
## Tatsächlicher gebundener Vorbereitungsschritt und Transfer
|
||||
|
||||
Lokale Vorbereitung `ad9fd154-b2be-4f5d-9e17-65abb721ceaf` bestanden;
|
||||
Config-SHA256 `2b4a8a7080770304b80e2a665fa5f5ee1ebbd9182e7c80b184e75b114575b42b`,
|
||||
Manifest `0c9a3ffeed490757f7bd8c63d7e2ec28156212945094621f511e20679ce0b3b0`.
|
||||
Der getrennte Bindungsreview des Operators `a8d55b60…` hat bestanden.
|
||||
Erste tatsächliche Transferphase begann nach `2026-11-15T15:27:41Z`.
|
||||
Der fixierte Controller wurde einmalig übertragen und separat hashgeprüft;
|
||||
Originalantwort `stage-reply.json` im genannten privaten lokalen Fall,
|
||||
SHA256 `29f7654f766ebb53045832bb8c5ed6c83d2cbd96e0a5e1ce6df494cef0c026e6`.
|
||||
Noch kein Konfigurationsinstallations- oder Laufzeitnachweis aus diesem Schritt.
|
||||
|
||||
## Tatsächliche Installation: Teilzustand, nicht abgeschlossen
|
||||
|
||||
Der einmalige Installationsaufruf begann nach `2026-11-15T15:28:18Z`.
|
||||
Die VM hielt vor der ersten Erstellung die Originaluntergrenze
|
||||
`2026-11-15T15:28:24.1309868Z` im Intent fest. Der Bootstrap endete mit
|
||||
`IOException` an Controllerzeile294, dem einzigen
|
||||
`[IO.File]::Move($staged,$target)`. Der ursprüngliche sichere Fehlerbeleg
|
||||
`windows-client/system-pipe-upgrade/remote-error-b01d395c-9141-4bc6-ad70-1b67fb936881.json`
|
||||
enthält Exit1, Fehlerklasse und Zeile, keinen privaten Fehlertext. Die genaue
|
||||
I/O-Ursache ist damit noch nicht geklärt; es wird kein Sharing-/ACL- oder
|
||||
Antivirusproblem als bewiesen ausgegeben. Es gab keinen zweiten Installversuch.
|
||||
|
||||
Ein eigener ausschließlich lesender Originalaufruf begann nach
|
||||
`2026-11-15T15:28:37Z` und bestand. Originalantwort im privaten Fall
|
||||
`ad9fd154-b2be-4f5d-9e17-65abb721ceaf`:
|
||||
`read-51eea530-4155-42d7-9053-1008e84059b6-reply.json`, SHA256
|
||||
`93143fc05e7c814e9b164cd322abd411eee0dedcb485fbb5547a1db8f1975cd2`.
|
||||
Die feste Zieldatei ist **nicht vorhanden**. Der ursprüngliche Intent, aktive
|
||||
NoRetry-Marker, Directory-ACL-Intent und dessen Abschluss sowie der
|
||||
Publish-Intent sind vorhanden; ein `result.json` fehlt. Die nur für diesen
|
||||
Ordner erlaubten Service-Leserechte wurden somit gesetzt, die Konfiguration
|
||||
wurde nicht veröffentlicht. Originale FileIDs/Hashes/PKI-Metadaten, laufende
|
||||
Agent-/Helper-Prozessgenerationen, Jobfreiheit und Journalzeugen bestanden die
|
||||
lesende Erhaltungsprüfung.
|
||||
|
||||
Der Teilzustand bleibt unverändert; kein Retry, Rollback, Dienstwechsel oder
|
||||
RMM-Job wurde ausgeführt. Der passive Zeit-Collector wurde ausdrücklich
|
||||
**nicht** gestartet. `clock_runtime_qualified=false` bleibt bestehen. Nach dem
|
||||
bestätigten Wartungsfenster bis15:30UTC erfolgen keine weiteren VM-Aufrufe.
|
||||
Die gesonderte serverseitige `agent.update`-Inventar-Constraintkorrektur und
|
||||
anschließend frische Heartbeats/ACKs sowie echte signierte Zeitbelege bleiben
|
||||
getrennt zu prüfen. Eine spätere Fortsetzung benötigt zuerst eine lesende
|
||||
Ursachenklärung und einen konkret geprüften Vertrag für den ursprünglichen
|
||||
Teilfall; ein neuer Fall darf diesen Marker nicht umgehen.
|
||||
@@ -104,47 +104,3 @@ und ersetzt diese Bindung nicht. Nach der getrennten passiven Paarwartung dürfe
|
||||
die tatsächlichen neuen LocalService-/SYSTEM-Kernel-/Servicebelege mit vorhandenen
|
||||
Source-, Rawcapture- und Plattformbelegen verbunden werden. Erst danach wird die
|
||||
echte V2-Konfiguration erstellt; Runtimefrische und Genehmigungen folgen getrennt.
|
||||
|
||||
## Zeitprüfung bei ausgeschalteten Jobs am 15. November 2026
|
||||
|
||||
Die Konsole der laufenden VM bestätigte, dass weder der Jobschalter noch die
|
||||
Jobbindung konfiguriert waren. Die Zeitprofildatei war noch nicht installiert.
|
||||
Die bisherige Runtime übersprang bei ausgeschalteten Jobs auch den gesamten
|
||||
signierten Zeitvergleich. Damit konnte die geplante Rollenprüfung über diesen
|
||||
passiven Dienststand nicht beginnen.
|
||||
|
||||
Im neuen Quellstand prüft der Agent am Heartbeat, ob das geschützte Zeitprofil
|
||||
vorliegt. Erst dann beginnen Agent und Helper den vorhandenen Vergleich mit
|
||||
eigenen Challenges. Für den passiven Betrieb beträgt die Pause zwischen
|
||||
Vergleichen pro Rolle 30 Sekunden. Die Datei allein belegt keine Zeitqualität.
|
||||
Beide Rollen prüfen Pin, Gerätebindung, Signatur und Fristen. Der Jobschalter,
|
||||
die JobClock und die Genehmigung bleiben getrennt. Ein Fehler beim Start des
|
||||
passiven Vergleichs lässt Heartbeats und Inventar weiterlaufen.
|
||||
|
||||
Neun gezielte Prüfungen bestanden erst lokal und dann auf der Cloud-Linux-VM
|
||||
als UID 65534 (Exit 0, 15 weitere Tests gefiltert, Ergebnis-SHA-256
|
||||
`3424b0f916f0c9e68ed24d8ee0adeeb5feb5e8e834f63cfcbaadc5e45b06f840`).
|
||||
Die neue Prüfung umfasst Profilauswahl und Abfrageintervall. Der Windows-Crossbuild
|
||||
der Librarytests und Clippy mit allen Windows-Targets und `system-helper`
|
||||
bestanden. Die installierten Dienstbinärdateien haben eigene Versionsnachweise.
|
||||
|
||||
Dieselben neun Tests liefen danach aus dem gebauten Windows-Testbinary auf der
|
||||
Windows-11-VM. Die Namensliste der bestandenen Tests stimmte mit der auf der
|
||||
Cloud-Linux-VM überein. Ergebnis: AMD64, Exit 0, neun bestanden, null
|
||||
fehlgeschlagen oder übersprungen, 42 weitere gefiltert. Quittung
|
||||
`39c76e698f5dd351096d1deed40cddbcc1a6677f93457b48ad4a4c3cedb36e88`.
|
||||
Der native Testprozess prüfte die Logik mit Testdaten. Der signierte
|
||||
Zeitvergleich in den beiden installierten Dienstprozessen ist eine eigene
|
||||
offene Abnahme.
|
||||
|
||||
Für den Nachweis aus den laufenden Diensten hält der Agent je passiver Verbindung
|
||||
den ersten vollständig geprüften Zeitvergleich pro Rolle fest. Im Agent-State
|
||||
entstehen `agent-time-sample.json` und `helper-time-sample.json`. Die
|
||||
SYSTEM-Beobachtung setzt die authentifizierte positive Antwort des Helpers auf
|
||||
`TimeComplete` voraus. Beide Belege enthalten Rolle, Agent-PID, Windows-Boot,
|
||||
Verbindungsgeneration, Verifier-Inkarnation, Beobachtungszeit und die SHA-256-Werte
|
||||
der Anfrage und der empfangenen Antwort. Der Agent veröffentlicht sie beim
|
||||
Heartbeat aus dem Zustand der jeweiligen Verbindung. Diese historischen Daten
|
||||
werden bei der Jobfreigabe und der Prüfung der aktuellen Zeit nie eingelesen.
|
||||
Der erweiterte Code bestand den Windows-Alltargets-Clippycheck. Die tatsächlichen
|
||||
Belegdateien der installierten Rollen stehen noch aus.
|
||||
|
||||
Reference in New Issue
Block a user