Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/srv/forward/sshserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"fmt"
"io"
"net"
"os"
"strings"
"time"

Expand Down Expand Up @@ -1062,8 +1063,12 @@ func (s *Server) handleDirectTCPIPRequest(ctx context.Context, ch ssh.Channel, r
if err != nil {
s.log.Errorf("Unable to create connection context: %v.", err)
s.stderrWrite(ch, "Unable to create connection context.")
if err := ch.Close(); err != nil {
s.log.Warnf("Failed to close channel: %v", err)
}
return
}
scx.AddCloser(ch)
scx.RemoteClient = s.remoteClient
scx.ExecType = teleport.ChanDirectTCPIP
scx.SrcAddr = sshutils.JoinHostPort(req.Orig, req.OrigPort)
Expand Down Expand Up @@ -1095,8 +1100,8 @@ func (s *Server) handleDirectTCPIPRequest(ctx context.Context, ch ssh.Channel, r
scx.WithError(err).Warn("Failed to emit port forward event.")
}

if err := utils.ProxyConn(ctx, ch, conn); err != nil {
s.log.WithError(err).Warn("Pailed proxying data for port forwarding connection.")
if err := utils.ProxyConn(ctx, ch, conn); err != nil && !errors.Is(err, io.EOF) && !errors.Is(err, os.ErrClosed) {
s.log.WithError(err).Warn("Failed proxying data for port forwarding connection.")
}
}

Expand Down