class Kitsune::Kit::Commands::SetupUser

def perform_rollback_config(ssh)

def perform_rollback_config(ssh)
  output = ssh.exec! <<~'EOH'
    set -e
    echo "🔁 Backing up SSH config…"
    sudo test -f /etc/ssh/sshd_config.bak || sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak && echo "   - sshd_config backed up"
    echo "✍🏻 Restoring SSH config…"
    grep -q '^PermitRootLogin yes' /etc/ssh/sshd_config \
      || sudo sed -i 's/^#*PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config && echo "   - PermitRootLogin yes"
    grep -q '^PasswordAuthentication yes' /etc/ssh/sshd_config \
      || sudo sed -i 's/^#*PasswordAuthentication .*/PasswordAuthentication yes/' /etc/ssh/sshd_config && echo "   - PasswordAuthentication yes"
    sudo systemctl restart sshd && echo "   - sshd restarted"
  EOH
  say output
  say "✅ SSH config restored, closing deploy session", :green
end