fix(recovery): surface 110 ssh account metadata receipt
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 39s
CD Pipeline / build-and-deploy (push) Failing after 28s
CD Pipeline / post-deploy-checks (push) Has been skipped

This commit is contained in:
Your Name
2026-07-01 12:42:34 +08:00
parent 56522aa003
commit f963894995
5 changed files with 99 additions and 2 deletions

View File

@@ -940,6 +940,21 @@ def _parse_ssh_local_repair_output(output: str) -> dict[str, Any]:
authorized_keys_exists = (
"AUTHORIZED_KEYS_STATUS" in output and "exists=1" in output
)
account_locked = _bool_from_field(fields.get("account_locked"))
shell_executable = _bool_from_field(fields.get("shell_executable"))
sshd_effective_config_available = _bool_from_field(fields.get("available"))
pubkey_authentication = str(fields.get("pubkeyauthentication") or "")
usepam = str(fields.get("usepam") or "")
authorized_keys_file_default = _bool_from_field(
fields.get("authorized_keys_file_default")
)
account_metadata_ready = bool(
user_exists
and not account_locked
and shell_executable
and pubkey_authentication == "yes"
and authorized_keys_file_default
)
permissions_applied = "APPLIED permissions" in output
reload_done = "SSH_RELOAD=done" in output
reload_skipped = "SSH_RELOAD=skipped" in output
@@ -949,12 +964,24 @@ def _parse_ssh_local_repair_output(output: str) -> dict[str, Any]:
"sshd_config_syntax_ok": sshd_ok,
"sshd_config_syntax_after_apply_ok": sshd_after_ok,
"target_user_exists": user_exists,
"target_user_account_locked": account_locked,
"target_user_shell_executable": shell_executable,
"sshd_effective_config_available": sshd_effective_config_available,
"sshd_pubkeyauthentication": pubkey_authentication,
"sshd_usepam": usepam,
"sshd_authorized_keys_file_default": authorized_keys_file_default,
"account_metadata_ready": account_metadata_ready,
"authorized_keys_metadata_present": authorized_keys_exists,
"permissions_applied": permissions_applied,
"ssh_reload_done": reload_done,
"ssh_reload_skipped": reload_skipped,
"control_channel_metadata_ready": bool(
marker_seen and sshd_ok and sshd_after_ok and user_exists and authorized_keys_exists
marker_seen
and sshd_ok
and sshd_after_ok
and user_exists
and authorized_keys_exists
and account_metadata_ready
),
}