Merge commit '44f65c205b1db0849654bb4e38ff766d491e90b2'
Rust development slice / linux (push) Failing after 6s

This commit is contained in:
2026-11-15 15:52:04 +01:00
4 changed files with 399 additions and 0 deletions
+243
View File
@@ -0,0 +1,243 @@
#!/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}')
# 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 and value.endswith('Z'), 'UTC_TIMESTAMP_REQUIRED')
result = dt.datetime.fromisoformat(value[:-1] + '+00:00')
return result
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 dt.datetime(1601, 1, 1, tzinfo=dt.timezone.utc) + dt.timedelta(microseconds=int(value) // 10)
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 - observed_now).total_seconds()) <= 10, '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 + dt.timedelta(seconds=2) and birth <= observed, 'SAMPLE_CURRENT_INSTALL_WINDOW')
need(0 <= (now - modified).total_seconds() <= 180 and 0 <= (now - observed).total_seconds() <= 180, 'SAMPLE_FILE_AGE')
need(-2 <= (modified - observed).total_seconds() <= 90, '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 <= (dt.datetime.now(dt.timezone.utc) - since).total_seconds() <= 600, '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)
@@ -0,0 +1,54 @@
"""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 = 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)
if __name__=='__main__':unittest.main()
+10
View File
@@ -1,5 +1,15 @@
# 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 fünf Bindingfixtures bestanden. **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
+92
View File
@@ -0,0 +1,92 @@
# 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
```
Fünf 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.
PowerShell-/C#-Nativeparse und echte Rollenbelege bleiben offen; lokale
Pythonprüfungen ersetzen sie nicht.
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.