#!/bin/bash
SERVER_IP="45.61.60.10"
SERVER_USER="root"
SERVER_PASS="UQb9TgSwC@vwhEM"

/usr/bin/expect <<EOF
set timeout 30
spawn ssh -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP

expect {
    "password:" { send "$SERVER_PASS\r" }
    "yes/no" { send "yes\r"; exp_continue }
}

expect "#"
send "ls -F /etc/nginx/\r"
send "ls -F /etc/nginx/sites-available/\r"
send "ls -F /etc/nginx/sites-enabled/\r"
send "echo '--- EXISTING CERTS ---'\r"
send "find /etc/letsencrypt -name '*.pem' -o -name '*.crt' | head -n 10\r"
send "cat /etc/nginx/nginx.conf\r"
send "exit\r"
expect eof
EOF
