Skip to content
Permalink
Browse files

Cleanup connections if auth is not passed

  • Loading branch information...
antoniomika committed Jun 23, 2019
1 parent 75de6de commit 8c29827546b1f7ee18435f9dcf5a6557a9402752
Showing with 14 additions and 0 deletions.
  1. +14 −0 main.go
14 main.go
@@ -183,10 +183,24 @@ func main() {
continue
}

clientLoggedIn := false

if *cleanupUnbound {
go func() {
select {
case <-time.NewTimer(5 * time.Second).C:
if !clientLoggedIn {
conn.Close()
}
}
}()
}

log.Println("Accepted SSH connection for:", conn.RemoteAddr())

go func() {
sshConn, chans, reqs, err := ssh.NewServerConn(conn, sshConfig)
clientLoggedIn = true
if err != nil {
conn.Close()
log.Println(err)

0 comments on commit 8c29827

Please sign in to comment.
You can’t perform that action at this time.