[VPN] Add CF/VPN selfcheck and retry tunnel URL sync
lint / hygiene (push) Failing after 30s
standard / check (push) Successful in 12s

This commit is contained in:
root committed 2026-11-23 19:58:25 +03:00
1 parent 501b5b2e60
commit 069aad8284
2 files changed
+41 -2

No files matched your search

+29 -1
View File
@@ -258,12 +258,40 @@ def check_tool_gateway():
ok = active == "active" and '"ok": true' in health
add("Tool Gateway", ok, "active=%s health=%s" % (active, health[:60]))
def check_vpn_cf():
"""Последняя health-проба VPN + совпадение CF-профиля с cf-host.txt."""
lastp = "/var/lib/vpn-health/last.json"
try:
last = json.load(open(lastp, encoding="utf-8"))
except Exception as e:
return add("VPN/CF", False, "нет %s: %s" % (lastp, str(e)[:80]))
cf = last.get("cf") or {}
cf_ok = bool(cf.get("ok")) and cf.get("code") in (400, 404, 426)
host = (last.get("cf_host") or "").strip()
try:
want = open("/root/buryan-infra/ops/vpn/cf-host.txt", encoding="utf-8").read().strip()
except Exception:
want = ""
prof = "/root/buryan-infra/ops/vpn/build/profiles/vpn-akadmin.json"
addr = ""
try:
d = json.load(open(prof, encoding="utf-8"))
ob = next((o for o in d.get("outbounds", []) if o.get("tag") == "proxy-cf"), None)
addr = ((ob or {}).get("settings", {}).get("vnext") or [{}])[0].get("address", "")
except Exception:
pass
ok = cf_ok and host == want and addr == want.replace("https://", "")
add("VPN/CF", ok, "cf=%s code=%s host=%s profile=%s" %
(cf.get("ok"), cf.get("code"), host[-35:], addr[-35:]))
def main():
print("Самопроверка платформы", date.today().isoformat())
checks = [check_units, check_services, check_bots, check_matrix_sso, check_ollama,
check_n8n, check_digests, check_reports, check_registry, check_cron_dots,
check_tasks, check_approvals, check_hermes, check_errors, check_disk,
check_lvm, check_pg_conn, check_tool_gateway]
check_lvm, check_pg_conn, check_tool_gateway, check_vpn_cf]
for fn in checks:
try:
fn()