feat: add various infrastructure check and automation scripts

This commit is contained in:
2026-11-15 17:17:41 -05:00
parent 336b7759d0
commit b301aa3ece
232 changed files with 8274 additions and 298 deletions

44
scripts/run_ak_shell.py Normal file
View File

@@ -0,0 +1,44 @@
import paramiko
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.11", username="root", key_filename=SSH_KEY, timeout=10)
pod = "authentik-server-cd7d9b949-vfl2m"
py_script = """
import json
from authentik.core.models import Application
from authentik.providers.proxy.models import ProxyProvider
from authentik.policies.models import PolicyBindingModel, Policy
print('--- APPLICATIONS ---')
for a in Application.objects.all():
print(f"App: {a.name} (slug: {a.slug})")
print('\\n--- PROXY PROVIDERS ---')
for p in ProxyProvider.objects.all():
print(f"Provider: {p.name} | External: {p.external_host} | Internal: {p.internal_host} | Mode: {p.mode}")
print('\\n--- POLICIES ---')
for p in Policy.objects.all():
print(f"Policy: {p.name} ({p.__class__.__name__})")
print('\\n--- POLICY BINDINGS ---')
for pb in PolicyBindingModel.objects.all():
print(f"Binding: target={pb.target} -> policy={pb.policy} (enabled={pb.enabled}, order={pb.order})")
"""
stdin, stdout, stderr = c.exec_command("cat > /tmp/run_ak.py")
stdin.write(py_script)
stdin.close()
stdout.channel.recv_exit_status()
c.exec_command(f"kubectl cp /tmp/run_ak.py infra/{pod}:/tmp/run_ak.py -c server")
_, o, e = c.exec_command(f"kubectl exec -n infra {pod} -c server -- /ak-root/.venv/bin/python3 /manage.py shell < /tmp/run_ak.py")
print(o.read().decode())
print(e.read().decode())
c.close()