#!/bin/bash

# Ändern der SSH-Konfiguration
sed -i "/^#\\?PasswordAuthentication/c\PasswordAuthentication yes" /etc/ssh/sshd_config
sed -i "/PasswordAuthentication no/PasswordAuthentication yes" /etc/ssh/sshd_config
sed -i "/^#\\?PermitRootLogin/c\PermitRootLogin yes" /etc/ssh/sshd_config
systemctl restart sshd

# Setzen des Nameservers
rm /etc/resolv.conf
touch /etc/resolv.conf
echo "nameserver 8.8.8.8" > /etc/resolv.conf
systemctl restart systemd-resolved

# ASCII-Art für "EmeraldHost"
MOTD='    ______                          _     _ _    _           _   
   |  ____|                        | |   | | |  | |         | |  
   | |__   _ __ ___   ___ _ __ __ _| | __| | |__| | ___  ___| |_ 
   |  __| | '\''_ ` _ \ / _ \ '\''__/ _` | |/ _` |  __  |/ _ \/ __| __|
   | |____| | | | | |  __/ | | (_| | | (_| | |  | | (_) \__ \ |_ 
   |______|_| |_| |_|\___|_|  \__,_|_|\__,_|_|  |_|\___/|___/\__|
                                                                 '

# Funktion zum Setzen der MOTD
set_motd() {
  echo -e "$MOTD" > /etc/motd
}

# Setzen der MOTD
set_motd

systemctl disable first-boot.service
rm /etc/systemd/system/first-boot.service
systemctl daemon-reload

# Löschen des Skripts nach Ausführung
rm -- "$0"