Update Setup.sh

This commit is contained in:
Niko Andreopoulos 2025-08-04 23:52:27 -04:00
parent a12023ed2c
commit 6ea6be8238

View file

@ -12,25 +12,28 @@ if [ "$(id -u)" -ne 0 ]; then
exit 1
fi
echo "[1/6] Updating system..."
echo "[1/7] Updating system..."
apt update && apt upgrade -y
echo "[2/6] Installing required packages..."
echo "[2/7] Installing required packages..."
apt install -y sudo curl
echo "[3/6] Setting up SSH key for root..."
echo "[3/7] Installing Docker..."
curl -fsSL https://get.docker.com/ | sudo sh
echo "[4/7] Setting up SSH key for root..."
mkdir -p "$SSH_DIR"
chmod 700 "$SSH_DIR"
touch "$AUTHORIZED_KEYS"
grep -qxF "$SSH_KEY" "$AUTHORIZED_KEYS" || echo "$SSH_KEY" >> "$AUTHORIZED_KEYS"
chmod 600 "$AUTHORIZED_KEYS"
echo "[4/6] Disabling password login for SSH..."
echo "[5/7] Disabling password login for SSH..."
sed -i 's/^#\?\s*PasswordAuthentication\s\+.*/PasswordAuthentication no/' /etc/ssh/sshd_config
sed -i 's/^#\?\s*ChallengeResponseAuthentication\s\+.*/ChallengeResponseAuthentication no/' /etc/ssh/sshd_config
sed -i 's/^#\?\s*UsePAM\s\+.*/UsePAM no/' /etc/ssh/sshd_config
echo "[5/6] Setting SSH login banner..."
echo "[6/7] Setting SSH login banner..."
cat << 'EOF' > /etc/issue.net
\033[1;34m
AUTHORIZED ACCESS ONLY
@ -48,11 +51,11 @@ EOF
sed -i 's|^#\?\s*Banner\s\+.*|Banner /etc/issue.net|' /etc/ssh/sshd_config
echo "[6/6] Restarting SSH service..."
echo "[7/7] Restarting SSH service..."
if command -v systemctl &>/dev/null; then
systemctl restart sshd
else
service ssh restart
fi
echo "[✔] Setup complete. System updated, SSH secured, and banner set."
echo "[✔] Setup complete. System updated, Docker installed, SSH secured, and banner set."