mirror of
https://github.com/buildplan/du_setup.git
synced 2026-04-26 18:45:57 +03:00
[PR #55] [MERGED] Fix: Improve robustness and safety of SSH hardening #59
Labels
No labels
bug
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/du_setup#59
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/buildplan/du_setup/pull/55
Author: @buildplan
Created: 10/13/2025
Status: ✅ Merged
Merged: 10/13/2025
Merged by: @buildplan
Base:
main← Head:ownership_fix📝 Commits (6)
98e26e6fix ssh permissions error for new user1f3932dFix variable name for log file in SSH testd12d50dAdd backup for original SSH confige1bef0bRefactor SSH service checks and error handlinga431785Remove trap - ERR statements for error handling6768913sha256 for v0.69📊 Changes
2 files changed (+37 additions, -15 deletions)
View changed files
📝
du_setup.sh(+36 -14)📝
du_setup.sh.sha256(+1 -1)📄 Description
This PR addresses a critical bug where the script would fail during SSH hardening on a fresh install (e.g., Debian 13) if a new user was created without providing a local SSH key.
The primary issue was a
Permission deniederror duringssh-keygen, which was caused by incorrect directory ownership. This failure also exposed a secondary bug where the rollback mechanism would fail because the configuration backup had not yet been created.Key Changes:
ssh-keygenFailure: Correctly setschownon the new user's.sshdirectory beforessh-keygenis run, resolving the permission error.sshd_configbackup to the beginning of theconfigure_sshfunction. This guarantees the error trap and rollback mechanism are always reliable.sshd -tcheck to validate the new SSH configuration before restarting the service, preventing accidental lockouts.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.