From cddf3ec978627ad9d3ecd6dbf56ae0529a7c7fa2 Mon Sep 17 00:00:00 2001 From: Andrew Burke Date: Fri, 22 Aug 2025 15:07:55 -0700 Subject: [PATCH] Set exit status for openssh nodes --- lib/srv/forward/subsystem.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/srv/forward/subsystem.go b/lib/srv/forward/subsystem.go index b8ae7335d0966..fbcb4957183e4 100644 --- a/lib/srv/forward/subsystem.go +++ b/lib/srv/forward/subsystem.go @@ -237,6 +237,14 @@ func (r *remoteSFTPSubsystem) Wait() error { err = trace.ConnectionProblem(nil, "context is closing") } + var exitStatus int + if err != nil { + exitStatus = 1 + } + r.subsystem.serverContext.SendExecResult(r.subsystem.ctx, srv.ExecResult{ + Code: exitStatus, + }) + // emit an event to the audit log with the result of execution r.subsystem.emitAuditEvent(r.subsystem.ctx, err) return trace.Wrap(err)