34 lines
1.7 KiB
Python
34 lines
1.7 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)
|
|
|
|
# Check pihole config in /etc/pihole
|
|
stdin, stdout, stderr = ssh.exec_command('k3s kubectl exec -n dns deployment/pihole -- grep -i password /etc/pihole/pihole.toml 2>/dev/null || true')
|
|
print("pihole.toml password:")
|
|
print(stdout.read().decode('utf-8', errors='ignore'))
|
|
|
|
# Check pihole env
|
|
stdin, stdout, stderr = ssh.exec_command('k3s kubectl exec -n dns deployment/pihole -- env | grep -E "WEBPASSWORD|FTLCONF"')
|
|
print("pihole env:")
|
|
print(stdout.read().decode('utf-8', errors='ignore'))
|
|
|
|
# Let's test pihole web login via curl inside the pod or to localhost:80
|
|
stdin, stdout, stderr = ssh.exec_command('k3s kubectl exec -n dns deployment/pihole -- curl -s -I http://localhost/admin/')
|
|
print("curl localhost/admin/ header:")
|
|
print(stdout.read().decode('utf-8', errors='ignore'))
|
|
|
|
# Check Technitium SSO settings via API using the valid 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/get?token={token}"')
|
|
print("Technitium SSO get:")
|
|
print(stdout.read().decode('utf-8', errors='ignore'))
|
|
|
|
# Check Technitium info or settings
|
|
stdin, stdout, stderr = ssh.exec_command(f'k3s kubectl exec -n dns deployment/technitium-dns -- curl -s "http://localhost:5380/api/settings/get?token={token}"')
|
|
print("Technitium settings get (sample):")
|
|
print(stdout.read().decode('utf-8', errors='ignore')[:300])
|
|
|
|
ssh.close()
|