more polish

This commit is contained in:
John Lancaster
2026-01-04 13:30:22 -06:00
parent d30123dc4a
commit b6fd58a7ca

View File

@@ -173,27 +173,26 @@ EOF
} }
if [[ ! -e $cfg_path ]]; then 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 if [[ $REPLY =~ ^[Yy]$ ]]; then
install_cert_config install_cert_config
update_prompt $GREEN_CHECK "Configured sshd" update_prompt $GREEN_CHECK "sshd" "Configured to use and accept certs"
fi fi
fi fi
restart_sshd restart_sshd
echo echo
} }
restart_sshd() { restart_sshd() {
if ! systemctl is-active --quiet sshd; then echo -en "$YELLOW_BANG Restarting sshd..."
prompt_user "sshd.service" "sshd.service is not active. Restart?"
if [[ $REPLY =~ ^[Yy]$ ]]; then
systemctl restart sshd systemctl restart sshd
if [[ $? -eq 0 ]]; then
local sshd_pid=$(systemctl show --property MainPID --value sshd) local sshd_pid=$(systemctl show --property MainPID --value sshd)
update_prompt $GREEN_CHECK "Restarted sshd.service on PID: $sshd_pid" update_prompt $GREEN_CHECK "sshd" "Restarted sshd.service on PID: $sshd_pid"
fi
else else
local sshd_pid=$(systemctl show --property MainPID --value sshd) update_prompt $RED_X "sshd" "Failed to restart sshd.service"
echo -e "$GREEN_CHECK sshd.service is active on PID: $sshd_pid" exit 1
fi fi
} }