diff --git a/deploy/windows/CLIENT.md b/deploy/windows/CLIENT.md index d832893..afedb9b 100644 --- a/deploy/windows/CLIENT.md +++ b/deploy/windows/CLIENT.md @@ -4,6 +4,34 @@ Stand 2026-11-13, Spezifikation 1.15. Windows-11-Gast und Notebook-Host sind verschiedene Geräte. Auf dem Notebook laufen ausschließlich Entwicklungstools; der Client verwendet den endgültigen Cloudserver `discovery.ease-technologies.de`. +## Automatischer WSS→HTTPS-Fallback nativ bestanden — 2026-11-13 + +Eigener Fall `2ff2e1aa-0037-4831-9bc2-31218bf1461c` auf derselben bestehenden +Windows-Identität unter LocalService. Nur der eigene Agenttransport wurde +versioniert auf `auto` gestellt. Zunächst zwei frische WSS-Heartbeats; +dann exakt gerätegebundene, zehn Minuten gültige dev/test-Störung. +Zwei tatsächliche mTLS-authentisierte HTTP503 bei WSS, mit unterschiedlichen +Handshake-IDs und den festen Slots1/2, Zertifikatsfingerprint und Config-Hash. +Der Agent wechselte selbst zu HTTPS; zwei frische HTTPS-Heartbeats und konkreter +Inventar-ACK nach beiden Verweigerungen tatsächlich gespeichert. + +Gleiche Agent-/Asset-/Enrollment-/Zuordnungsversion und Dateien/ACLs, monotone +Sequenz, TenantB weiter verweigert. Kein neuer RMM-Job: Windows vor/nach +0Jobs/0Outbox/0Grants/0offen; Linux unverändert30/30/26/0. Zentrale Rootpolicy +unverändert. Beide realen Serverrollen danach mit Faultflagfalse und ohne +konfigurierten Fault-Dateipfad; exakte ursprüngliche WSS-Konfigurationsbytes und +ACLs auf Windows restauriert, wieder zwei frische WSS-Heartbeats/ACK0. +Dies ist keine Behauptung eines automatischen HTTPS→WSS-Switchbacks: Rückkehr +folgte aus der ausdrücklichen operativen Wiederherstellung der Konfiguration. + +Ausgeführt: `python3 deploy/windows/auto_transport_acceptance.py start +--https-case 3c60e1a8-7ab7-4720-8b1a-f89f4f0d7458`. +Sechs gezielte lokale Guards ergänzen den nativen Nachweis; kein neuer +Clientbuild und keine Windows-Syncbereitschaft erfunden. Geschützt: +`devstate/windows-client/auto-transport/2ff2e1aa-0037-4831-9bc2-31218bf1461c/result.json`, +verifiziert. Aktueller Dienst nach dieser Abnahme wieder mit ursprünglichem WSS; +eine dauerhafte Defaultumstellung ist ein eigener dokumentierter Schritt. + ## TLS-Negativfälle auf Windows nativ bestanden — 2026-11-13 Feste getrennte Fixture `7b190a5c-c928-4348-bd0d-c9698dad5417`, Schlüssel auf @@ -62,7 +90,7 @@ Der Runner verwendet einen per Hash und SFTP gepinnten Bootstrap-PowerShellcode; prozessbezogenes RemoteSigned ändert keine Maschinen-/Gruppenrichtlinie und keine RMM-Jobausführung. Sieben gezielte lokale Runner-Guards und drei PowerShell-Parserprüfungen bestanden; kein neuer Clientbuild für diese Abnahme. -TLS-Negativfälle sind oben separat abgenommen; automatischer Fallback folgt getrennt. +TLS-Negativfälle und automatischer Fallback sind oben separat nativ abgenommen. PowerShell-Jobs bleiben bis zu [ihren Voraussetzungen](../../docs/windows-job-boundary.md) gesperrt. Die folgenden Erstnachweise bleiben historisch erhalten. @@ -144,8 +172,8 @@ Strecke ausschließlich passive Standardbeobachtungen verarbeitet. Dieser erste Entwicklungsbuild ist **unsigniert**. Kein produktiver signierter Installer/MSVC-Supportnachweis, keine Zertifikatsrotations-/Widerrufs-/Proxy- oder -Windows-Paket-/Dienstaktionsabnahme. Der erste native Onlinenachweis verwendete WSS. Explizites HTTPS ist inzwischen -oben separat nativ abgenommen; automatischer Fallback folgt gesondert. Die passive SCM-/Enrollment-/mTLS-/Inventar-/Mandantentrennungsstrecke sowie +Windows-Paket-/Dienstaktionsabnahme. Der erste native Onlinenachweis verwendete WSS. Explizites HTTPS und automatischer Fallback sind inzwischen oben separat nativ +abgenommen. Die passive SCM-/Enrollment-/mTLS-/Inventar-/Mandantentrennungsstrecke sowie die oben benannten nativen Tests sind nun tatsächlich getrennt belegt. Dies ist keine vollständige Windows-/Linux-MVP-Abnahme. diff --git a/deploy/windows/auto_transport_acceptance.py b/deploy/windows/auto_transport_acceptance.py new file mode 100644 index 0000000..9b227ac --- /dev/null +++ b/deploy/windows/auto_transport_acceptance.py @@ -0,0 +1,259 @@ +#!/usr/bin/env python3 +"""Passive Windows auto-WSS→HTTPS with two exact authenticated rejections. + +Reuses the qualified Windows preservation primitive and existing dev/test +server fault. No job, direct approval, new identity or guest reboot exists here. +""" +import argparse +import datetime as dt +import hashlib +import json +import os +from pathlib import Path +import time +import uuid + +import transport_acceptance as base +import cloud_transport_acceptance as fault + +cloud = base.cloud +require = base.require +STATE = base.cb.EVIDENCE/'auto-transport' +PRIOR_CASE = '697b19ba-e7ff-4ebf-8a45-f5a0b0514fea' + + +def server_state(payload): + """Only fixed nonsecret flags and known file hashes; no complete env.""" + root = Path('/opt/rust-discovery'); compose = root/'deploy/server.compose.yaml' + selected = root/'devstate/root-policy/transport-fault.json' + require(not compose.is_symlink() and not selected.is_symlink(), 'fixed transport metadata paths') + command = ['docker','compose','--env-file',str(root/'devstate/.env'),'-f',str(compose)] + flags = ('RMM_PROFILE','RMM_DEV_AUTH','RMM_DEV_TRANSPORT_FAULTS','RMM_DEV_TRANSPORT_FAULT_FILE') + roles = {} + for role in ('api','gateway'): + identifier = subprocess.run(command+['ps','-q',role],capture_output=True,check=True,timeout=10).stdout.decode().strip() + require(len(identifier) == 64 and all(c in '0123456789abcdef' for c in identifier), 'one running application role') + values = {} + for flag in flags: + response = subprocess.run(['docker','exec',identifier,'printenv',flag],capture_output=True,timeout=10) + require(response.returncode in (0,1) and len(response.stdout) <= 1024, 'bounded explicit nonsecret flag') + values[flag] = response.stdout.decode().strip() if response.returncode == 0 else None + roles[role] = values + policy = root/'devstate/root-policy/policy.json' + require(not policy.is_symlink(), 'known Root policy path') + return dict(compose_sha256=hashlib.sha256(compose.read_bytes()).hexdigest(), + fault_config_sha256=hashlib.sha256(selected.read_bytes()).hexdigest() if selected.exists() else None, + root_policy_sha256=hashlib.sha256(policy.read_bytes()).hexdigest(),roles=roles) + + +def flags_disabled(value): + return len(value['roles']) == 2 and all( + role['RMM_PROFILE'] == 'development' and role['RMM_DEV_AUTH'] == 'true' + and role['RMM_DEV_TRANSPORT_FAULTS'] in (None,'false') + and role['RMM_DEV_TRANSPORT_FAULT_FILE'] is None for role in value['roles'].values()) + + +def flags_enabled(value): + return len(value['roles']) == 2 and all( + role['RMM_PROFILE'] == 'development' and role['RMM_DEV_AUTH'] == 'true' + and role['RMM_DEV_TRANSPORT_FAULTS'] == 'true' + and role['RMM_DEV_TRANSPORT_FAULT_FILE'] == '/root-policy/transport-fault.json' for role in value['roles'].values()) + + +def scopes(): + linux = base.cb.contract.protected_json(cloud.ROOT/'devstate/cloud-mvp-final-closeout.json') + require(linux['verified'] is True, 'qualified Linux target witness') + return dict(windows=base.gate(),linux=cloud.bootstrap.rpc('server.conf',cloud.server, + dict(kind='gate',tenant_id=linux['target']['tenant_id'],agent_id=linux['target']['agent_id']))) + + +def status(): + return cloud.bootstrap.rpc('server.conf',server_state,{}) + + +def observe(ident): + return cloud.bootstrap.rpc('server.conf',fault.server_evidence, + dict(tenant_id=cloud.TENANT,agent_id=base.AGENT,fault_id=ident)) + + +def validate_receipts(value, config, config_sha, baseline): + receipts = value['receipts']; device = value['device'] + require(len(receipts) == 2 and {r['data']['slot'] for r in receipts} == {1,2} + and len({r['data']['handshake_id'] for r in receipts}) == 2, 'two distinct actual authenticated WSS rejections') + require(all(r['data']['status'] == 503 and r['data']['agent_id'] == base.AGENT + and r['data']['tenant_id'] == cloud.TENANT and r['data']['fault_id'] == config['fault_id'] + and r['data']['config_sha256'] == config_sha and r['data']['testsimulation'] is True + and r['data']['certificate_sha256'] == baseline['certificate_sha256'] for r in receipts), + 'same exact dev/test fault, original authenticated device and configuration') + require(all(device[k] == baseline[k] for k in ('agent_id','asset_id','enrollment_generation','assignment_version','certificate_sha256')), + 'same retained Windows identity and assignment') + require(device['transport'] == 'https' and device['last_contact_at'] + and base.cb.contract.timestamp(device['last_contact_at']) > max(base.cb.contract.timestamp(r['created_at']) for r in receipts), + 'actual HTTPS heartbeat after both WSS rejections') + + +def wait_fallback(ident, config, digest, baseline): + deadline = time.monotonic()+150; first = None + while True: + observed = observe(ident) + device = observed.get('device') or {} + if (len(observed['receipts']) == 2 and device.get('transport') == 'https' + and device.get('last_contact_at') and base.cb.contract.timestamp(device['last_contact_at']) + > max(base.cb.contract.timestamp(r['created_at']) for r in observed['receipts'])): + validate_receipts(observed,config,digest,baseline) + if first is None: + first = observed + elif first['device']['last_contact_at'] != observed['device']['last_contact_at']: + return dict(first=first,second=observed) + require(time.monotonic() < deadline, 'two actual WSS503 and two fresh HTTPS heartbeats not proven') + time.sleep(2) + + +def prior_hash(): + folder = cloud.ROOT/'devstate/cloud-transport'/PRIOR_CASE + complete = base.cb.contract.protected_json(folder/'completion.json') + previous = base.cb.contract.protected_json(folder/'checkpoint.json') + require(complete['verified'] is True and previous['id'] == PRIOR_CASE + and previous['disabled']['deployed'] and previous['disabled']['enabled'] is False, + 'actual closed historical Linux fault witness') + raw = json.dumps(previous['config'],separators=(',',':')).encode() + digest = hashlib.sha256(raw).hexdigest() + require(digest == previous['disabled']['config_sha256'] == previous['enabled']['config_sha256'], + 'independently known original fault configuration; never adopt a host hash') + return digest + + +def cleanup(folder, intent, before): + ident = intent['id']; current = status() + require(current['compose_sha256'] == before['server']['compose_sha256'] + and current['root_policy_sha256'] == before['server']['root_policy_sha256'], 'application config and closed Root policy unchanged') + if (folder/'enable-intent.json').exists(): + base.fixed_intent(folder,'disable-intent.json',dict(id=ident,known_hashes=[intent['config_sha256'],before['server']['fault_config_sha256']])) + if not flags_disabled(current): + closed = cloud.bootstrap.rpc('server.conf',fault.configure_server,dict( + id=str(uuid.uuid4()),enabled=False,tenant_id=cloud.TENANT,agent_id=base.AGENT, + compose_sha256=intent['compose_sha256'], + expected_config_sha256=[intent['config_sha256'],before['server']['fault_config_sha256']])) + base.save(folder,'disabled-'+str(uuid.uuid4())+'.json',closed) + require(closed['deployed'], 'server fault disable must finish') + actual = status() + require(flags_disabled(actual) and actual['fault_config_sha256'] in + (intent['config_sha256'],before['server']['fault_config_sha256']), 'both actual application fault hooks disabled') + base.save(folder,'disabled-readback-'+str(uuid.uuid4())+'.json',actual) + base.fixed_intent(folder,'restore-intent.json',dict(id=ident,expected_original_config_sha256=base.ORIGINAL_CONFIG)) + native = base.remote(ident,'state',mode='auto',source_sha256=intent['source_sha256']) + base.preserved(before['native'],native) + if not (native['transport'] == 'wss' and native['config_sha256'] == base.ORIGINAL_CONFIG + and native['config_acl_sha256'] == before['native']['config_acl_sha256'] and native['service_state'] == 'Running'): + restored = base.remote(ident,'restore',mode='auto',source_sha256=intent['source_sha256']) + else: + restored = dict(restored_by_readback=True,snapshot=native,no_jobs=True,no_reboot=True) + base.save(folder,'restored-'+str(uuid.uuid4())+'.json',restored) + + +def finish(ident): + folder = STATE/str(uuid.UUID(ident)); intent = base.cb.contract.protected_json(folder/'intent.json') + before = base.cb.contract.protected_json(folder/'before.json') + require(intent['id'] == ident and intent['case'] == 'automatic_fallback' + and intent['source_sha256'] == hashlib.sha256(base.SCRIPT.encode()).hexdigest(), 'same qualified passive Windows case') + require(not (folder/'result.json').exists(), 'retain completed original acceptance') + accepted = folder/'https-accepted.json' + try: + if not accepted.exists(): + native = base.remote(ident,'state',mode='auto',source_sha256=intent['source_sha256']) + base.preserved(before['native'],native) + require(native['transport'] == 'auto', 'automatic mode must have been selected before fault') + if not (folder/'enable-intent.json').exists(): + initial = base.wait_mode(ident,'wss',base.cb.contract.timestamp(intent['started_at']),before['central']['device']) + base.save(folder,'initial-auto-wss.json',initial) + require(base.cb.contract.now() < base.cb.contract.timestamp(intent['config']['expires_at']), 'fixed bounded fault lease') + call = dict(id=ident,enabled=True,tenant_id=cloud.TENANT,agent_id=base.AGENT, + compose_sha256=intent['compose_sha256'],expected_config_sha256=before['server']['fault_config_sha256'],config=intent['config']) + base.save(folder,'enable-intent.json',call) + enabled = cloud.bootstrap.rpc('server.conf',fault.configure_server,call) + base.save(folder,'enabled.json',enabled);require(enabled['deployed'], 'bounded server fault activation incomplete') + else: + actual = status() + require(flags_enabled(actual) and actual['fault_config_sha256'] == intent['config_sha256'], + 'resume only an already active exact fault; never repeat activation') + online = wait_fallback(ident,intent['config'],intent['config_sha256'],before['central']['device']) + native = base.remote(ident,'state',mode='auto',source_sha256=intent['source_sha256']);base.preserved(before['native'],native) + require(native['journal']['pending_inventory_events'] == 0 and native['journal']['sequence'] > before['native']['journal']['sequence'] + and native['service_state'] == 'Running' and native['process_owner_sid'] == 'S-1-5-19', 'actual ACK, monotone journal and LocalService') + inventory = base.read_device(); denied = base.foreign_denied() + require(scopes() == before['counts'], 'no new jobs/grants on Windows or permanent Linux target') + base.save(folder,'https-accepted.json',dict(verified=True,online=online,native=native,inventory=inventory,foreign_denied=denied)) + else: + require(base.cb.contract.protected_json(accepted)['verified'] is True, 'retained actual fallback proof') + finally: + cleanup(folder,intent,before) + restored = base.wait_mode(ident,'wss',base.cb.contract.now(),before['central']['device']) + native = base.remote(ident,'state',mode='auto',source_sha256=intent['source_sha256']);base.preserved(before['native'],native) + require(native['config_sha256'] == base.ORIGINAL_CONFIG and native['config_acl_sha256'] == before['native']['config_acl_sha256'] + and native['journal']['pending_inventory_events'] == 0 and scopes() == before['counts'], 'restored exact WSS config/ACL/ACK and both targets unchanged') + final = status();require(flags_disabled(final), 'no active transport hook remains') + base.save(folder,'result.json',dict(verified=True,id=ident,case='automatic_fallback',https=base.cb.contract.protected_json(accepted), + restored_wss=restored,final_native=native,server=final,counts=before['counts'],no_jobs_or_approvals=True,no_reboot=True, + automatic_switchback_claimed=False)) + print('PASS native Windows auto WSS→HTTPS: two authenticated503, fresh HTTPS heartbeats/ACK, same identity, both hooks disabled, original WSS config/ACL restored, zero new jobs') + + +def start(https_case): + os.umask(0o077);STATE.mkdir(mode=0o700,parents=True,exist_ok=True) + prerequisite = base.STATE/str(uuid.UUID(https_case))/'result.json' + report = base.cb.contract.protected_json(prerequisite) + require(report['verified'] is True and report['case'] == 'explicit_https' and report['no_jobs_or_approvals'] is True + and report['final_native']['agent_id'] == base.AGENT, 'native HTTPS acceptance must be finished first') + ident = str(uuid.uuid4());folder = STATE/ident;folder.mkdir(mode=0o700) + source = base.stage_script();issued = base.cb.contract.now() + config = dict(schema_version=1,fault_id=ident,tenant_id=cloud.TENANT,agent_id=base.AGENT, + issued_at=issued.isoformat(),expires_at=(issued+dt.timedelta(minutes=10)).isoformat()) + digest = hashlib.sha256(json.dumps(config,separators=(',',':')).encode()).hexdigest() + intent = dict(id=ident,case='automatic_fallback',started_at=issued.isoformat(),source_sha256=source,config=config,config_sha256=digest, + compose_sha256=hashlib.sha256((cloud.ROOT/'deploy/server.compose.yaml').read_bytes()).hexdigest(), + https_prerequisite=dict(path=str(prerequisite),sha256=hashlib.sha256(prerequisite.read_bytes()).hexdigest()),no_jobs=True,no_reboot=True) + base.save(folder,'intent.json',intent) + native = base.remote(ident,'state',mode='auto',source_sha256=source);central = observe(ident);server = status();counts = scopes() + base.preserved(report['final_native'],native) + require(native['transport'] == 'wss' and native['config_sha256'] == base.ORIGINAL_CONFIG + and native['journal']['pending_inventory_events'] == 0 and flags_disabled(server) + and server['compose_sha256'] == intent['compose_sha256'] and server['fault_config_sha256'] == prior_hash() + and counts['windows'] == dict(jobs=0,outbox=0,permits=0,unresolved=0) + and counts['linux']['unresolved'] == 0, 'independent original config hashes and settled targets') + base.save(folder,'before.json',dict(native=native,central=central,server=server,counts=counts)) + base.save(folder,'enter-intent.json',base.payload(ident,'enter','auto')) + try: + entered = base.remote(ident,'enter',mode='auto',source_sha256=source) + base.save(folder,'entered.json',entered) + except Exception as error: + base.save(folder,'enter-failure.json',dict(error_class=type(error).__name__,phase='native_enter',same_case_preserved=True)) + cleanup(folder,intent,base.cb.contract.protected_json(folder/'before.json')) + raise + print('Entered existing Windows automatic-fallback case '+ident,flush=True) + finish(ident) + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('action',choices=('start','finish','restore')) + parser.add_argument('--https-case');parser.add_argument('--id') + args = parser.parse_args() + if args.action == 'start': + require(args.https_case and not args.id, 'one actual finished HTTPS case required') + start(args.https_case) + else: + require(args.id and not args.https_case, 'same existing fallback case required') + if args.action == 'finish':finish(args.id) + else: + folder = STATE/str(uuid.UUID(args.id));intent = base.cb.contract.protected_json(folder/'intent.json') + before = base.cb.contract.protected_json(folder/'before.json');cleanup(folder,intent,before) + print('Closed only existing Windows fallback case '+args.id) + + +if __name__ == '__main__': + try: + main() + except Exception as error: + message = str(error) + print('WINDOWS_AUTO_TRANSPORT_INCOMPLETE:'+(message if isinstance(error,base.cb.contract.GuardError) else type(error).__name__)) + raise SystemExit(2) from None diff --git a/docs/implementation-status.md b/docs/implementation-status.md index a520240..9b98329 100644 --- a/docs/implementation-status.md +++ b/docs/implementation-status.md @@ -1,5 +1,20 @@ # Tatsächlicher Implementierungsstand +## Windows: automatischer WSS→HTTPS-Fallback nativ bestanden — 2026-11-13 + +Fall2ff2e1aa-0037-4831-9bc2-31218bf1461c verifiziert. Bestehender LocalService- +Agent inauto: zwei aktuelle WSS-Heartbeats, danach genau zwei tatsächliche +authentisierte503 mit festen Slots/Peer-/Konfigurations-/Fallbindungen. +Automatische HTTPS-Auswahl mit zwei frischen Heartbeats und konkretem Inventar- +ACK; Identitäten/Dateien/ACLs erhalten, Sequenz monoton und TenantB verweigert. +WindowScounts0/0/0/0, Linux30/30/26/0 und Rootpolicy vor/nach unverändert. +Beide Server-Testhooksfalse/Dateipfadeabwesend; ursprüngliche WSS-Konfiguration +und ACLs exakt restauriert, wieder frische WSS-Heartbeats/ACK0. Kein automatischer +Switchback behauptet. Sechs lokale Guards ergänzen den nativen Nachweis. +Details:[Windows-Client](../deploy/windows/CLIENT.md). Windows-Jobs weiterhin +ausdrücklich nicht angeboten; erste PowerShell-Strecke benötigt die dokumentierten +[Core-/Uhr-/Planvoraussetzungen](windows-job-boundary.md). + ## Windows-TLS-Negativabnahme vollständig bestanden — 2026-11-13 Derselbe erhaltene Fall7b190a5c-c928-4348-bd0d-c9698dad5417 mit unveränderten diff --git a/docs/platform-support.md b/docs/platform-support.md index 64ed554..db53f9b 100644 --- a/docs/platform-support.md +++ b/docs/platform-support.md @@ -9,7 +9,7 @@ abgenommen.** | Ziel | Build | Tatsächlicher nativer Nachweis | Offene Grenzen | | --- | --- | --- | --- | | Ubuntu 24.04 x86-64, Cloud-Linux-Client | Rust 1.99.1, GNU/glibc, Bookworm-Buildbasis; Agent-/Helperartefakte benötigen höchstens GLIBC 2.34; neue 1-GiB-Variante mit 126 lokalen Tests qualifiziert | systemd-Agent, mTLS/WSS und HTTPS/Auto-Fallback, TLS-Lifecycle, Inventar/Heartbeat; genehmigte Skript-/Rootdienst-/begrenzte Logstrecke, Doppelzustellung/ACK-Verlust; alle drei aktiven Offlinefälle und Prozessabbruch mit dauerhaftem Unknown, signiertem Abschluss und unabhängigem Zähler; begrenztes M4-Update 1.0→1.1 und beide 1.1-Noops; eigener einmaliger Reboot mit signiertem Abschluss; automatische Helper-Startwiederholung; aktuelle native APT-Kopienqualifikation; MCP-Endbericht mit sieben erfolgreichen Operationen und DoD-Endabgleich bestanden | Begrenztes dev/test-MVP M0–M5 abgeschlossen. Genau eine reale Ziel-VM, keine Mehrgeräte-/Mischplattform- oder Produktionsabnahme. Rebootrechte und APT-Endpunkt geschlossen; 18 Rootverbräuche abgeglichen, alte APT-Fehlschläge erhalten. | -| Windows 11 Pro, Build 26300, x86-64, eigener Gast | `x86_64-pc-windows-gnu` Crossbuild Debug/Release und Clippy bestanden | LocalService/Service-SID, Enrollment, ausgehendes mTLS/WSS und separat natives explizites HTTPS, gespeichertes `windows.base`, frische Heartbeats und konkrete Inventar-ACKs; Tenant-B-Verweigerung, sieben native Rusttests. HTTPS-Abnahme erhielt Identität/ACLs und restaurierte Original-WSS. Separate native Admin-TLS-Proben verweigerten falsche CA/Name und abgelaufenes Clientzertifikat bei gültigen Kontrollen. | Unsignierter Entwicklungsbuild. Kein Jobexecutor/Helper/PowerShell-/Paketpfad. Automatischer Fallback, Rotation/Widerruf, MSI/EXE, signierter Installer und Rebootpersistenz noch nicht nativ abgenommen. Registry-Produktname meldet noch den tatsächlichen Legacywert „Windows 10 Pro“; unabhängige CIM-Probe bestätigt Windows 11. | +| Windows 11 Pro, Build 26300, x86-64, eigener Gast | `x86_64-pc-windows-gnu` Crossbuild Debug/Release und Clippy bestanden | LocalService/Service-SID, Enrollment, ausgehendes mTLS/WSS sowie separat natives explizites HTTPS und automatischer WSS→HTTPS-Fallback nach zwei authentisierten503, gespeichertes `windows.base`, frische Heartbeats und konkrete Inventar-ACKs; Tenant-B-Verweigerung, sieben native Rusttests. HTTPS-Abnahme erhielt Identität/ACLs und restaurierte Original-WSS. Separate native Admin-TLS-Proben verweigerten falsche CA/Name und abgelaufenes Clientzertifikat bei gültigen Kontrollen. | Unsignierter Entwicklungsbuild. Kein Jobexecutor/Helper/PowerShell-/Paketpfad. Rotation/Widerruf, MSI/EXE, signierter Installer und Rebootpersistenz noch nicht nativ abgenommen. Registry-Produktname meldet noch den tatsächlichen Legacywert „Windows 10 Pro“; unabhängige CIM-Probe bestätigt Windows 11. | | Windows MSVC-Ziel | Geplant | Nicht ausgeführt | GNU-Build/-Lauf ist kein MSVC-Nachweis. | | ARM64-Agenten, weitere Windows-/Linux-Versionen | Nicht freigegeben | Keine entsprechende native Agentabnahme | Keine Supportableitung aus einem Compilerziel oder ARM64-Server. | | Ubuntu 26.04 ARM64, dedizierter Cloudserver | Native ARM64-Serverbuilds bestanden | API/Gateway/PostgreSQL, Migrationen 1–13 und Clientverbindungen auf `discovery.ease-technologies.de` | Öffentliche WebUI/OIDC und Produktionsbetrieb nicht abgenommen; Verwaltungs-UI nur über SSH-Tunnel. Kein ARM64-Agentnachweis. | diff --git a/docs/windows-gates.md b/docs/windows-gates.md index c9b2672..f09564b 100644 --- a/docs/windows-gates.md +++ b/docs/windows-gates.md @@ -9,7 +9,7 @@ bleibt eine eigenständige Abnahme. Dieser Bericht erweitert dessen Umfang nicht | --- | --- | --- | | Zugang | Gepinnter Reverse-SSH-Zugang zum Gast vorhanden; keine öffentliche Windows-SSH-Freigabe. Bestehender Agent bei Wiederaufnahme als LocalService laufend, Auto-Start, unveränderte Identität, kein Enrollmenttoken. | Zugang zeitlich begrenzt; keine automatische Verlängerung oder neue öffentliche Portfreigabe. | | Passiver Client | SCM-Dienst, Service-SID/ACLs, Enrollment/mTLS/WSS, Inventar mit Quelle/Zeit, Heartbeats und Mandantentrennung nativ bestanden; sieben native Rusttests. | Bestehende Identität und Telemetriehistorie bei allen weiteren Schritten erhalten. | -| HTTPS/Fallback | Explizites HTTPS unter bestehendem LocalService mit zwei frischen Heartbeats, Inventar-ACK und Tenantverweigerung nativ bestanden; ursprüngliche WSS-Bytes/ACLs restauriert,0Jobs/Grants. | Automatische Auswahl nach exakt begrenzten WSS-Verweigerungen noch separat prüfen. | +| HTTPS/Fallback | Explizites HTTPS unter bestehendem LocalService mit zwei frischen Heartbeats, Inventar-ACK und Tenantverweigerung nativ bestanden; ursprüngliche WSS-Bytes/ACLs restauriert,0Jobs/Grants. | Automatischer Fallback nach zwei tatsächlichen mTLS-WSS503 ebenfalls nativ bestanden; zwei frische HTTPS-Heartbeats/ACK, Hooks geschlossen, WSS exakt restauriert. Dauerhafte Defaultkonfiguration gesondert behandeln. | | TLS-Lifecycle | Falsche CA, falscher Name und abgelaufenes Clientzertifikat mit gültigen Kontrollen nativ als getrennte Admin-TLS-Proben bestanden. Permanente Identität/Dienst unverändert. | Rotation und Widerruf noch gesondert sicher implementieren und prüfen. Permanente Identität nicht widerrufen oder ersetzen. | | Signierter Jobkern | Windows verweigert Jobangebote/Grants ausdrücklich und meldet keine Ausführungscapability. | Gemeinsamen Sync-/Checkpoint-/Einmalverbrauchskern portieren; vertrauenswürdige Uhr, Journalmigration ohne Reset, Schlüsselbindung und Fehlerpfade qualifizieren. | | PowerShell | Noch kein Executor oder freigegebener Interpreter. Server/UI lösen derzeit Linuxvarianten auf. | Exakte Windows-PowerShell-5.1-Bytes, Ausgabeencoding, Prozessgrenzen und unprivilegierte Ausführungsidentität binden. Erst nach vollständigem Antrag und tatsächlichem WebUI-Klick ausführen. | diff --git a/tests/windows_auto_transport_acceptance.py b/tests/windows_auto_transport_acceptance.py new file mode 100644 index 0000000..f2ff60f --- /dev/null +++ b/tests/windows_auto_transport_acceptance.py @@ -0,0 +1,142 @@ +#!/usr/bin/env python3 +"""Local guards of the passive Windows fault runner; no network or VM.""" +import copy +import hashlib +import pathlib +import sys +import tempfile +import unittest +from unittest.mock import patch + +ROOT=pathlib.Path(__file__).resolve().parents[1] +sys.path.insert(0,str(ROOT/'deploy/windows')) +import auto_transport_acceptance as auto + + +def flags(enabled=False): + role=dict(RMM_PROFILE='development',RMM_DEV_AUTH='true',RMM_DEV_TRANSPORT_FAULTS='true' if enabled else 'false', + RMM_DEV_TRANSPORT_FAULT_FILE='/root-policy/transport-fault.json' if enabled else None) + return dict(roles={'api':copy.deepcopy(role),'gateway':copy.deepcopy(role)}, + compose_sha256='known-compose',root_policy_sha256='unchanged-closed-policy',fault_config_sha256='old-known-fault') + + +def receipts(): + origin='2026-11-13T22:00:00+00:00'; ident='11111111-1111-4111-8111-111111111111' + config=dict(fault_id=ident) + baseline=dict(agent_id=auto.base.AGENT,asset_id=auto.base.ASSET,enrollment_generation=1,assignment_version=1,certificate_sha256='same-certificate') + rows=[dict(created_at=origin,data=dict(slot=i,handshake_id='handshake-'+str(i),status=503, + agent_id=auto.base.AGENT,tenant_id=auto.cloud.TENANT,fault_id=ident,config_sha256='new-known-fault', + testsimulation=True,certificate_sha256='same-certificate')) for i in (1,2)] + observed=dict(receipts=rows,device=dict(baseline,transport='https',last_contact_at='2026-11-13T22:00:01+00:00',sync_ready=False,restore_blocked=True)) + return observed,config,baseline + + +class ReceiptGuards(unittest.TestCase): + def test_exact_peer_configuration_and_two_distinct_actual_rejections(self): + observed,config,baseline=receipts();auto.validate_receipts(observed,config,'new-known-fault',baseline) + for mutate in ( + lambda value:value['receipts'][1]['data'].update(slot=1), + lambda value:value['receipts'][1]['data'].update(handshake_id='handshake-1'), + lambda value:value['receipts'][0]['data'].update(status=401), + lambda value:value['receipts'][0]['data'].update(certificate_sha256='other-certificate'), + lambda value:value['receipts'][0]['data'].update(config_sha256='unverified-host-hash'), + lambda value:value['receipts'][0]['data'].update(tenant_id='other-tenant'), + lambda value:value['receipts'][0]['data'].update(fault_id='other-fault'), + lambda value:value['receipts'][0]['data'].update(testsimulation=False), + lambda value:value['device'].update(assignment_version=2), + ): + bad=copy.deepcopy(observed);mutate(bad) + with self.subTest(value=bad),self.assertRaises(auto.base.cb.contract.GuardError): + auto.validate_receipts(bad,config,'new-known-fault',baseline) + + def test_hello_before_fresh_heartbeat_is_waited_for_without_inventing_sync(self): + observed,config,baseline=receipts() + before_heartbeat=copy.deepcopy(observed);before_heartbeat['device']['last_contact_at']='2026-11-13T21:59:59+00:00' + second=copy.deepcopy(observed);second['device']['last_contact_at']='2026-11-13T22:00:32+00:00' + with patch.object(auto,'observe',side_effect=[before_heartbeat,observed,second]),patch.object(auto.time,'sleep'): + outcome=auto.wait_fallback(config['fault_id'],config,'new-known-fault',baseline) + self.assertEqual(outcome['second']['device']['last_contact_at'],second['device']['last_contact_at']) + self.assertFalse(outcome['second']['device']['sync_ready']) + + def test_both_real_roles_and_explicit_dev_profile_required(self): + self.assertTrue(auto.flags_disabled(flags(False)));self.assertTrue(auto.flags_enabled(flags(True))) + for role in ('api','gateway'): + wrong=flags(False);wrong['roles'][role]['RMM_PROFILE']='production' + self.assertFalse(auto.flags_disabled(wrong)) + wrong=flags(False);wrong['roles'][role]['RMM_DEV_TRANSPORT_FAULT_FILE']='/unexpected/file' + self.assertFalse(auto.flags_disabled(wrong)) + wrong=flags(True);wrong['roles'][role]['RMM_DEV_TRANSPORT_FAULTS']='false' + self.assertFalse(auto.flags_enabled(wrong)) + + +class RestoreGuards(unittest.TestCase): + def test_already_disabled_and_original_wss_restored_are_only_read_back(self): + with tempfile.TemporaryDirectory() as tmp: + folder=pathlib.Path(tmp);auto.base.save(folder,'enable-intent.json',{'original_enable_started':True}) + current=flags(False) + native=dict(agent_id=auto.base.AGENT,asset_id=auto.base.ASSET,transport='wss', + config_sha256=auto.base.ORIGINAL_CONFIG,config_acl_sha256='same-acl',service_state='Running', + hashes={'key':'unchanged'},acl_sha256={'key':'unchanged'},telemetry_creation_ticks=1, + journal=dict(integrity='ok',read_only=True,agent_id=auto.base.AGENT,sequence=7)) + before=dict(server=current,native=copy.deepcopy(native)) + intent=dict(id='11111111-1111-4111-8111-111111111111',config_sha256='new-known-fault', + compose_sha256='known-compose',source_sha256='qualified-source') + calls=[] + def remote(ident,action,**kwargs): + calls.append(action);self.assertEqual(action,'state');return native + with patch.object(auto,'status',return_value=current),patch.object(auto.base,'remote',side_effect=remote), \ + patch.object(auto.cloud.bootstrap,'rpc',side_effect=AssertionError('no replayed activation or disable')): + auto.cleanup(folder,intent,before) + auto.cleanup(folder,intent,before) + self.assertEqual(calls,['state','state']) + self.assertEqual(auto.base.cb.contract.protected_json(folder/'disable-intent.json')['known_hashes'],['new-known-fault','old-known-fault']) + + def test_unknown_host_fault_hash_never_becomes_mutation_authority(self): + with tempfile.TemporaryDirectory() as tmp: + folder=pathlib.Path(tmp);auto.base.save(folder,'enable-intent.json',{'original_enable_started':True}) + before=flags(False);current=flags(True);current['fault_config_sha256']='unknown-host-hash' + intent=dict(id='11111111-1111-4111-8111-111111111111',config_sha256='new-known-fault', + compose_sha256='known-compose',source_sha256='qualified-source') + def denied_rpc(host,function,payload): + self.assertEqual(host,'server.conf') + self.assertIs(function,auto.fault.configure_server) + self.assertEqual(payload['expected_config_sha256'],['new-known-fault','old-known-fault']) + self.assertNotIn(current['fault_config_sha256'],payload['expected_config_sha256']) + raise auto.base.cb.contract.GuardError('actual file failed exact known CAS') + with patch.object(auto,'status',return_value=current),patch.object(auto.cloud.bootstrap,'rpc',side_effect=denied_rpc), \ + patch.object(auto.base,'remote',side_effect=AssertionError('no Windows mutation before exact server cleanup')): + with self.assertRaises(auto.base.cb.contract.GuardError):auto.cleanup(folder,intent,dict(server=before)) + + def test_native_enter_lost_reply_closes_same_case_without_reentering(self): + https_id='22222222-2222-4222-8222-222222222222' + native=dict(agent_id=auto.base.AGENT,asset_id=auto.base.ASSET,transport='wss', + config_sha256=auto.base.ORIGINAL_CONFIG,config_acl_sha256='same-acl',service_state='Running', + hashes={'key':'unchanged'},acl_sha256={'key':'unchanged'},telemetry_creation_ticks=1, + journal=dict(integrity='ok',read_only=True,agent_id=auto.base.AGENT,sequence=7,pending_inventory_events=0)) + current=flags(False) + current['compose_sha256']=hashlib.sha256((auto.cloud.ROOT/'deploy/server.compose.yaml').read_bytes()).hexdigest() + with tempfile.TemporaryDirectory() as tmp: + root=pathlib.Path(tmp);https=root/'https';prerequisite=https/https_id;prerequisite.mkdir(parents=True) + auto.base.save(prerequisite,'result.json',dict(verified=True,case='explicit_https',no_jobs_or_approvals=True,final_native=native)) + calls=[] + def remote(ident,action,**kwargs): + calls.append(action) + if action=='enter':raise RuntimeError('lost reply') + return native + counts=dict(windows=dict(jobs=0,outbox=0,permits=0,unresolved=0),linux=dict(jobs=30,outbox=30,permits=26,unresolved=0)) + with patch.object(auto,'STATE',root/'auto'),patch.object(auto.base,'STATE',https), \ + patch.object(auto.base,'stage_script',return_value='known-source'),patch.object(auto.base,'remote',side_effect=remote), \ + patch.object(auto,'status',return_value=current),patch.object(auto,'observe',return_value={'device':{}}), \ + patch.object(auto,'scopes',return_value=counts),patch.object(auto,'prior_hash',return_value='old-known-fault'), \ + patch.object(auto,'cleanup') as cleanup: + with self.assertRaisesRegex(RuntimeError,'lost reply'):auto.start(https_id) + self.assertEqual(calls,['state','enter']) + self.assertEqual(cleanup.call_count,1) + case=next((root/'auto').iterdir()) + self.assertTrue((case/'enter-intent.json').exists()) + self.assertTrue((case/'enter-failure.json').exists()) + self.assertFalse((case/'result.json').exists()) + + + +if __name__=='__main__':unittest.main()