From 17ca433d0c4b6c71e74a4c49739303f6062b92c8 Mon Sep 17 00:00:00 2001 From: Snarf Date: Thu, 5 Nov 2026 11:17:12 -0500 Subject: [PATCH] feat: add diagnostic scripts for gateway and DNS investigation --- scripts/check_gateway.py | 20 ++++++++++++++++++++ scripts/check_gateway_type.py | 16 ++++++++++++++++ scripts/check_pending_reasons.py | 25 +++++++++++++++++++++++++ scripts/find_dns_files.py | 1 + scripts/inspect_dns_details.py | 30 ++++++++++++++++++++++++++++++ scripts/investigate_dns_stubs.py | 1 + 6 files changed, 93 insertions(+) create mode 100644 scripts/check_gateway.py create mode 100644 scripts/check_gateway_type.py create mode 100644 scripts/check_pending_reasons.py create mode 100644 scripts/inspect_dns_details.py diff --git a/scripts/check_gateway.py b/scripts/check_gateway.py new file mode 100644 index 0000000..54ecc14 --- /dev/null +++ b/scripts/check_gateway.py @@ -0,0 +1,20 @@ +import paramiko +import sys + +sys.stdout.reconfigure(encoding='utf-8') + +key_path = r"C:\Users\Snarf\.ssh\id_ed25519_snarfnet" +c = paramiko.SSHClient() +c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) +c.connect("140.44.4.11", username="root", key_filename=key_path, timeout=10) + +stdin, stdout, stderr = c.exec_command("curl -k -s -I http://140.44.4.1/ || curl -k -s -I https://140.44.4.1/") +print("Gateway 140.44.4.1 HTTP headers:") +print(stdout.read().decode('utf-8')) + +stdin, stdout, stderr = c.exec_command("arp -an | grep 140.44.4.1") +print("ARP for 140.44.4.1:") +print(stdout.read().decode('utf-8')) + +c.close() + diff --git a/scripts/check_gateway_type.py b/scripts/check_gateway_type.py new file mode 100644 index 0000000..b7fa783 --- /dev/null +++ b/scripts/check_gateway_type.py @@ -0,0 +1,16 @@ +import paramiko +import sys + +sys.stdout.reconfigure(encoding='utf-8') + +key_path = r"C:\Users\Snarf\.ssh\id_ed25519_snarfnet" +c = paramiko.SSHClient() +c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) +c.connect("140.44.4.11", username="root", key_filename=key_path, timeout=10) + +stdin, stdout, stderr = c.exec_command("curl -k -s -L https://140.44.4.1/ | grep -iE 'title|unifi|opnsense|pfsense|mikrotik|netgate|firewall|router'") +print("Gateway 140.44.4.1 HTML match:") +print(stdout.read().decode('utf-8')) + +c.close() + diff --git a/scripts/check_pending_reasons.py b/scripts/check_pending_reasons.py new file mode 100644 index 0000000..0098989 --- /dev/null +++ b/scripts/check_pending_reasons.py @@ -0,0 +1,25 @@ +import paramiko +import sys + +sys.stdout.reconfigure(encoding='utf-8') + +key_path = r"C:\Users\Snarf\.ssh\id_ed25519_snarfnet" + +c = paramiko.SSHClient() +c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) +c.connect("140.44.4.11", username="root", key_filename=key_path, timeout=10) + +stdin, stdout, stderr = c.exec_command("k3s kubectl -n infra get events --field-selector reason=FailedScheduling") +print("Aerodrome Scheduling Events:") +print(stdout.read().decode('utf-8')) +c.close() + +c2 = paramiko.SSHClient() +c2.set_missing_host_key_policy(paramiko.AutoAddPolicy()) +c2.connect("140.44.4.41", username="root", key_filename=key_path, timeout=10) + +stdin, stdout, stderr = c2.exec_command("k3s kubectl -n infrastructure get events --field-selector reason=FailedScheduling") +print("Spaceport Scheduling Events:") +print(stdout.read().decode('utf-8')) +c2.close() + diff --git a/scripts/find_dns_files.py b/scripts/find_dns_files.py index 4ad7135..1ce8a91 100644 --- a/scripts/find_dns_files.py +++ b/scripts/find_dns_files.py @@ -11,3 +11,4 @@ for root, dirs, files in os.walk(r"c:\Users\Snarf\OneDrive\Desktop\code\SnarfCod for m in matches[:30]: print(m) + diff --git a/scripts/inspect_dns_details.py b/scripts/inspect_dns_details.py new file mode 100644 index 0000000..3c5021c --- /dev/null +++ b/scripts/inspect_dns_details.py @@ -0,0 +1,30 @@ +import paramiko +import sys + +sys.stdout.reconfigure(encoding='utf-8') + +key_path = r"C:\Users\Snarf\.ssh\id_ed25519_snarfnet" + +def check(host, ns, name): + print(f"\n=================== {name} ({host}) ===================") + c = paramiko.SSHClient() + c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(host, username="root", key_filename=key_path, timeout=10) + + print("\n--- Pods in ns " + ns + " ---") + stdin, stdout, stderr = c.exec_command(f"k3s kubectl -n {ns} get pods -o wide") + print(stdout.read().decode('utf-8')) + + print("\n--- Pihole Pod describe/logs ---") + stdin, stdout, stderr = c.exec_command(f"k3s kubectl -n {ns} describe deploy/pihole | grep -E 'Image:|Environment|Mounts|Volumes'") + print(stdout.read().decode('utf-8')) + + print("\n--- Technitium Pod describe/logs ---") + stdin, stdout, stderr = c.exec_command(f"k3s kubectl -n {ns} describe deploy/technitium-dns | grep -E 'Image:|Environment|Mounts|Volumes'") + print(stdout.read().decode('utf-8')) + + c.close() + +check("140.44.4.11", "infra", "Aerodrome") +check("140.44.4.41", "infrastructure", "Spaceport") + diff --git a/scripts/investigate_dns_stubs.py b/scripts/investigate_dns_stubs.py index a6ab9a6..1b0ca54 100644 --- a/scripts/investigate_dns_stubs.py +++ b/scripts/investigate_dns_stubs.py @@ -31,3 +31,4 @@ def check(host, name): check("140.44.4.11", "Aerodrome") check("140.44.4.41", "Spaceport") +