From b6fd58a7ca99df94e0fcfa0ca9080bed2dde073e Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Sun, 4 Jan 2026 13:30:22 -0600 Subject: [PATCH] more polish --- scripts/ssh-server-check.sh | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/scripts/ssh-server-check.sh b/scripts/ssh-server-check.sh index 0972f33..28bd012 100755 --- a/scripts/ssh-server-check.sh +++ b/scripts/ssh-server-check.sh @@ -173,27 +173,26 @@ EOF } if [[ ! -e $cfg_path ]]; then - prompt_user "sshd config" "Do you want to configure sshd?" + prompt_user "sshd" "Currently unconfigured for certs. Do you want to configure?" if [[ $REPLY =~ ^[Yy]$ ]]; then install_cert_config - update_prompt $GREEN_CHECK "Configured sshd" + update_prompt $GREEN_CHECK "sshd" "Configured to use and accept certs" fi fi + restart_sshd echo } restart_sshd() { - if ! systemctl is-active --quiet sshd; then - prompt_user "sshd.service" "sshd.service is not active. Restart?" - if [[ $REPLY =~ ^[Yy]$ ]]; then - systemctl restart sshd - local sshd_pid=$(systemctl show --property MainPID --value sshd) - update_prompt $GREEN_CHECK "Restarted sshd.service on PID: $sshd_pid" - fi + echo -en "$YELLOW_BANG Restarting sshd..." + systemctl restart sshd + if [[ $? -eq 0 ]]; then + local sshd_pid=$(systemctl show --property MainPID --value sshd) + update_prompt $GREEN_CHECK "sshd" "Restarted sshd.service on PID: $sshd_pid" else - local sshd_pid=$(systemctl show --property MainPID --value sshd) - echo -e "$GREEN_CHECK sshd.service is active on PID: $sshd_pid" + update_prompt $RED_X "sshd" "Failed to restart sshd.service" + exit 1 fi }