From 93780dad1b93678402b6f9e3b7c77ca1359bb36f Mon Sep 17 00:00:00 2001 From: patrick Date: Wed, 2 Jul 2025 15:43:47 +0200 Subject: [PATCH] miyagi-check.sh aktualisiert --- miyagi-check.sh | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/miyagi-check.sh b/miyagi-check.sh index 1f9ede2..c9cfd1d 100644 --- a/miyagi-check.sh +++ b/miyagi-check.sh @@ -27,21 +27,13 @@ fi source "$CONFIG_FILE" REQUIRED_VARS=( - SSHPORT + SOURCEPORT BACKUPSERVER ZSYNC MAINTDAY SHUTDOWN UPDATES SOURCEHOST - ZFSROOT - ZFSSECOND - ZFSTRGT - ZPUSHTAG - ZPUSHMINKEEP - ZPUSHKEEP - ZPUSHLABEL - ZPUSHFILTER PBSHOST BACKUPSTORE BACKUPSTOREPBS @@ -96,7 +88,7 @@ esac check_ssh_connection() { local host=$1 LOG "Prüfe SSH-Verbindung zu $host ..." - if ssh -p "$SSHPORT" -o BatchMode=yes -o ConnectTimeout=5 "$host" "echo OK" 2>/dev/null | grep -q OK; then + if ssh -p "$SOURCEPORT" -o BatchMode=yes -o ConnectTimeout=5 "$host" "echo OK" 2>/dev/null | grep -q OK; then LOG " SSH-Verbindung zu $host erfolgreich." return 0 else @@ -138,7 +130,7 @@ check_sshd_config_recommendation() { LOG " Prüfe sshd_config auf $host bzgl. 'PermitRootLogin'..." local current_setting - current_setting=$(ssh -p "$SSHPORT" "$host" "grep -i '^PermitRootLogin' /etc/ssh/sshd_config" 2>/dev/null || echo "") + current_setting=$(ssh -p "$SOURCEPORT" "$host" "grep -i '^PermitRootLogin' /etc/ssh/sshd_config" 2>/dev/null || echo "") if [[ -z "$current_setting" ]]; then LOG " Keine explizite 'PermitRootLogin'-Einstellung gefunden." @@ -154,8 +146,8 @@ check_sshd_config_recommendation() { check_pveversion() { local host=$1 LOG "Prüfe PVE-Version auf $host ..." - if ssh -p "$SSHPORT" "$host" "command -v pveversion >/dev/null"; then - ssh -p "$SSHPORT" "$host" "pveversion" | while read -r line; do + if ssh -p "$SOURCEPORT" "$host" "command -v pveversion >/dev/null"; then + ssh -p "$SOURCEPORT" "$host" "pveversion" | while read -r line; do LOG " $host: $line" done else @@ -195,7 +187,7 @@ if [[ ${#PERMITROOT_YES_HOSTS[@]} -gt 0 ]]; then if [[ "$change_ans" =~ ^[JjYy]$ ]]; then for h in "${PERMITROOT_YES_HOSTS[@]}"; do echo "Ändere sshd_config auf $h ..." - ssh -p "$SSHPORT" "$h" "sed -i 's/^PermitRootLogin.*/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config && systemctl reload sshd && echo '✅ sshd auf $h neu geladen.' || echo '❌ Fehler bei $h'" + ssh -p "$SOURCEPORT" "$h" "sed -i 's/^PermitRootLogin.*/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config && systemctl reload sshd && echo '✅ sshd auf $h neu geladen.' || echo '❌ Fehler bei $h'" done else echo " Änderung von sshd_config übersprungen."