feat: add various infrastructure and service diagnostic scripts

This commit is contained in:
2026-11-06 09:02:19 -05:00
parent 00f22f33af
commit 1b8c862b10
59 changed files with 1499 additions and 58 deletions

View File

@@ -0,0 +1,25 @@
import paramiko
def check_pihole_toml(host, name):
print(f"=== {name} ({host}) ===")
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host, username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
stdin, stdout, stderr = ssh.exec_command('k3s kubectl exec -n dns deployment/pihole -- grep -A 10 "\[webserver" /etc/pihole/pihole.toml 2>/dev/null || true')
print("webserver section in pihole.toml:")
print(stdout.read().decode('utf-8', errors='ignore'))
stdin, stdout, stderr = ssh.exec_command('k3s kubectl exec -n dns deployment/pihole -- grep -rn "pwhash" /etc/pihole/ 2>/dev/null || true')
print("pwhash matches:")
print(stdout.read().decode('utf-8', errors='ignore'))
# Let's test logging into pihole API with curl using password "snarfnetadmin"
stdin, stdout, stderr = ssh.exec_command('k3s kubectl exec -n dns deployment/pihole -- curl -s -X POST "http://localhost/api/auth" -H "Content-Type: application/json" -d \'{"password":"snarfnetadmin"}\'')
print("API auth test:")
print(stdout.read().decode('utf-8', errors='ignore'))
ssh.close()
check_pihole_toml('140.44.4.11', 'Aerodrome')
check_pihole_toml('140.44.4.41', 'Spaceport')