CT 114: Audit prüft onion-only per JSON-Parse statt Regex
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 <vibe@mistral.ai>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user