import paramiko import json SSH_KEY = r"C:\Users\Snarf\.ssh\id_ed25519_snarfnet" c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("140.44.4.41", username="root", key_filename=SSH_KEY, timeout=10) def k8s(cmd): full_cmd = f"kubectl {cmd}" _, o, e = c.exec_command(full_cmd) return o.read().decode().strip(), e.read().decode().strip() print("Authentik pods:") out, _ = k8s("get pods -A | grep -i authentik") print(out) # Check Authentik pod name pod = "" for line in out.splitlines(): if "server" in line: pod = line.split()[1] break print("Authentik server pod:", pod) if pod: # Query Authentik applications and proxy providers via manage.py or python out, err = k8s(f"exec -n authentik {pod} -- ak list_apps 2>/dev/null || kubectl exec -n authentik {pod} -- python -m authentik.manage shell -c 'from authentik.core.models import Application; print([(a.name, a.slug) for a in Application.objects.all()])'") print("Applications:", out, err) # Query Authentik proxy providers out, err = k8s(f"exec -n authentik {pod} -- python -m authentik.manage shell -c 'from authentik.providers.proxy.models import ProxyProvider; print([(p.name, p.external_host) for p in ProxyProvider.objects.all()])'") print("Proxy Providers:", out, err) c.close()