Skip to content

Commit

Permalink
fix: improved mitm error message
Browse files Browse the repository at this point in the history
refs #152

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
  • Loading branch information
caarlos0 committed Feb 10, 2023
1 parent debbc98 commit 1018568
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion client_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func hostKeyCallback(e *Endpoint, path string) gossh.HostKeyCallback {
var kerr *knownhosts.KeyError
if errors.As(err, &kerr) {
if len(kerr.Want) > 0 {
return fmt.Errorf("possible man-in-the-middle attack: %w", err)
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())
}
// if want is empty, it means the host was not in the known_hosts file, so lets add it there.
fmt.Fprintln(kh, knownhosts.Line([]string{e.Address}, key))
Expand Down

0 comments on commit 1018568

Please sign in to comment.