Files
SnarfCode/scripts/test_sso_and_ftl.py

26 lines
1.4 KiB
Python

import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('140.44.4.11', 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 -n -A 25 "setFTLConfigValue()" /usr/local/bin/pihole')
print("setFTLConfigValue:")
print(stdout.read().decode('utf-8', errors='ignore'))
# Also let's check what Technitium API call sets SSO
# In Technitium: /api/admin/sso/set
# Let's inspect /api/admin/sso/set with token
token = "8d22b3ee9fe8ccbb317679afdbc86959d0ceea8261e0f0c7957d4325a7987d78"
stdin, stdout, stderr = ssh.exec_command(f'k3s kubectl exec -n dns deployment/technitium-dns -- curl -s "http://localhost:5380/api/admin/sso/set?token={token}&ssoEnabled=true&ssoClientId=technitium-dns-oidc&ssoClientSecret=SnarfNetTechnitiumOIDC2026!&ssoMetadataAddress=https://authentik.snarfnet.net/application/o/dns1/.well-known/openid-configuration&ssoAllowSignup=true&ssoAllowSignupOnlyForMappedUsers=false"')
print("Technitium SSO set test:")
print(stdout.read().decode('utf-8', errors='ignore'))
# Check get after set
stdin, stdout, stderr = ssh.exec_command(f'k3s kubectl exec -n dns deployment/technitium-dns -- curl -s "http://localhost:5380/api/admin/sso/get?token={token}"')
print("Technitium SSO get after set:")
print(stdout.read().decode('utf-8', errors='ignore'))
ssh.close()