Skip to main content

Module ssh

Module ssh 

Source

Structs§

ProbeOutputBroken
The guest’s answer could not be interpreted: a defect in our probe command or in parsing its output — NOT a guest reboot. Typed so waiters report it as what it is instead of narrating a reboot that never happened.

Enums§

GuestProgress
What the guest itself reports about Setup: finished, or still working — with a human-readable description of what is pending. Callers narrate that description only when it changes, so a long install logs a handful of progress lines instead of one per probe.

Constants§

DEFAULT_PTY_TERM
Terminal type requested for interactive shells (DEFAULT_PTY_TERM). Single source so the next person isn’t grepping line 174 for it.

Functions§

apply_headless_diet
Headless service diet + NLA profile, applied once over SSH after the guest reports Ready — deliberately NOT a specialize step: each list used to be its own synchronous PowerShell cold start serializing into Setup. One invocation here costs a single cold start off the critical path. Best-effort (warn, never fail): Setup is done, this is hygiene. Defender real-time monitoring is tamper-locked headless — not attempted.
change_guest_password
Rotate the guest password via net user over the existing SSH session, then verify the new credential with a fresh login. Returns Ok(()) only after the new password authenticates — callers can treat success as proof the rotation landed. After success the old password is dead: only new_pass authenticates. Never logs either password (see ssh_exec).
interactive_shell
Interactive shell over SSH: pty + local stdio, no host ssh binary. Cross-platform raw mode via crossterm (restored on exit via the guard); Ctrl-C inside goes to the guest, Ctrl-D / exit ends the session.
probe_setup_done
Guest readiness probe over a real SSH login (password auth). Asks the guest itself whether Setup is finished instead of inferring it from banner timing: four registry reads through cmd+reg.exe (millisecond startup, no PowerShell cold start per probe).
prove_interactive_shell
Prove a usable interactive shell, not just an exec channel: open a real pty shell (the exact path a user login takes — profile, prompt, the lot), send a marker, and read it back. An exec whoami passing while interactive logon hangs is a real failure mode (profile load, shell startup); only a prompt answering proves the prompt exists. Bounded by timeouts::READINESS_PROBE_BUDGET: answers in milliseconds on a landed guest, loud error otherwise — never a hang.
set_auto_updates
Enable or disable Windows automatic updates (wuauserv) on the guest. false stops the service and sets it to manual-start: no download, no install, no surprise reboots. Manual updates over SSH still work. Verifies by reading the config back (sc qc) — a silent sc failure must never report success. Best-effort per command (warns, never fails) — callers decide.
set_recovery_enabled
Enable or disable Windows Automatic Repair (“Diagnosing your PC”) on the guest. Disabled = boots fail fast instead of parking at recovery; snapshots are the safety net, not WinRE. Toggles BOTH BCD switches: recoveryenabled gates WinRE invocation, while the “Diagnosing your PC” screen itself is the boot-status policy (bootstatuspolicy) — IgnoreAllFailures makes winload skip it after an unclean stop. Verified by reading the entry back (bcdedit /enum) — same trust-nothing rule as set_auto_updates.
ssh_exec
Run one command over SSH (password auth), returning stdout. Host key is accepted blind (loopback NAT to our own guest; the key changes on every reinstall, so TOFU is pointless).
wait_for_ssh
Poll host:port until a real SSH server answers. A bare TCP connect is NOT enough: QEMU’s user-mode NAT completes the host-side handshake while the guest is still in UEFI/Setup, so connect() succeeds minutes before any sshd exists (false “ready” + hung ssh client). We require the SSH-2.0-... banner, which only a live sshd sends.