logging: More information about why connections get dropped
authorAndrey Petrov <andrey.petrov@shazow.net>
Fri, 12 Aug 2016 20:46:08 +0000 (16:46 -0400)
committerAndrey Petrov <andrey.petrov@shazow.net>
Fri, 12 Aug 2016 20:46:08 +0000 (16:46 -0400)
Fixes #197 for now, maybe more later.

sshd/terminal.go

index 23f066b7aabe73297a58dd0ccbf98abe5281bf1d..977e146ea51702b8096cc85f49d8e05a7041b8a9 100644 (file)
@@ -90,6 +90,7 @@ func NewTerminal(conn *ssh.ServerConn, ch ssh.NewChannel) (*Terminal, error) {
                                _, err := channel.SendRequest(keepaliveRequest, true, nil)
                                if err != nil {
                                        // Connection is gone
+                                       logger.Printf("[%s] Keepalive failed, closing terminal: %s", term.Conn.RemoteAddr(), err)
                                        term.Close()
                                        return
                                }
@@ -107,6 +108,7 @@ func NewSession(conn *ssh.ServerConn, channels <-chan ssh.NewChannel) (*Terminal
        // Make a terminal from the first session found
        for ch := range channels {
                if t := ch.ChannelType(); t != "session" {
+                       logger.Printf("[%s] Ignored channel type: %s", conn.RemoteAddr(), t)
                        ch.Reject(ssh.UnknownChannelType, fmt.Sprintf("unknown channel type: %s", t))
                        continue
                }