From dd6608aae4b8ef8c2e3a756d29e5711f08e4ba6d 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 338ad920c25eb..39ff48773c617 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(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)