summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/shazow/ssh-chat/sshd/net.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-03-08 23:55:09 +0100
committerGitHub <noreply@github.com>2020-03-08 23:55:09 +0100
commit6b4b19194ec40c79569bc692a6557e78f338ded9 (patch)
tree72f52510f7388f2575859e5be3d2b75970f979f2 /vendor/github.com/shazow/ssh-chat/sshd/net.go
parent9785edd26366be8eb11c2435f50f90a5c8eea7fc (diff)
downloadmatterbridge-msglm-6b4b19194ec40c79569bc692a6557e78f338ded9.tar.gz
matterbridge-msglm-6b4b19194ec40c79569bc692a6557e78f338ded9.tar.bz2
matterbridge-msglm-6b4b19194ec40c79569bc692a6557e78f338ded9.zip
Update vendor shazow/ssh-chat (#1029)
Diffstat (limited to 'vendor/github.com/shazow/ssh-chat/sshd/net.go')
-rw-r--r--vendor/github.com/shazow/ssh-chat/sshd/net.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/vendor/github.com/shazow/ssh-chat/sshd/net.go b/vendor/github.com/shazow/ssh-chat/sshd/net.go
index 8305696b..678454ba 100644
--- a/vendor/github.com/shazow/ssh-chat/sshd/net.go
+++ b/vendor/github.com/shazow/ssh-chat/sshd/net.go
@@ -2,6 +2,7 @@ package sshd
import (
"net"
+ "time"
"github.com/shazow/rateio"
"golang.org/x/crypto/ssh"
@@ -32,6 +33,12 @@ func (l *SSHListener) handleConn(conn net.Conn) (*Terminal, error) {
conn = ReadLimitConn(conn, l.RateLimit())
}
+ // If the connection doesn't write anything back for too long before we get
+ // a valid session, it should be dropped.
+ var handleTimeout = 20 * time.Second
+ conn.SetReadDeadline(time.Now().Add(handleTimeout))
+ defer conn.SetReadDeadline(time.Time{})
+
// Upgrade TCP connection to SSH connection
sshConn, channels, requests, err := ssh.NewServerConn(conn, l.config)
if err != nil {