Commit Graph

9 Commits

Author SHA1 Message Date
Tonis Tiigi
8a2a3e83ec replace context.WithCancel with WithCancelCause
Keep stack traces for cancellation errors where possible.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2023-12-06 22:15:06 -08:00
Erik Sipsma
30ea41976d ssh: add fallback to ensure conn is closed in all cases.
Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2023-05-07 15:09:06 -07:00
Aaron Lehmann
8c978cf909 Propagate sshforward send side connection close
PR #3431 caused connections closed on the remote side of a sshforward
session to not always result in the local side reading an EOF from the
connection. This change restores that behavior by closing the write side
of the forwarded connection after reading an EOF from the stream. Since
only the write side is being closed, it doesn't prevent the remote side
from continuing to read from the connection.

Signed-off-by: Aaron Lehmann <alehmann@netflix.com>
2023-01-13 21:39:15 -08:00
Erik Sipsma
eb9e2c974c sshforward: skip conn close on stream CloseSend.
The GRPC docs on RecvMsg say:
> RecvMsg blocks until it receives a message into m or the stream is
> done. It returns io.EOF when the client has performed a CloseSend.
> On any non-EOF error, the stream is aborted and the error contains
> the RPC status.

So if EOF is received that just means the client won't be sending
anymore data. But it may still be expecting to read data, so we
shouldn't close the conn yet.

This was encountered in real life when forwarding a docker socket to a
container, where it appears that the docker CLI closes its write side of
the connection when requesting the stdout/stderr but then expects to
read data after that.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2022-12-21 11:30:11 -08:00
Sebastiaan van Stijn
d7cdc0af92 session/sshforward: remove use of obsolete golang.org/x/net/context pkg
This package is an alias for "context", which has been part of
stdlib since go1.7, so should no longer be needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-08 03:05:13 +01:00
Tonis Tiigi
bd3354fea3 session: avoid deprecated grpc.Stream type
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-07-19 09:28:36 -07:00
Tonis Tiigi
bc3a1eefdd session: release forwarded ssh socket connection per connection
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-08-26 15:34:55 -07:00
Tonis Tiigi
d3597181e0 session: wrap errors with debug info
Make sure to cover the grpc errors origins.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-06-06 21:15:21 -07:00
Tonis Tiigi
6888956557 sshforward: implement ssh socket forwarding
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-09-07 08:57:06 -07:00