From cac1f6a2dc598af93e9b1ba9125cd0187b856513 Mon Sep 17 00:00:00 2001 From: spektr Date: Fri, 27 Nov 2026 07:11:25 +0100 Subject: [PATCH] =?UTF-8?q?CT=20114:=20Audit=20pr=C3=BCft=20onion-only=20p?= =?UTF-8?q?er=20JSON-Parse=20statt=20Regex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit getnetworkinfo listet ipv4/ipv6 als Eintraege mit reachable=false — die alte Regex-Assertion war falsch. Jetzt JSON-Parse: onion reachable=true, ipv4/ipv6 nicht reachable (live gegen CT 114 bestätigt). Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe --- .../ansible/playbooks/audit-production.yml | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/proxmox/lxc/ct-114-litecoin-wallet/ansible/playbooks/audit-production.yml b/proxmox/lxc/ct-114-litecoin-wallet/ansible/playbooks/audit-production.yml index 1e4aa6f..70cc96e 100644 --- a/proxmox/lxc/ct-114-litecoin-wallet/ansible/playbooks/audit-production.yml +++ b/proxmox/lxc/ct-114-litecoin-wallet/ansible/playbooks/audit-production.yml @@ -136,21 +136,29 @@ - name: Read the litecoind network state via the read-only wrapper become: false - ansible.builtin.command: - argv: [/usr/bin/sudo, -n, /usr/local/bin/ltc-readonly, getnetworkinfo] + ansible.builtin.shell: | + /usr/bin/sudo -n /usr/local/bin/ltc-readonly getnetworkinfo | /usr/bin/python3 -c ' + import json, sys + data = json.load(sys.stdin) + reach = {n["name"]: n.get("reachable") for n in data["networks"]} + print("network reachability:", reach) + if reach.get("onion") is not True: + sys.exit("onion network is not reachable") + if reach.get("ipv4") is True or reach.get("ipv6") is True: + sys.exit("clearnet network is reachable; expected onion-only") + ' + args: + executable: /bin/bash check_mode: false changed_when: false register: litecoin_audit_networkinfo - when: not ansible_check_mode + when: + - not ansible_check_mode + - litecoin_service_start_allowed | bool - - name: Require onion-only networking when the node is running - ansible.builtin.assert: - that: - - >- - '"onion"' in litecoin_audit_networkinfo.stdout - - >- - litecoin_audit_networkinfo.stdout is not - search('"name": "(ipv4|ipv6)"') + - name: Report the onion-only network state + ansible.builtin.debug: + msg: "{{ litecoin_audit_networkinfo.stdout | default('check mode or node stopped: skipped') }}" when: - not ansible_check_mode - litecoin_service_start_allowed | bool