Repository navigation
Closed
Labels
enhancementNew feature or request
Description
Context
Related roadmap: #45. Split from the return-route review in #61 because SSH account resolution and transport failure classification are independent of Codex home activity.
Host identity does not determine an OS login account:
- An entry in
known_hostsrecords a host key, not a username. - Tailscale peer and MagicDNS records identify a device, not the remote SSH account.
- Without
USER@HOSTor an SSHUsersetting, OpenSSH falls back to the caller's local username, which may not exist on the destination. - A wrong username currently produces an opaque SSH failure, and callers cannot tell which account was attempted or whether changing the host, key, or username is appropriate.
Proposed behavior
- Preserve the requested SSH alias so its
~/.ssh/configHostandUsersettings continue to apply while verified MagicDNS routing overrides onlyHostName. - Resolve the effective attempted username with
ssh -Gusing the same destination and safe SSH options used for the connection. - Apply precedence: explicit
USER@HOST, then effective OpenSSH configuration/default. Do not infer a username fromknown_hosts, Tailscale identity, MagicDNS, or usernames observed on other machines. - Report an explicit user as
sshUserSource: "explicit". When no explicit user was supplied, reportsshUserSource: "ssh_config_or_local_default"; do not pretend to know whether OpenSSH obtained it from config or its default without parsing private configuration. - Classify failed SSH attempts at least as
authentication_failed,host_key_failed,timeout, ortransport_failed. Include the effectivesshUserwhen known. - Authentication failure must be terminal for that request. Never retry guessed usernames or cycle through local accounts.
- Give an actionable remedy: use
--host USER@HOSTor setUserfor the original alias in~/.ssh/config.
Example failure:
{
"ok": false,
"host": "macbook-pro-m4-pro.tailnet.ts.net",
"sshUser": "ubuntu",
"sshUserSource": "ssh_config_or_local_default",
"sshFailure": "authentication_failed",
"error": "SSH authentication failed for [email protected]; use --host USER@HOST or configure SSH User"
}Acceptance criteria
-
USER@HOSTtakes precedence and is reported as explicit. - An SSH-configured
Useris honored through the original alias and exposed as the effective attempted user. - A host known only through
known_hostsor Tailscale does not invent a remote username beyond OpenSSH's documented local-user default. - Authentication, host-key, timeout, and other transport failures have distinct structured results locally and in multi-host JSON.
- Wrong usernames are never automatically retried.
- Existing safe SSH option validation, MagicDNS verification, host attribution, and multi-host continuation remain intact.
- Tests cover explicit users, SSH-config/default users, missing
ssh -G, malformed output, each failure class, and usernames/hosts requiring safe argument handling. - README/help explain username precedence and both supported configuration forms.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity