Skip to content

Commit

Permalink
Filter ssh spam too
Browse files Browse the repository at this point in the history
  • Loading branch information
Jipok committed Mar 3, 2024
1 parent 5f1ea10 commit 7cb2d44
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ssh-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"log"
"net"
"os"
"strings"
"sync"
"time"
"unicode"
Expand Down Expand Up @@ -76,7 +77,10 @@ func startSshServer() {
// Returns an error if the user is not in the `authorized_keys`
sshConn, channels, _, err := ssh.NewServerConn(tcpConn, sshConfig)
if err != nil {
log.Printf("Failed to handshake: %s", err)
if cfg.FilterSpam && !strings.Contains(err.Error(), "ssh") {
continue
}
log.Printf("SSH failed to handshake: %s", err)
continue
}

Expand Down

0 comments on commit 7cb2d44

Please sign in to comment.