From 6b4b19194ec40c79569bc692a6557e78f338ded9 Mon Sep 17 00:00:00 2001 From: Wim Date: Sun, 8 Mar 2020 23:55:09 +0100 Subject: Update vendor shazow/ssh-chat (#1029) --- vendor/github.com/shazow/ssh-chat/sshd/net.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'vendor/github.com/shazow/ssh-chat/sshd/net.go') 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 { -- cgit v1.2.3