Update Linux/SSH/secure_ssh.sh

This commit is contained in:
2025-05-06 12:05:36 +00:00
parent bc221cb8f5
commit 14c80bd15f

View File

@@ -272,14 +272,11 @@ else
fi
# Konfiguriere SSH für die Include-Direktive
# Prüfe zunächst, ob die Include-Direktive bereits in der Hauptkonfigurationsdatei vorhanden ist
if ! sudo grep -q "^Include $SSH_CONFIG_DIR" "$SSH_MAIN_CONFIG" 2>/dev/null; then
warn "Include-Direktive wird zur Hauptkonfigurationsdatei hinzugefügt..."
echo "Include $SSH_CONFIG_DIR/*" | sudo tee -a "$SSH_MAIN_CONFIG" > /dev/null
log "Include-Direktive hinzugefügt."
else
log "Include-Direktive ist bereits in der Hauptkonfigurationsdatei vorhanden."
fi
warn "Setze /etc/ssh/sshd_config zurück auf IncludeDirektive..."
sudo tee "$SSH_MAIN_CONFIG" > /dev/null <<EOF
Include $SSH_CONFIG_DIR/*.conf
EOF
log "/etc/ssh/sshd_config enthält jetzt nur noch die IncludeDirektive."
# Bereinige alte Konfigurationsdateien im SSH_CONFIG_DIR
sudo rm -f $SSH_CONFIG_DIR/*