#!/usr/bin/env python3 """One fixed source-quality acceptance after the proven peer namespace bootstrap. No transport, provisioning, original-phase retry, keys or broker installation. Run only as the root operator with python3 -I; uncertain execution is read only. """ import argparse import grp import hashlib import importlib.util import json import os from pathlib import Path import stat import sys import uuid CASE = '5b358997-3abc-43db-945f-f41855b4e3c0' PHASE = 'probe-peer-acceptance-v1' PROFILE = 'rmm.server-time-source.peer-acceptance.v1' PIN_CONTROLLER_SHA = 'fac85dd0399009af36f625232daa5b67ab7fda391dbf95229d4237c307b142ca' PIN_CONTROLLER = Path('/var/lib/rmm-time-source-operators') / PIN_CONTROLLER_SHA / 'pin_bootstrap.py' PIN_RESULT_SHA = 'd0a9ac7b46bdf4247c420f01d959c41d6620f7081c40629016d6866828884c4b' PUBLIC_PIN_SHA = '203f63f150026d345614ca53e641f248397166fbdeb1f28318fc5d7763317e0a' GROUP_RECEIPT_SHA = '4977876b935bed8903ce4c880a0d9c77c49cd2c7110551fbf854baeccbe64ea7' OLD_GROUP_PHASE = 'probe-group-acceptance-v1' OLD_GROUP_CONTROLLER_SHA = 'd04989ccf6d3e7b379a1b02f5fd3ce2545a3563fbce1368f33102f58a36f2dcf' OLD_GROUP_RESULT_SHA = '96b714e2e43aa13073317c310b213863a02f26dbf2e6c975dc0801ef621eccd5' OLD_GROUP_LOG_SHA = 'f80644630b09f50fdc731418dbe4f17fff32622910b3efd346a0369b75e985ef' OLD_GROUP_RECEIPT_SHA = '6923cc1893619f67ae8677b84f9cfea6d0edd554120e9139d843115e52aa7643' DAC_DIAGNOSTIC_RECEIPT_SHA = 'd999e5260cab3457a7a66603fdb0288615443628e5a28f31df9c1cecd3401ef5' NAMESPACE_PHASE = 'peer-namespace-bootstrap-v1' NAMESPACE_CONTROLLER_SHA = '2f1dafece1e5cd1b9be11078edee5f67fbdaef013defa10c527367b42dce9265' NAMESPACE_CONTROLLER = Path('/var/lib/rmm-time-source-operators') / NAMESPACE_CONTROLLER_SHA / 'peer_namespace_bootstrap.py' NAMESPACE_RESULT_SHA = 'cb1665cb14086d3ba79089a2eb9e01a532dd779bdcf577eafca0e343b5cc6a8b' NAMESPACE_LOCAL_SHA = '27e3708a34988fb778cbc8cfd892e0f222b8caf927034e472f391aab65349394' NAMESPACE_RECEIPT_SHA = '1dc76b5a9673f9e08e59f91f05d586cb9335ffd0a33e697d5170823a6f053619' NAMESPACE_READ_RECEIPT_SHA = '129584f296b53614e10a9e5eac2bab0a1e70b1c51f7fd70eb31bdf907ce767b3' OLD_DAC_PHASE = 'probe-dac-acceptance-v1' OLD_DAC_CONTROLLER_SHA = '1b79a4ab8d587338e43330db0fc73ff2e199dc61f1172da7cc3fc93d3538d2ac' OLD_DAC_RESULT_SHA = '5f8e0634e44c7caeab2020af5f5dd0d6e83249265d0ebd67f938f0797b551fca' OLD_DAC_RECEIPT_SHA = '553bc8580deb0e78d780b43c569f3827715a54a7b8629c51c705cf4e9ded7c61' ARTIFACT = dict(bytes=848632, sha256='216b4d6a0f29ef47576f5ccc469954623141e55d7b43bd73175c1d956363bbbd', elf_machine=183) BASE = Path('/var/lib/rmm-time-source-bootstrap') / CASE IMAGE = BASE / 'build/artifacts/operator_probe' OLD_UNIT = 'rmm-time-source-probe-' + CASE + '.service' UNIT = 'rmm-time-source-probe-peer-acceptance-' + CASE + '.service' SAMPLE_KEYS = {'profile', 'clock_authority', 'signed_attestation', 'captured_utc_ns', 'server_error_ns', 'source_sync_age_ns', 'server_boot_id', 'captured_monotonic_ns', 'sampled_boottime_ns', 'kernel_state'} def require(ok, reason): if not ok: raise RuntimeError(reason) def sha(raw): return hashlib.sha256(raw).hexdigest() def load_pin_controller(): # Bootstrap the already reviewed reader without following import paths or # executing a second, unchecked pathname read. All ancestors stay root-only writable. parent = os.open('/', os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW) try: for part in PIN_CONTROLLER.parent.parts[1:]: info = os.fstat(parent) require(info.st_uid == 0 and info.st_mode & 0o022 == 0, 'protected_controller_ancestry') child = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=parent) os.close(parent) parent = child info = os.fstat(parent) require(info.st_uid == 0 and info.st_mode & 0o022 == 0, 'protected_controller_directory') fd = os.open(PIN_CONTROLLER.name, os.O_RDONLY | os.O_NOFOLLOW, dir_fd=parent) with os.fdopen(fd, 'rb') as stream: before = os.fstat(stream.fileno()) require(stat.S_ISREG(before.st_mode) and before.st_uid == before.st_gid == 0 and before.st_nlink == 1 and stat.S_IMODE(before.st_mode) == 0o600 and before.st_size <= 128 * 1024, 'fixed_root_controller_file') raw = stream.read(128 * 1024 + 1) stable = lambda item: tuple(getattr(item, 'st_' + key) for key in ('dev', 'ino', 'uid', 'gid', 'mode', 'nlink', 'size', 'mtime_ns', 'ctime_ns')) require(stable(before) == stable(os.fstat(stream.fileno())) == stable(os.stat(PIN_CONTROLLER.name, dir_fd=parent, follow_symlinks=False)) and len(raw) == before.st_size and sha(raw) == PIN_CONTROLLER_SHA, 'exact_reviewed_pin_controller') finally: os.close(parent) module = importlib.util.module_from_spec(importlib.util.spec_from_loader('rmm_fixed_pin_reader', loader=None)) module.__file__ = str(PIN_CONTROLLER) exec(compile(raw, str(PIN_CONTROLLER), 'exec'), module.__dict__) held = module.read_file(PIN_CONTROLLER, 128 * 1024) require(held[0] == raw, 'same_loaded_controller_bytes') return module, lambda: require(module.read_file(PIN_CONTROLLER, 128 * 1024) == held, 'pin_controller_unchanged') def group_before_exec(old, log, rows, groups): require(type(old.get('exit_code')) is int and old['exit_code'] == 216 and log == b'' and old.get('sample') is None, 'original_216_empty_log_no_sample') require(groups == [{'gid': 989, 'name': '_chrony', 'present': True}, {'gid': 10001, 'present': False}], 'actual_original_nss_group_condition') messages = [row.get('MESSAGE') for row in rows] require(any(type(text) is str and 'Failed to determine supplementary groups' in text for text in messages) and any(type(text) is str and 'Failed at step GROUP spawning ' + str(IMAGE) in text for text in messages) and any(str(row.get('EXIT_STATUS')) == '216' and row.get('EXIT_CODE') == 'exited' for row in rows), 'original_unit_journal_confirms_pre_exec_group_failure') def failed_group_origin(value, log): require(value.get('original_case') == CASE and value.get('phase') == OLD_GROUP_PHASE and value.get('profile') == 'rmm.server-time-source.group-acceptance.v1' and value.get('controller_sha256') == OLD_GROUP_CONTROLLER_SHA and value.get('artifact') == ARTIFACT and type(value.get('exit_code')) is int and value['exit_code'] == 1 and value.get('sample') is None and value.get('source_quality_qualified') is False and value.get('clock_authority') is False and value.get('signed_attestation') is False and value.get('probe_log_sha256') == sha(log) == OLD_GROUP_LOG_SHA, 'actual_prior_group_probe_remains_failed_without_source_quality') def namespace_origin(value): require(value.get('profile') == 'rmm.server-time-source.peer-namespace-bootstrap.v1' and value.get('phase') == NAMESPACE_PHASE and value.get('original_case') == CASE and value.get('controller_sha256') == NAMESPACE_CONTROLLER_SHA and value.get('new_local_profile_sha256') == NAMESPACE_LOCAL_SHA and value.get('original_main_profile_sha256') == '214e509af9ab9b713e89b09bf6440c4b4248e97c64d4b0d884d2f869d406e1e2' and value.get('peer_namespace_configured') is True and value.get('apparmor_enforcing') is True and type(value.get('actual_parser_replace_exit_code')) is int and value['actual_parser_replace_exit_code'] == 0 and value.get('runtime_boot_chrony_preserved') is True and value.get('source_quality_sampled') is False and value.get('clock_authority') is False and value.get('signer_created') is False and value.get('broker_started') is False and value.get('services_restarted') is False, 'actual_successful_non_quality_peer_namespace_bootstrap') def failed_dac_origin(value, log): require(value.get('profile') == 'rmm.server-time-source.dac-acceptance.v1' and value.get('phase') == OLD_DAC_PHASE and value.get('original_case') == CASE and value.get('controller_sha256') == OLD_DAC_CONTROLLER_SHA and value.get('artifact') == ARTIFACT and type(value.get('exit_code')) is int and value['exit_code'] == 1 and value.get('sample') is None and value.get('source_quality_qualified') is False and value.get('clock_authority') is False and value.get('signed_attestation') is False and value.get('probe_log_sha256') == sha(log) == OLD_GROUP_LOG_SHA, 'actual_old_dac_failure_never_healed') def sample_quality(sample, boot): require(type(sample) is dict and set(sample) == SAMPLE_KEYS and sample['profile'] == 'rmm.native-source-quality.once.v1' and sample['clock_authority'] is False and sample['signed_attestation'] is False and sample['server_boot_id'] == boot and str(uuid.UUID(boot)) == boot, 'exact_non_authoritative_native_sample_schema_and_boot') for key, upper in (('captured_utc_ns', 2**63 - 1), ('server_error_ns', 500_000_000), ('source_sync_age_ns', 3_600_000_000_000), ('captured_monotonic_ns', 2**64 - 1), ('sampled_boottime_ns', 2**64 - 1), ('kernel_state', 4)): require(type(sample[key]) is int and 0 <= sample[key] <= upper, 'bounded_numeric_quality_sample') require(sample['captured_utc_ns'] > 0 and sample['captured_monotonic_ns'] > 0 and sample['sampled_boottime_ns'] >= sample['captured_monotonic_ns'], 'positive_native_time_domains') def probe_args(): return ['systemd-run', '--quiet', '--wait', '--pipe', '--collect', '--unit=' + UNIT, '--property=Type=exec', '--property=User=root', '--property=Group=989', '--property=SupplementaryGroups=', '--property=NoNewPrivileges=yes', '--property=CapabilityBoundingSet=CAP_SYS_PTRACE CAP_DAC_OVERRIDE', '--property=AmbientCapabilities=', '--property=ProtectSystem=strict', '--property=ProtectHome=yes', '--property=PrivateTmp=yes', '--property=PrivateDevices=yes', '--property=RestrictAddressFamilies=AF_UNIX', '--property=IPAddressDeny=any', '--property=SystemCallFilter=~@debug ptrace process_vm_readv process_vm_writev', '--property=RuntimeMaxSec=3s', '--property=ReadWritePaths=/run/rmm-time-source/clients', str(IMAGE)] def host_read(pin): # No operator import, subprocess, NSS lookup, sockets, preflight or sample. records = {} for leaf in ('intent.json', 'before.json', 'group-before-exec.json', 'execution.json', 'after.json', 'result.json', 'failure.json', 'probe.log'): try: raw, proof = pin.read_file(BASE / PHASE / leaf, 16384) records[leaf] = {'sha256': sha(raw), 'metadata': proof, 'record': raw.decode('ascii') if leaf == 'probe.log' else pin.parsed(raw)} except FileNotFoundError: records[leaf] = None print(pin.encoded(dict(original_case=CASE, phase=PHASE, read_only=True, records=records)).decode('ascii'), end='') def host_probe(pin, pin_guard): case_fd = pin.directory(BASE) phase_fd = -1 try: pin.absence(case_fd, PHASE) operator, operator_guard = pin.load_operator() original = pin.Original(BASE, operator, operator_guard) require(original.artifacts['examples/operator_probe'][:2] == (IMAGE, ARTIFACT), 'fixed_original_native_artifact') pin_raw, pin_proof = pin.read_file(BASE / 'pin/result.json') require(sha(pin_raw) == PIN_RESULT_SHA, 'actual_original_pin_result') pin_result = pin.parsed(pin_raw) old_raw, old_proof = pin.read_file(BASE / 'probe/result.json') old_log, old_log_proof = pin.read_file(BASE / 'probe/probe.log', 16384) old = pin.parsed(old_raw) require(old.get('artifact') == ARTIFACT and old.get('probe_log_sha256') == sha(old_log), 'original_failed_probe_artifact_and_log') group_records = {} for leaf in ('result.json', 'probe.log', 'before.json', 'after.json'): group_records[leaf] = pin.read_file(BASE / OLD_GROUP_PHASE / leaf, 16384) group_raw = group_records['result.json'][0] require(sha(group_raw) == OLD_GROUP_RESULT_SHA, 'exact_actual_failed_group_probe_result') previous_group = pin.parsed(group_raw) failed_group_origin(previous_group, group_records['probe.log'][0]) require(previous_group['original_probe_result_sha256'] == sha(old_raw) and previous_group['public_pin_sha256'] == PUBLIC_PIN_SHA and previous_group['source_tar_sha256'] == original.source_sha and previous_group['manifest_sha256'] == original.manifest_sha, 'same_original_group_failure_context') for name in ('before', 'after'): require(previous_group[name + '_witness'] == dict(filename=name + '.json', sha256=sha(group_records[name + '.json'][0])), 'actual_prior_group_witness_links') ns_raw, ns_proof = pin.read_file(NAMESPACE_CONTROLLER, 128 * 1024) require(sha(ns_raw) == NAMESPACE_CONTROLLER_SHA, 'exact_namespace_guard_controller') namespace = importlib.util.module_from_spec(importlib.util.spec_from_loader('rmm_peer_namespace_reader', loader=None)) namespace.__file__ = str(NAMESPACE_CONTROLLER) exec(compile(ns_raw, str(NAMESPACE_CONTROLLER), 'exec'), namespace.__dict__) namespace_records = {'result.json': pin.read_file(BASE / NAMESPACE_PHASE / 'result.json', 16384), 'original-local-profile.bin': pin.read_file(BASE / NAMESPACE_PHASE / 'original-local-profile.bin', 16384)} require(sha(namespace_records['result.json'][0]) == NAMESPACE_RESULT_SHA and namespace_records['original-local-profile.bin'][0] == b'', 'exact_namespace_result_and_old_local_backup') ns_result = pin.parsed(namespace_records['result.json'][0]) namespace_origin(ns_result) require(ns_result['source_tar_sha256'] == original.source_sha and ns_result['manifest_sha256'] == original.manifest_sha and ns_result['operator_sha256'] == pin.OPERATOR_SHA and ns_result['pin_controller_sha256'] == PIN_CONTROLLER_SHA and ns_result['public_pin_sha256'] == PUBLIC_PIN_SHA, 'same_namespace_original_context') for name, leaf in (('before', 'before.json'), ('after', 'after.json'), ('offline_result', 'offline-result.json'), ('reload_result', 'reload-result.json'), ('acl_applied', 'acl-applied.json')): namespace_records[leaf] = pin.read_file(BASE / NAMESPACE_PHASE / leaf, 16384) require(ns_result['records'][name] == dict(filename=leaf, sha256=sha(namespace_records[leaf][0])), 'actual_namespace_record_hash_link') ns_after = pin.parsed(namespace_records['after.json'][0]) require(ns_after['witness']['original'] == original.expected, 'namespace_original_runtime_boot_chrony_generation') main_profile = pin.read_file(namespace.MAIN, 65536, 0o644) local_profile = pin.read_file(namespace.LOCAL, 16384, 0o644) require(sha(main_profile[0]) == namespace.MAIN_SHA and sha(local_profile[0]) == NAMESPACE_LOCAL_SHA and local_profile[0] == namespace.LOCAL_BYTES and local_profile[1] == ns_after['new_local_metadata'], 'actual_held_main_and_namespace_local_profile') dac_records = {leaf: pin.read_file(BASE / OLD_DAC_PHASE / leaf, 16384) for leaf in ('result.json', 'probe.log', 'before.json', 'after.json')} require(sha(dac_records['result.json'][0]) == OLD_DAC_RESULT_SHA, 'exact_actual_failed_dac_result') old_dac = pin.parsed(dac_records['result.json'][0]) failed_dac_origin(old_dac, dac_records['probe.log'][0]) for name in ('before', 'after'): require(old_dac[name + '_witness'] == dict(filename=name + '.json', sha256=sha(dac_records[name + '.json'][0])), 'actual_old_dac_witness_links') def fresh(): pin_guard() actual_pin = original.fresh() require(pin.read_file(NAMESPACE_CONTROLLER, 128 * 1024) == (ns_raw, ns_proof), 'namespace_guard_controller_unchanged') for phase_name, records in ((NAMESPACE_PHASE, namespace_records), (OLD_DAC_PHASE, dac_records)): for leaf, retained in records.items(): require(pin.read_file(BASE / phase_name / leaf, 16384) == retained, 'namespace_and_failed_dac_records_unchanged') require(pin.read_file(namespace.MAIN, 65536, 0o644) == main_profile and pin.read_file(namespace.LOCAL, 16384, 0o644) == local_profile, 'held_main_local_profiles_unchanged') parent = pin.directory(namespace.PARENT) try: require(namespace.acl(parent) == namespace.expected_acl() and namespace.acl(parent, 'system.posix_acl_default') is None, 'actual_exact_peer_parent_acl') finally: os.close(parent) current_profile = namespace.profile_state(actual_pin['daemon_pid']) for leaf, retained in group_records.items(): require(pin.read_file(BASE / OLD_GROUP_PHASE / leaf, 16384) == retained, 'original_failed_group_records_unchanged') require(pin.read_file(BASE / 'pin/result.json') == (pin_raw, pin_proof) and pin.read_file(BASE / 'probe/result.json') == (old_raw, old_proof) and pin.read_file(BASE / 'probe/probe.log', 16384) == (old_log, old_log_proof), 'original_pin_and_failed_probe_records_unchanged') raw, proof = pin.read_file(pin.ETC / 'chrony-pin.json', 8192) require(sha(raw) == PUBLIC_PIN_SHA == pin_result['public_pin_sha256'] and raw == pin.encoded(actual_pin) and proof == pin_result['public_pin_metadata'], 'actual_unchanged_public_pin_and_original_metadata') dirs = {} for path in (pin.ETC, pin.RUN, pin.RUN / 'clients'): fd = pin.directory(path) try: current = pin.stable_directory(os.fstat(fd)) finally: os.close(fd) recorded = pin_result['targets'][str(path)] require(current == {key: recorded[key] for key in current}, 'original_runtime_directory_identity') dirs[str(path)] = current return dict(observation=original.expected, public_pin_sha256=PUBLIC_PIN_SHA, public_pin_metadata=proof, target_directories=dirs, peer_namespace=dict(result_sha256=NAMESPACE_RESULT_SHA, main_profile_sha256=namespace.MAIN_SHA, local_profile_sha256=NAMESPACE_LOCAL_SHA, main_profile_metadata=main_profile[1], local_profile_metadata=local_profile[1], parent_access_acl_hex=namespace.expected_acl().hex(), profile=current_profile)) before = fresh() os.mkdir(PHASE, mode=0o700, dir_fd=case_fd) os.fsync(case_fd) phase_fd = os.open(PHASE, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=case_fd) own_raw, _ = pin.read_file(Path(__file__).absolute(), 128 * 1024) binding = dict(profile=PROFILE, original_case=CASE, phase=PHASE, unit=UNIT, controller_sha256=sha(own_raw), operator_sha256=pin.OPERATOR_SHA, pin_controller_sha256=PIN_CONTROLLER_SHA, public_pin_sha256=PUBLIC_PIN_SHA, source_tar_sha256=original.source_sha, manifest_sha256=original.manifest_sha, artifact=ARTIFACT, original_group_receipt_sha256=GROUP_RECEIPT_SHA, original_probe_result_sha256=sha(old_raw), pin_result_sha256=PIN_RESULT_SHA, original_group_acceptance_controller_sha256=OLD_GROUP_CONTROLLER_SHA, original_group_acceptance_result_sha256=OLD_GROUP_RESULT_SHA, original_group_acceptance_log_sha256=OLD_GROUP_LOG_SHA, original_group_acceptance_receipt_sha256=OLD_GROUP_RECEIPT_SHA, original_dac_diagnostic_receipt_sha256=DAC_DIAGNOSTIC_RECEIPT_SHA, peer_namespace_controller_sha256=NAMESPACE_CONTROLLER_SHA, peer_namespace_result_sha256=NAMESPACE_RESULT_SHA, peer_namespace_local_profile_sha256=NAMESPACE_LOCAL_SHA, peer_namespace_receipt_sha256=NAMESPACE_RECEIPT_SHA, peer_namespace_read_receipt_sha256=NAMESPACE_READ_RECEIPT_SHA, original_dac_acceptance_controller_sha256=OLD_DAC_CONTROLLER_SHA, original_dac_acceptance_result_sha256=OLD_DAC_RESULT_SHA, original_dac_acceptance_log_sha256=OLD_GROUP_LOG_SHA, original_dac_acceptance_receipt_sha256=OLD_DAC_RECEIPT_SHA) pin.exclusive(phase_fd, 'intent.json', pin.encoded(dict(binding, once=True, no_retry=True))) groups = [] for gid in (989, 10001): try: group = grp.getgrgid(gid) groups.append(dict(gid=gid, name=group.gr_name, present=True)) except KeyError: groups.append(dict(gid=gid, present=False)) boot = original.expected['boot_id'] rows_raw = operator.run(['journalctl', '--unit=' + OLD_UNIT, '--boot=' + uuid.UUID(boot).hex, '--no-pager', '-n', '12', '-o', 'json'], timeout=10, limit=65536) rows = [pin.parsed(row) for row in rows_raw.splitlines()] group_before_exec(old, old_log, rows, groups) pin.exclusive(phase_fd, 'group-before-exec.json', pin.encoded(dict( unit=OLD_UNIT, boot_id=boot, original_receipt_sha256=GROUP_RECEIPT_SHA, original_probe_result_sha256=sha(old_raw), group_resolution=groups, journal_sha256=sha(rows_raw), pre_exec_group_failure=True))) pin.exclusive(phase_fd, 'before.json', pin.encoded(dict(binding, witness=before))) fresh() # Last source/runtime/pin guard before the single executable action. code = operator.long_command(probe_args(), BASE / PHASE / 'probe.log', 10) log_raw, _ = pin.read_file(BASE / PHASE / 'probe.log', 16384) execution = dict(binding, exit_code=code, probe_log_sha256=sha(log_raw)) pin.exclusive(phase_fd, 'execution.json', pin.encoded(execution)) after = fresh() require(before == after, 'all_original_runtime_boot_pin_source_witnesses_preserved') pin.exclusive(phase_fd, 'after.json', pin.encoded(dict(binding, witness=after))) sample = pin.parsed(log_raw) if code == 0 else None if code == 0: sample_quality(sample, boot) links = {} for name in ('before', 'after'): raw, _ = pin.read_file(BASE / PHASE / (name + '.json'), 16384) links[name + '_witness'] = dict(filename=name + '.json', sha256=sha(raw)) result = dict(binding, **links, exit_code=code, sample=sample, probe_log_sha256=sha(log_raw), source_quality_qualified=code == 0, runtime_boot_pin_source_preserved=True, clock_authority=False, signed_attestation=False, signer_created=False, broker_started=False, http_deployed=False) pin.exclusive(phase_fd, 'result.json', pin.encoded(result)) print(pin.encoded(result).decode('ascii'), end='') except Exception as error: if phase_fd >= 0: pin.exclusive(phase_fd, 'failure.json', pin.encoded(dict(profile=PROFILE, original_case=CASE, failed=True, exception_type=type(error).__name__, read_original_phase_only=True))) raise finally: if phase_fd >= 0: os.close(phase_fd) os.close(case_fd) def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('command', choices=('host-probe', 'host-read')) args = parser.parse_args() require(sys.flags.isolated == 1 and os.geteuid() == 0 and os.uname().sysname == 'Linux' and os.uname().machine == 'aarch64', 'isolated_root_linux_aarch64_only') os.umask(0o077) pin, guard = load_pin_controller() if args.command == 'host-read': host_read(pin) else: host_probe(pin, guard) if __name__ == '__main__': try: main() except Exception: print(json.dumps(dict(failed=True, read_original_phase_only=True)), flush=True) raise SystemExit(1)