"""Read-only nonce-bound helper readiness as the actual unprivileged VM peer.""" def inspect_helpers(payload): import sqlite3 program=r'''import json,os,socket,struct,uuid,sys from pathlib import Path result={} for kind,pin_path,socket_path in ( ('general','/etc/rmm-remote/general-helper-proof.json','/run/rmm-helper-cloud/control.sock'), ('apt','/etc/rmm-remote/apt-helper-proof.json','/run/rmm-apt-helper/helper.sock')): if kind=='apt' and sys.argv[1]=='general':continue pin_path=Path(pin_path);socket_path=Path(socket_path) for path in list(pin_path.parents)+[pin_path]+list(socket_path.parents): meta=path.lstat();assert not path.is_symlink() and meta.st_uid==0 and meta.st_mode&0o022==0 meta=socket_path.lstat();assert meta.st_uid==0 and meta.st_mode&0o007==0 pin=json.loads(pin_path.read_text());challenge=str(uuid.uuid4()) request=dict(operation='apt_readiness_v1' if kind=='apt' else 'general_policy_v1',challenge=challenge,identity=pin['identity']) field='provider_stack_sha256' if kind=='apt' else 'policy_sha256' if kind=='apt':request['expected_stack_sha256']=pin[field] s=socket.socket(socket.AF_UNIX);s.settimeout(10);s.connect(str(socket_path)) assert struct.unpack('3i',s.getsockopt(socket.SOL_SOCKET,socket.SO_PEERCRED,12))[1]==0 raw=json.dumps(request,separators=(',',':')).encode();s.sendall(struct.pack('!I',len(raw))+raw) def receive(n): b=b'' while len(b)