From 103c002efc779c48fcac819910f801498393bd1a Mon Sep 17 00:00:00 2001 From: Franscobec Date: Thu, 9 Apr 2026 19:18:19 -0400 Subject: [PATCH] Delete autoremakekeys.sh --- autoremakekeys.sh | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 autoremakekeys.sh diff --git a/autoremakekeys.sh b/autoremakekeys.sh deleted file mode 100644 index e554f60..0000000 --- a/autoremakekeys.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -NF="\e[0m" -CR="\e[38;5;9m" -USER=$(getent passwd 1000 | cut -d: -f1) - -#Verify if root -if [ "$UID" -ne 0 ]; then - echo -e "${CR}This script must be run as root.${NF}" - exit 1 -fi -##Generate keys -mkdir /.SSH/automated/.temp -ssh-keygen -f /.SSH/automated/.temp/id_ed25519 -N "" && -if [ -f /.SSH/automated/priv/servers/id_ed25519 ]; then -rm /.SSH/automated/priv/servers/id_ed25519 -fi -if [ -f /.SSH/automated/pub/servers/id_ed25519.pub ]; then -rm /.SSH/automated/pub/servers/id_ed25519.pub -fi -cat /.SSH/automated/.temp/id_ed25519 > /.SSH/automated/priv/servers/id_ed25519 -cat /.SSH/automated/.temp/id_ed25519.pub > /.SSH/automated/pub/servers/id_ed25519.pub -sha256sum /.SSH/automated/.temp/id_ed25519 | awk '{print $1}' > /home/$USER/sshprov/priv -sha256sum /.SSH/automated/.temp/id_ed25519.pub | awk '{print $1}' > /home/$USER/sshprov/pub -sleep 2 -rm -rf /.SSH/automated/.temp/ - -##Attribute to self & restart sshd -rm /home/$USER/.ssh/known_hosts -rm /root/.ssh/known_hosts -rm /root/.ssh/id_ed25519 -rm /root/.ssh/authorized_keys -cat /.SSH/automated/priv/servers/id_ed25519 > /root/.ssh/id_ed25519 -cat /.SSH/automated/pub/servers/id_ed25519.pub > /root/.ssh/authorized_keys && -chmod 700 /root/.ssh/id_ed25519 -chmod 644 /root/.ssh/authorized_keys -rm /home/$USER/.ssh/id_ed25519 -rm /home/$USER/.ssh/authorized_keys -cat /.SSH/automated/priv/servers/id_ed25519 > /home/$USER/.ssh/id_ed25519 -cat /.SSH/automated/pub/servers/id_ed25519.pub > /home/$USER/.ssh/authorized_keys && -chmod 700 /home/$USER/.ssh -chmod 600 /home/$USER/.ssh/id_ed25519 -chmod 600 /home/$USER/.ssh/authorized_keys -chown $USER -R /home/$USER/.ssh -systemctl restart sshd -