Skip to content

Commit 1018568

Browse files
committed
fix: improved mitm error message
refs #152 Signed-off-by: Carlos A Becker <[email protected]>
1 parent debbc98 commit 1018568

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

client_auth.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ func hostKeyCallback(e *Endpoint, path string) gossh.HostKeyCallback {
271271
var kerr *knownhosts.KeyError
272272
if errors.As(err, &kerr) {
273273
if len(kerr.Want) > 0 {
274-
return fmt.Errorf("possible man-in-the-middle attack: %w", err)
274+
return fmt.Errorf("possible man-in-the-middle attack: %w - if your host's key changed, you might need to edit %q", err, kh.Name())
275275
}
276276
// if want is empty, it means the host was not in the known_hosts file, so lets add it there.
277277
fmt.Fprintln(kh, knownhosts.Line([]string{e.Address}, key))

0 commit comments

Comments
 (0)