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

View File

@@ -0,0 +1,32 @@
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)
_, o, _ = c.exec_command("kubectl exec -n infra authentik-postgresql-0 -- cat /opt/bitnami/postgresql/secrets/password")
pw = o.read().decode().strip()
sql = """
\\echo '=== APPS ==='
SELECT name, slug FROM authentik_core_application;
\\echo '=== PROVIDERS ==='
SELECT name, external_host, mode FROM authentik_providers_proxy_proxyprovider;
\\echo '=== POLICIES ==='
SELECT name, expression FROM authentik_policies_expression_expressionpolicy;
"""
stdin, stdout, stderr = c.exec_command("cat > /tmp/query.sql")
stdin.write(sql)
stdin.close()
stdout.channel.recv_exit_status()
c.exec_command("kubectl cp /tmp/query.sql infra/authentik-postgresql-0:/tmp/query.sql")
cmd = f"kubectl exec -n infra authentik-postgresql-0 -- env PGPASSWORD='{pw}' psql -U authentik -d authentik -f /tmp/query.sql"
_, o, e = c.exec_command(cmd)
print(o.read().decode())
print("ERR:", e.read().decode())
c.close()