feat: add automation scripts for checking and managing remote DNS and SSO services
This commit is contained in:
@@ -9,3 +9,4 @@ print("Aerodrome API auth test:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore'))
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -9,3 +9,4 @@ print("api/status response:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore'))
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -9,3 +9,4 @@ print("data-apiurl:")
|
||||
print(stdout.read().decode())
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -14,3 +14,4 @@ print("AddAuthentication strings:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore'))
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -9,3 +9,4 @@ print("grep divLoginSso:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore'))
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -9,3 +9,4 @@ print("/etc/dns listing:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore'))
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -14,3 +14,4 @@ print("pihole-FTL --config:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore')[:1500])
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -9,3 +9,4 @@ print("login.js lines 20-60:")
|
||||
print(stdout.read().decode())
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -9,3 +9,4 @@ print("login.js lines 60-110:")
|
||||
print(stdout.read().decode())
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -9,3 +9,4 @@ print("main.js lines 40-65:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore'))
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -18,3 +18,4 @@ print("ls /opt/pihole/:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore'))
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -10,3 +10,4 @@ print("pihole-FTL --help:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore')[:1000])
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -14,3 +14,4 @@ print("login.js locations:")
|
||||
print(stdout.read().decode())
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -16,3 +16,4 @@ print("pihole-FTL help:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore')[:1500])
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -9,3 +9,4 @@ print("pihole script lines 200-280:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore'))
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -14,3 +14,4 @@ print("Entrypoint check:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore')[:1500])
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -23,3 +23,4 @@ def check_pihole_toml(host, name):
|
||||
|
||||
check_pihole_toml('140.44.4.11', 'Aerodrome')
|
||||
check_pihole_toml('140.44.4.41', 'Spaceport')
|
||||
|
||||
|
||||
@@ -9,3 +9,4 @@ print("SetWebPassword implementation:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore'))
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -9,3 +9,4 @@ print("Recent logs:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore'))
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -15,3 +15,4 @@ print("divLoginSso in app:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore')[:1500])
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -14,3 +14,4 @@ print("auth.config raw:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore'))
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -14,3 +14,4 @@ print("AddOpenIdConnect:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore'))
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -14,3 +14,4 @@ print("/etc/dns/logs:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore'))
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -13,3 +13,4 @@ print("logs:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore')[:2000])
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -14,3 +14,4 @@ print("files:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore')[:2000])
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -9,3 +9,4 @@ print("utils.sh lines 130-175:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore'))
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -48,3 +48,4 @@ def configure_spaceport_technitium():
|
||||
ssh.close()
|
||||
|
||||
configure_spaceport_technitium()
|
||||
|
||||
|
||||
@@ -15,3 +15,4 @@ for i, line in enumerate(lines):
|
||||
for j in range(start, end):
|
||||
print(f"{j:4}: {lines[j]}")
|
||||
print()
|
||||
|
||||
|
||||
@@ -9,3 +9,4 @@ print("2026-11-06.log:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore'))
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -27,3 +27,4 @@ print("Recent logs:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore'))
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -25,3 +25,4 @@ print("Recent logs:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore'))
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -16,3 +16,4 @@ print("/etc/resolv.conf inside technitium pod:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore'))
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -19,3 +19,4 @@ print("FTL.log:")
|
||||
print(stdout.read().decode())
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -15,3 +15,4 @@ print("divLoginSso in index.html:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore'))
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -22,3 +22,4 @@ print("Technitium SSO get after set:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore'))
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -37,3 +37,4 @@ stdin, stdout, stderr = ssh.exec_command(f'k3s kubectl exec -n dns deployment/te
|
||||
print("SSO get after set:", stdout.read().decode())
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -14,3 +14,4 @@ print("divLoginSso check:")
|
||||
print(stdout.read().decode('utf-8', errors='ignore'))
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -11,3 +11,4 @@ print(stderr.read().decode('utf-8', errors='ignore'))
|
||||
print(stdout.read().decode('utf-8', errors='ignore')[:1000])
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -16,3 +16,4 @@ for host, label in [('140.44.4.36', 'Aerodrome (dns1)'), ('140.44.4.65', 'Spacep
|
||||
print(f" pass={pwd}: status={data.get('status')}, msg={data.get('errorMessage')}, token={tok_str}")
|
||||
except Exception as e:
|
||||
print(f" pass={pwd}: error={e}")
|
||||
|
||||
|
||||
@@ -36,3 +36,4 @@ stdin, stdout, stderr = ssh.exec_command(f'k3s kubectl exec -n dns deployment/te
|
||||
print("SSO get after set:", stdout.read().decode())
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
@@ -9,3 +9,4 @@ print("Auth with totp null:")
|
||||
print(stdout.read().decode())
|
||||
|
||||
ssh.close()
|
||||
|
||||
|
||||
53
scripts/update_pihole_launch_urls.py
Normal file
53
scripts/update_pihole_launch_urls.py
Normal file
@@ -0,0 +1,53 @@
|
||||
import urllib.request
|
||||
import ssl
|
||||
import json
|
||||
import sys
|
||||
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
|
||||
ctx = ssl.create_default_context()
|
||||
ctx.check_hostname = False
|
||||
ctx.verify_mode = ssl.CERT_NONE
|
||||
|
||||
token = "SnarfNetPermanentAutomationToken2026"
|
||||
headers = {
|
||||
"Authorization": f"Bearer {token}",
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
|
||||
def api_call(url, method="GET", payload=None):
|
||||
data = json.dumps(payload).encode('utf-8') if payload else None
|
||||
req = urllib.request.Request(url, headers=headers, data=data, method=method)
|
||||
try:
|
||||
with urllib.request.urlopen(req, context=ctx, timeout=8) as resp:
|
||||
return json.loads(resp.read().decode('utf-8'))
|
||||
except urllib.error.HTTPError as e:
|
||||
err = e.read().decode('utf-8')
|
||||
print(f"API Error {e.code} on {method} {url}: {err}")
|
||||
return None
|
||||
|
||||
print("Updating Pi-hole launch URLs in Authentik App Library...")
|
||||
|
||||
apps_update = [
|
||||
{
|
||||
"slug": "pihole1",
|
||||
"meta_launch_url": "https://pihole1.snarfnet.net/admin/"
|
||||
},
|
||||
{
|
||||
"slug": "pihole2",
|
||||
"meta_launch_url": "https://pihole2.snarfnet.net/admin/"
|
||||
}
|
||||
]
|
||||
|
||||
for app in apps_update:
|
||||
slug = app['slug']
|
||||
res = api_call(f"https://authentik.snarfnet.net/api/v3/core/applications/{slug}/", method="PATCH", payload=app)
|
||||
if res:
|
||||
print(f" ✓ Updated {slug} meta_launch_url to {res.get('meta_launch_url')}")
|
||||
|
||||
print("\nVerifying final state in Authentik:")
|
||||
final_apps = api_call("https://authentik.snarfnet.net/api/v3/core/applications/?page_size=100")
|
||||
for a in sorted(final_apps.get('results', []), key=lambda x: x['name']):
|
||||
if a['slug'] in ['pihole1', 'pihole2', 'dns1', 'dns2']:
|
||||
print(f" [{a['group']}] {a['name']}")
|
||||
print(f" Slug: {a['slug']} | Launch URL: {a['meta_launch_url']}")
|
||||
Reference in New Issue
Block a user