Add the fixed Windows LocalService hello to the cloud acceptance path
Rust development slice / linux (push) Failing after 6s
Rust development slice / linux (push) Failing after 6s
This commit is contained in:
@@ -6,6 +6,7 @@ Credentials stay on the cloud server; the browser reads its protected login
|
|||||||
file. All SQL is fixed read-only evidence, scoped to the one cloud VM.
|
file. All SQL is fixed read-only evidence, scoped to the one cloud VM.
|
||||||
"""
|
"""
|
||||||
import argparse
|
import argparse
|
||||||
|
from datetime import timedelta
|
||||||
import hashlib
|
import hashlib
|
||||||
import http.client
|
import http.client
|
||||||
import json
|
import json
|
||||||
@@ -24,6 +25,38 @@ import vm_mvp_acceptance as contract
|
|||||||
ROOT = bootstrap.ROOT
|
ROOT = bootstrap.ROOT
|
||||||
TENANT = bootstrap.TENANT
|
TENANT = bootstrap.TENANT
|
||||||
require = bootstrap.require
|
require = bootstrap.require
|
||||||
|
WINDOWS_AGENT = '63ea15b2-0643-403d-b5b4-cba1288dbea3'
|
||||||
|
WINDOWS_ASSET = 'a176520e-8a91-4e93-a78b-8e7620f430e0'
|
||||||
|
WINDOWS_SCRIPT = "Write-Output 'Zeitprofil-Test'\r\n"
|
||||||
|
WINDOWS_STDOUT = 'Zeitprofil-Test\r\n'
|
||||||
|
|
||||||
|
|
||||||
|
def windows_hello_input():
|
||||||
|
start = contract.now()
|
||||||
|
return dict(
|
||||||
|
tenant_id=TENANT, action='run_script', targets=dict(asset_ids=[WINDOWS_ASSET]),
|
||||||
|
parameters=dict(
|
||||||
|
execution_identity='agent_service', timeout_seconds=60, max_output_bytes=65536,
|
||||||
|
arguments=[], expected_stdout=WINDOWS_STDOUT,
|
||||||
|
variants=[dict(os_family='windows', interpreter='powershell', encoding='utf-8',
|
||||||
|
script_utf8=WINDOWS_SCRIPT, windows_execution_profile='powershell_51_remote_signed')]),
|
||||||
|
schedule=contract.schedule(start, start + timedelta(minutes=15)),
|
||||||
|
rollout=dict(max_parallel=1, halt_after_failures=1),
|
||||||
|
reason='Erste genehmigte PowerShell-Textausgabe auf der Windows-Test-VM')
|
||||||
|
|
||||||
|
|
||||||
|
def verify_windows_hello(result):
|
||||||
|
report = result['result']
|
||||||
|
proof = report['evidence']
|
||||||
|
contract.require(result['state'] == 'succeeded' and report['exit_code'] == 0
|
||||||
|
and bytes(report['stdout']) == WINDOWS_STDOUT.encode() and bytes(report['stderr']) == b''
|
||||||
|
and report['output_truncated'] is False and proof['postconditions_passed'] is True
|
||||||
|
and proof['execution_sid'] == 'S-1-5-19' and proof['interpreter'] == 'powershell'
|
||||||
|
and proof['script_sha256'] == hashlib.sha256(WINDOWS_SCRIPT.encode()).hexdigest()
|
||||||
|
and proof['windows_execution_profile'] == 'powershell_51_remote_signed'
|
||||||
|
and proof['execution_policy'] == 'process_remote_signed_requested'
|
||||||
|
and proof['execution_policy_requested'] == 'RemoteSigned'
|
||||||
|
and proof['execution_policy_scope'] == 'process', 'windows_hello_evidence')
|
||||||
|
|
||||||
|
|
||||||
def prepare_browser():
|
def prepare_browser():
|
||||||
@@ -147,10 +180,15 @@ class Backend:
|
|||||||
def main():
|
def main():
|
||||||
parser=argparse.ArgumentParser(description=__doc__)
|
parser=argparse.ArgumentParser(description=__doc__)
|
||||||
parser.add_argument('--execute-dev-test-ui',action='store_true',required=True)
|
parser.add_argument('--execute-dev-test-ui',action='store_true',required=True)
|
||||||
parser.add_argument('--case',choices=('hello','refresh_inventory','cancel_queued'),default='hello')
|
parser.add_argument('--case',choices=('hello','refresh_inventory','cancel_queued','windows_hello'),default='hello')
|
||||||
parser.add_argument('--transport',choices=('wss','https'))
|
parser.add_argument('--transport',choices=('wss','https'))
|
||||||
args=parser.parse_args();os.umask(0o077)
|
args=parser.parse_args();os.umask(0o077)
|
||||||
contract.require(not (Path.home()/'.local/share/rust-discovery/remote-agent').exists(),'notebook_must_not_have_client')
|
contract.require(not (Path.home()/'.local/share/rust-discovery/remote-agent').exists(),'notebook_must_not_have_client')
|
||||||
|
windows = args.case == 'windows_hello'
|
||||||
|
if windows:
|
||||||
|
contract.require(args.transport is None, 'windows_keep_current_transport')
|
||||||
|
identity = dict(agent_id=WINDOWS_AGENT, asset_id=WINDOWS_ASSET)
|
||||||
|
else:
|
||||||
prepare_browser()
|
prepare_browser()
|
||||||
installed=contract.protected_json(ROOT/'devstate/remote-vm.json')
|
installed=contract.protected_json(ROOT/'devstate/remote-vm.json')
|
||||||
identity=installed['identity']
|
identity=installed['identity']
|
||||||
@@ -172,11 +210,18 @@ def main():
|
|||||||
observed=bootstrap.rpc('server.conf',bootstrap.server,dict(action='observe',agent_id=identity['agent_id']))
|
observed=bootstrap.rpc('server.conf',bootstrap.server,dict(action='observe',agent_id=identity['agent_id']))
|
||||||
contract.require(observed['sync_ready'] and not observed['restore_blocked'],'signed_sync_gate_required')
|
contract.require(observed['sync_ready'] and not observed['restore_blocked'],'signed_sync_gate_required')
|
||||||
needed={'refresh_inventory' if args.case=='refresh_inventory' else 'run_script','rmm.sync.v1'}
|
needed={'refresh_inventory' if args.case=='refresh_inventory' else 'run_script','rmm.sync.v1'}
|
||||||
|
if windows:
|
||||||
|
needed.update(('windows.base/1', 'script.powershell/1', 'script.powershell.process_remote_signed/1'))
|
||||||
contract.require(needed<=set(device['capabilities']),'actual_vm_capability_required')
|
contract.require(needed<=set(device['capabilities']),'actual_vm_capability_required')
|
||||||
request=contract.case_input(args.case,settings)
|
if windows:
|
||||||
|
prepare_browser()
|
||||||
|
request=windows_hello_input() if windows else contract.case_input(args.case,settings)
|
||||||
plan=backend.call('operations.plan',dict(tenant_id=TENANT,input=request))
|
plan=backend.call('operations.plan',dict(tenant_id=TENANT,input=request))
|
||||||
contract.require(hashlib.sha256(bytes(plan['plan_payload_bytes'])).hexdigest()==plan['plan_hash'] and len(plan['jobs'])==1,'immutable_plan')
|
contract.require(hashlib.sha256(bytes(plan['plan_payload_bytes'])).hexdigest()==plan['plan_hash'] and len(plan['jobs'])==1,'immutable_plan')
|
||||||
job=plan['jobs'][0]
|
job=plan['jobs'][0]
|
||||||
|
if windows:
|
||||||
|
contract.require(job['payload']['agent_id']==WINDOWS_AGENT and job['payload']['asset_id']==WINDOWS_ASSET
|
||||||
|
and job['payload']['tenant_id']==TENANT, 'fixed_windows_target_required')
|
||||||
folder=ROOT/'devstate/cloud-acceptance'/uuid.uuid4().hex;folder.mkdir(mode=0o700,parents=True)
|
folder=ROOT/'devstate/cloud-acceptance'/uuid.uuid4().hex;folder.mkdir(mode=0o700,parents=True)
|
||||||
checkpoint=dict(profile='dev/test',case=args.case,expected_principal='simulated-testprincipal-a',**settings,
|
checkpoint=dict(profile='dev/test',case=args.case,expected_principal='simulated-testprincipal-a',**settings,
|
||||||
plan=plan,job=job,stage='planned',no_retry=True,transport=observed['transport'],server_connection=observed)
|
plan=plan,job=job,stage='planned',no_retry=True,transport=observed['transport'],server_connection=observed)
|
||||||
@@ -205,6 +250,8 @@ def main():
|
|||||||
contract.require(result['state']=='succeeded' and result['result']['evidence']['postconditions_passed'],'native_postconditions_required')
|
contract.require(result['state']=='succeeded' and result['result']['evidence']['postconditions_passed'],'native_postconditions_required')
|
||||||
if args.case=='hello':
|
if args.case=='hello':
|
||||||
contract.require(result['result']['exit_code']==0 and bytes(result['result']['stdout'])==b'Hello World\n','exact_stdout_required')
|
contract.require(result['result']['exit_code']==0 and bytes(result['result']['stdout'])==b'Hello World\n','exact_stdout_required')
|
||||||
|
elif windows:
|
||||||
|
verify_windows_hello(result)
|
||||||
elif args.case=='refresh_inventory':
|
elif args.case=='refresh_inventory':
|
||||||
contract.require(contract.timestamp(result['result']['evidence']['observed_at'])>=contract.timestamp(request['schedule']['not_before']),'fresh_inventory_required')
|
contract.require(contract.timestamp(result['result']['evidence']['observed_at'])>=contract.timestamp(request['schedule']['not_before']),'fresh_inventory_required')
|
||||||
gate=evidence('gate',job_id=job['job_id']);audit=evidence('audit',operation_id=pending['operation_id'])
|
gate=evidence('gate',job_id=job['job_id']);audit=evidence('audit',operation_id=pending['operation_id'])
|
||||||
|
|||||||
@@ -87,3 +87,35 @@ Für die erste erfolgreiche Skriptabnahme braucht der Dienst die an das Gerät
|
|||||||
gebundene Jobkonfiguration, qualifizierte Profilfähigkeit, signierten
|
gebundene Jobkonfiguration, qualifizierte Profilfähigkeit, signierten
|
||||||
Auftragsabgleich und beim Start erneut frische Zeitbelege. Darauf folgt der
|
Auftragsabgleich und beim Start erneut frische Zeitbelege. Darauf folgt der
|
||||||
unveränderliche Antrag mit Genehmigung in der WebUI.
|
unveränderliche Antrag mit Genehmigung in der WebUI.
|
||||||
|
|
||||||
|
### Erster LocalService-Auftrag, Stand 15. November 2026, 21:44 Uhr MEZ
|
||||||
|
|
||||||
|
Der gemeinsame Abnahmelauf kennt jetzt den festen Fall `windows_hello`.
|
||||||
|
Er adressiert ausschließlich die bestehende Windows-Test-VM. Das Skript
|
||||||
|
`Write-Output 'Zeitprofil-Test'` und die erwartete Ausgabe enden jeweils
|
||||||
|
mit CRLF. Der Plan bindet `agent_service` und
|
||||||
|
`powershell_51_remote_signed`. Der Browser prüft diese Angaben am gespeicherten
|
||||||
|
Plan und die sichtbare Prozessoption vor der Freigabe. Der Ergebnisvergleich
|
||||||
|
fordert neben Exit 0 und vollständiger Ausgabe auch die LocalService-SID,
|
||||||
|
den Skripthash und den prozessgebundenen Policybeleg. Die vorhandenen
|
||||||
|
Prüfungen für das Pending, den Freigabeaudit und die Anzahl der Startpermits
|
||||||
|
gelten für diesen Fall.
|
||||||
|
|
||||||
|
Lokal bestanden beim Browser-Planvergleich ein positiver und elf negative
|
||||||
|
Fälle. Der Python-Lauf prüfte den festen Planinput, eine passende
|
||||||
|
Ergebnisquittung und neun abweichende Ergebnisse. Beim ersten lokalen
|
||||||
|
Negativlauf fing der Test eine andere Ausnahmeklasse ab als der Prüfer
|
||||||
|
warf. Der korrigierte Lauf mit dem gemeinsamen Abnahmefehler bestand.
|
||||||
|
|
||||||
|
Tatsächlich ausgeführt wurde
|
||||||
|
`python3 deploy/cloud_mvp_acceptance.py --case windows_hello --execute-dev-test-ui`.
|
||||||
|
Der Lauf stoppte vor der Planung bei `actual_vm_capability_required`.
|
||||||
|
Der gespeicherte MCP-Kontakt um 21:42:59 Uhr MEZ war online, die
|
||||||
|
Verbindungsgeneration betrug 146. Das Gerät meldete seine drei passiven
|
||||||
|
Fähigkeiten. Jobs, Outbox, Permits und offene Aufträge standen auf null.
|
||||||
|
SHA-256 des serverseitig nachgelesenen Zustands im lokalen Beleg
|
||||||
|
`fd0c9af5f4df03a655fcb491212eb62c7777182f02a4e0a69633e5602985943c`.
|
||||||
|
Um 21:44:08 Uhr MEZ bestätigte eine lesende Transaktion für dieselbe
|
||||||
|
Generation `sync_required=false`, `sync_ready=true`,
|
||||||
|
`helper_sync_ready=false` und null Sync-Checkpoints. Ein neuer Plan,
|
||||||
|
eine WebUI-Genehmigung und eine Windows-Ausführung stehen aus.
|
||||||
|
|||||||
Reference in New Issue
Block a user