Teleport interactive session termination classification for SSH, Kubernetes and Database access
0 reputation · 14 Aug 2022, 17:55 UTC
0 reputation · 14 Aug 2022, 17:55 UTC
Teleport supports interactive access via SSH, Kubernetes exec and port-forward, and Database proxy with server-side idle and connection timeout controls configurable per service and per role. Client-initiated cancellation of an interactive session is generally propagated as a transport close that the server interprets as session termination and records in audit logs.
Timeout and cancellation semantics differ by access protocol, with separate timeout parameters and propagation paths for SSH, Kubernetes and Database. Session recording finalization depends on the server detecting termination, and there is no single unified cancellation signal documented across access types. This can lead to inconsistent user-visible termination messages and audit classifications.
The goal is to clarify how termination is classified for audit and session recording purposes across protocols. Is client-initiated cancellation recorded with a distinct audit event type from server-enforced idle or connection timeout? Do SSH, Kubernetes exec/port-forward, and Database proxy produce consistent termination reasons in session recordings and audit logs? How is session recording completion handled when termination is detected via transport close versus timeout?
33775 reputation · 15 Aug 2022, 03:38 UTC
Teleport does not consistently emit a distinct audit event type that separates client-initiated cancellation from server-enforced idle or connection timeouts across SSH, Kubernetes, and Database access. In current deployments, interactive session termination is generally recorded as a generic session end event, with the underlying cause inferred from the transport closure rather than exposed as a structured, protocol-independent classification field.
Confirmed across protocols: session recordings finalize when the server detects the transport close, whether that close originates from the client or from a timeout. Audit logs record the timestamp of termination. The specific reason for termination—such as “user cancelled” versus “idle timeout”—is not uniformly represented as a discrete field in the audit event for all three access types.
Likely explanation: because Teleport proxies interactive sessions at the transport layer, a client-initiated cancel (for example, closing an SSH terminal or killing a port-forward process) and a server-enforced timeout both result in the same TCP-level FIN or RST. The proxy interprets both as a session termination and writes an end event. Unless the specific protocol handler explicitly annotates the event with a reason code, the audit log entry remains generic.
idle_timeout and client inactivity lead to transport closure. A user typing exit or closing the terminal also closes the transport. Both paths converge on the same session end event unless the SSH server explicitly labels the reason.kubectl port-forward and the Kubernetes API server or proxy enforcing a limit.Session recording finalization is triggered by the server detecting the transport closure. This applies uniformly whether the closure is client-initiated or timeout-driven. In practice, recording completion can lag the actual transport close by a short interval because the server flushes buffered session data before sealing the recording.
To confirm behavior in your environment, inspect the audit log for session end events after deliberately triggering both a client cancel and a timeout. Search your Teleport auth server audit log for session termination entries; the event type to look for is session.end:
grep '"type":"session.end"' /var/lib/teleport/log/audit.log
Compare the fields present in the end event after a manual exit versus an idle timeout. If the event lacks a reason or termination cause field, the classification is implicit rather than explicit.
For a scoped test, create a role with a short idle timeout, apply it to a test user, and observe whether the resulting audit entry differs from a client-initiated close. Avoid changing production roles during this test.
Which Teleport version and deployment topology are you using? The exact audit event schema and whether recent versions introduced explicit termination reason fields depend heavily on the version and whether you are running self-hosted or Teleport Cloud.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.