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
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
}