From 6fc8e995648a1b409ebd755c6b0aa91ce73e7bee Mon Sep 17 00:00:00 2001 From: buildplan Date: Wed, 15 Oct 2025 22:32:46 +0100 Subject: [PATCH 1/3] fix ssh roll back --- du_setup.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/du_setup.sh b/du_setup.sh index efe8405..5d68c48 100644 --- a/du_setup.sh +++ b/du_setup.sh @@ -1834,14 +1834,11 @@ rollback_ssh_changes() { fi # Remove systemd overrides for both service and socket - local OVERRIDE_DIR="/etc/systemd/system/${SSH_SERVICE}.d" - local SOCKET_OVERRIDE_DIR="/etc/systemd/system/ssh.socket.d" - local SERVICE_OVERRIDE_DIR="/etc/systemd/system/ssh.service.d" - if ! rm -rf "$OVERRIDE_DIR" "$SOCKET_OVERRIDE_DIR" "$SERVICE_OVERRIDE_DIR" 2>/dev/null; then - print_warning "Failed to remove systemd overrides at $OVERRIDE_DIR, $SOCKET_OVERRIDE_DIR, or $SERVICE_OVERRIDE_DIR." + if ! rm -rf /etc/systemd/system/ssh.service.d /etc/systemd/system/sshd.service.d /etc/systemd/system/ssh.socket.d 2>/dev/null; then + print_warning "Could not remove one or more systemd override directories." log "Rollback warning: Failed to remove systemd overrides." else - log "Removed systemd overrides: $OVERRIDE_DIR, $SOCKET_OVERRIDE_DIR, $SERVICE_OVERRIDE_DIR" + log "Removed all potential systemd override directories for SSH." fi # Remove custom SSH configuration From 8ea6832fe595445931098e5a3fec211b5c45e55d Mon Sep 17 00:00:00 2001 From: buildplan Date: Wed, 15 Oct 2025 22:50:25 +0100 Subject: [PATCH 2/3] Correct ssh rollback message --- du_setup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/du_setup.sh b/du_setup.sh index 5d68c48..7e43df0 100644 --- a/du_setup.sh +++ b/du_setup.sh @@ -1821,8 +1821,9 @@ rollback_ssh_changes() { print_info "Detected SSH socket activation: using ssh.socket." log "Rollback: Using ssh.socket for SSH service." elif ! systemctl list-units --full -all --no-pager | grep -E "[[:space:]]${SSH_SERVICE}[[:space:]]" >/dev/null 2>&1; then + local initial_service_check="$SSH_SERVICE" SSH_SERVICE="ssh.service" # Fallback for Ubuntu - print_warning "SSH service $SSH_SERVICE not found, falling back to ssh.service." + print_warning "SSH service '$initial_service_check' not found, falling back to '$SSH_SERVICE'." log "Rollback warning: Using fallback SSH service ssh.service." # Verify fallback service exists if ! systemctl list-units --full -all --no-pager | grep -E "[[:space:]]ssh.service[[:space:]]" >/dev/null 2>&1; then From 9de3b5d0a80cfcd9cabda83fef302a407323e220 Mon Sep 17 00:00:00 2001 From: buildplan <170122315+buildplan@users.noreply.github.com> Date: Wed, 15 Oct 2025 23:30:30 +0100 Subject: [PATCH 3/3] Add warning for firewall configuration check --- du_setup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/du_setup.sh b/du_setup.sh index 7e43df0..9d59e11 100644 --- a/du_setup.sh +++ b/du_setup.sh @@ -1772,6 +1772,7 @@ EOF fi print_warning "CRITICAL: Test new SSH connection in a SEPARATE terminal NOW!" + print_warning "ACTION REQUIRED: Check your VPS provider's edge/network firewall to allow $SSH_PORT/tcp." if [[ -n "$SERVER_IP_V4" && "$SERVER_IP_V4" != "unknown" ]]; then print_info "Use IPv4: ssh -p $SSH_PORT $USERNAME@$SERVER_IP_V4" fi