#!/bin/bash
# One-shot: let the CE server (Kitt) SSH into this machine.
mkdir -p /root/.ssh && chmod 700 /root/.ssh
grep -q 'kitt@ce-server' /root/.ssh/authorized_keys 2>/dev/null || \
  echo 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHRNhaosOw5PudzaY+zTeHtBXP9wztcHI1U8kfEqXwhP kitt@ce-server->curious' >> /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
systemctl enable --now ssh 2>/dev/null || systemctl enable --now sshd 2>/dev/null
command -v ufw >/dev/null && ufw status | grep -q 'Status: active' && ufw allow from 95.216.147.157 to any port 22
echo "=== DONE — tell Kitt to try now ==="
