22 lines
680 B
Python
22 lines
680 B
Python
import paramiko
|
|
import sys
|
|
|
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
key_path = r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet'
|
|
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect("140.44.4.71", username="root", key_filename=key_path, timeout=10)
|
|
|
|
def check_cert(num):
|
|
cmd = f"docker exec $(docker ps -q -f name=nginx-proxy-manager_app | head -n1) openssl x509 -in /etc/letsencrypt/live/{num}/fullchain.pem -noout -text | grep -A 2 'Subject Alternative Name'"
|
|
stdin, stdout, stderr = c.exec_command(cmd)
|
|
print(f"Cert {num}:", stdout.read().decode().strip())
|
|
|
|
check_cert("npm-1")
|
|
check_cert("npm-33")
|
|
check_cert("npm-37")
|
|
|
|
c.close()
|
|
|