Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

Commit

Permalink
Log IP on SSH authentication failure
Browse files Browse the repository at this point in the history
  • Loading branch information
elesiuta committed Oct 15, 2020
1 parent e4a3785 commit 719999a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ func sessionHandler(session ssh.Session) {
// Wait for the command to exit and log any errors we get
err = cmd.Wait()
if err != nil {
log.Error("SSH: Wait: %v", err)
log.Error("SSH: Wait: %v from %s", err, session.RemoteAddr())
}

if err := session.Exit(getExitStatusFromError(err)); err != nil {
log.Error("Session failed to exit. %s", err)
log.Error("Session failed to exit. %s from %s", err, session.RemoteAddr())
}
}

Expand Down Expand Up @@ -185,7 +185,7 @@ func publicKeyHandler(ctx ssh.Context, key ssh.PublicKey) bool {

pkey, err := models.SearchPublicKeyByContent(strings.TrimSpace(string(gossh.MarshalAuthorizedKey(key))))
if err != nil {
log.Error("SearchPublicKeyByContent: %v", err)
log.Error("SearchPublicKeyByContent: %v from %s", err, ctx.RemoteAddr())
return false
}

Expand Down

0 comments on commit 719999a

Please sign in to comment.