{
  "schema_version": 1,
  "channel": "homelab-runtime",
  "command_id": "READER-VM130-PUT-INTERFACE-AUDIT-331",
  "status": "OK",
  "rc": 0,
  "host": "pve01",
  "mode": "read-only",
  "component": "cluster-audit",
  "started_at_utc": "2026-07-23T05:02:19Z",
  "finished_at_utc": "2026-07-23T05:02:19Z",
  "reference_register_checked": true,
  "reference_sha256": "5763f2f8edc75fcf6f3951f8c95896d1cc112ceccb6cf5b64a383f540a4deb8e",
  "error_register_checked": true,
  "error_register_sha256": "08b3a769b8e38eaa1acec915352fb328180d70caa7ff6cd9d1ec0da426262752",
  "command_sha256": "e8c9b036754a539b1282f1d1a4f3c2e6aacd2c36db93f7ab61f759039c7b9dc3",
  "duplicate_failed_command_blocked": false,
  "block_reason": null,
  "execution_started": true,
  "changes_made": false,
  "sanitized": true,
  "secrets_included": false,
  "private_addresses_included": false,
  "raw_evidence_retained_locally": true,
  "raw_evidence_sha256": "b8700f3f22291a9240833ee3553ab23c76aa5fb1d21c5659f330f36ffa8931f4",
  "sanitized_output_sha256": "b8700f3f22291a9240833ee3553ab23c76aa5fb1d21c5659f330f36ffa8931f4",
  "output_truncated_in_json": false,
  "full_sanitized_output_url": "https://git.gram1.ru/.well-known/homelab-runtime/latest.txt",
  "output": "DETAIL=LOCAL_DEPENDENCY=PASS:/usr/bin/test\nDETAIL=LOCAL_DEPENDENCY=PASS:/usr/bin/sha256sum\nDETAIL=LOCAL_DEPENDENCY=PASS:/usr/bin/awk\nDETAIL=LOCAL_DEPENDENCY=PASS:/usr/bin/sed\nDETAIL=LOCAL_DEPENDENCY=PASS:/usr/bin/bash\nDETAIL=LOCAL_DEPENDENCY=PASS:/usr/bin/stat\nDETAIL=PUT_HELPER_SHA256=1166303044c104bcce68a5557b297ea034205ae8c497da7199e8a9f1cffc6bd8\nDETAIL=PUT_HELPER_INTEGRITY=PASS\nDETAIL=PUT_HELPER_METADATA=root:root|750|3227|regular file\nDETAIL=PUT_HELPER_FIRST_LINE=#!/usr/bin/bash\nDETAIL=PUT_HELPER_SYNTAX=PASS\nDETAIL=PUT_HELPER_LINE_COUNT=83\nDETAIL=PUT_HELPER_SOURCE_BEGIN\n#!/usr/bin/bash\nset -Eeuo pipefail\n\nreadonly VM_HELPER=/usr/local/sbin/homelab-vm130-exec\nreadonly VM_HELPER_SHA256=1959773393723b013af7c93cd29a7b833fd607c903d044e2fcef6accaa29c275\nreadonly SSH=/usr/bin/ssh\nreadonly JQ=/usr/bin/jq\nreadonly SHA256SUM=/usr/bin/sha256sum\nreadonly STAT=/usr/bin/stat\nreadonly MKTEMP=/usr/bin/mktemp\nreadonly RM=/usr/bin/rm\nreadonly CAT=/usr/bin/cat\nreadonly HOST=root@pve03\nreadonly VMID=130\nreadonly MAX_SIZE=1048576\n\nfail() {\n    printf 'VM130_PUT_ERROR=%s\\n' \"$1\" >&2\n    exit \"${2:-1}\"\n}\n\n(( $# == 2 )) || fail USAGE 64\nsource_file=$1\nremote_name=$2\n\n[[ \"$remote_name\" =~ ^homelab-[A-Za-z0-9._-]{1,96}$ ]] || fail REMOTE_NAME 65\nremote_file=\"/tmp/$remote_name\"\n\n[[ -x \"$VM_HELPER\" ]] || fail VM_HELPER_MISSING 69\nactual_vm_sha=$(\"$SHA256SUM\" \"$VM_HELPER\" | /usr/bin/awk '{print $1}')\n[[ \"$actual_vm_sha\" == \"$VM_HELPER_SHA256\" ]] || fail VM_HELPER_INTEGRITY 70\n\n[[ -f \"$source_file\" && ! -L \"$source_file\" ]] || fail SOURCE_TYPE 66\nsource_meta=$(\"$STAT\" -c '%U:%G|%a|%s|%F' \"$source_file\")\nIFS='|' read -r source_owner source_mode source_size source_type <<<\"$source_meta\"\n[[ \"$source_owner\" == root:root && \"$source_mode\" == 600 && \"$source_type\" == regular*file ]] || fail SOURCE_METADATA 66\n[[ \"$source_size\" =~ ^[0-9]+$ ]] && (( source_size > 0 && source_size <= MAX_SIZE )) || fail SOURCE_SIZE 66\nsource_sha=$(\"$SHA256SUM\" \"$source_file\" | /usr/bin/awk '{print $1}')\n\nif \"$VM_HELPER\" /usr/bin/test -e \"$remote_file\"; then\n    fail REMOTE_EXISTS 68\nfi\n\ntmpdir=$(\"$MKTEMP\" -d /tmp/homelab-vm130-put.XXXXXX)\nremote_created=NO\ncleanup() {\n    rc=$?\n    if [[ \"$remote_created\" == YES && \"$rc\" -ne 0 ]]; then\n        \"$VM_HELPER\" /usr/bin/rm -f -- \"$remote_file\" >/dev/null 2>&1 || true\n    fi\n    \"$RM\" -rf -- \"$tmpdir\"\n}\ntrap cleanup EXIT\n\nprintf -v remote_cmd '%q ' /usr/sbin/qm guest exec \"$VMID\" --pass-stdin 1 -- /usr/bin/dd \"of=$remote_file\" status=none\nif raw=$(\"$SSH\" -o BatchMode=yes -o ConnectTimeout=8 \"$HOST\" \"$remote_cmd\" <\"$source_file\" 2>\"$tmpdir/ssh.err\"); then\n    ssh_rc=0\nelse\n    ssh_rc=$?\nfi\n(( ssh_rc == 0 )) || {\n    \"$CAT\" \"$tmpdir/ssh.err\" >&2\n    fail SSH_FAILURE 125\n}\n\"$JQ\" -e 'type==\"object\" and (.exited==1) and (.exitcode|type==\"number\")' <<<\"$raw\" >/dev/null 2>&1 || fail INVALID_QGA_JSON 126\nguest_rc=$(\"$JQ\" -r '.exitcode' <<<\"$raw\")\nguest_out=$(\"$JQ\" -r '.\"out-data\" // empty' <<<\"$raw\")\nguest_err=$(\"$JQ\" -r '.\"err-data\" // empty' <<<\"$raw\")\n[[ \"$guest_rc\" == 0 && -z \"$guest_out\" && -z \"$guest_err\" ]] || fail GUEST_WRITE 74\nremote_created=YES\n\n\"$VM_HELPER\" /usr/bin/chown root:root \"$remote_file\"\n\"$VM_HELPER\" /usr/bin/chmod 0600 \"$remote_file\"\nremote_meta=$(\"$VM_HELPER\" /usr/bin/stat -c '%U:%G|%a|%s|%F' \"$remote_file\")\nIFS='|' read -r remote_owner remote_mode remote_size remote_type <<<\"$remote_meta\"\n[[ \"$remote_owner\" == root:root && \"$remote_mode\" == 600 && \"$remote_size\" == \"$source_size\" && \"$remote_type\" == regular*file ]] || fail REMOTE_METADATA 74\nremote_sha=$(\"$VM_HELPER\" /usr/bin/sha256sum \"$remote_file\" | /usr/bin/awk '{print $1}')\n[[ \"$remote_sha\" == \"$source_sha\" ]] || fail REMOTE_INTEGRITY 74\n\nprintf 'VM130_PUT=READY\\n'\nprintf 'REMOTE_FILE=%s\\n' \"$remote_file\"\nprintf 'SIZE=%s\\n' \"$source_size\"\nprintf 'SHA256=%s\\n' \"$source_sha\"\nDETAIL=PUT_HELPER_SOURCE_END\nDETAIL=PUT_HELPER_SOURCE_TRUNCATED=NO\nCHANGES_MADE=NO\n"
}
