Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicated SSH session recordings #42263

Open
zabszk opened this issue Jun 1, 2024 · 16 comments
Open

Duplicated SSH session recordings #42263

zabszk opened this issue Jun 1, 2024 · 16 comments
Labels
audit-log Issues related to Teleports Audit Log bug proxy-recording

Comments

@zabszk
Copy link

zabszk commented Jun 1, 2024

Expected behavior:
Each SSH session should have exactly one recording and it should have the correct length.

Current behavior:
Each SSH session has two recordings with the same Session ID. Second recording is slightly longer and that length is incorrect - the recording ends before it reaches the displayed session duration (screenshot included below). The length of the shorter recording is correct (it matches actual session duration and actual recording length).

We tested tsh ssh on windows and Teleport WebUI, bug occurs in both situations.

Sessions list

The longer recording ends in the middle (that's when the session actually ended).
Longer recording

Bug details:

  • Teleport version: First noticed by us in 15.3.7, still present in 15.4.0.
  • Session recording mode: proxy
@zabszk zabszk added the bug label Jun 1, 2024
@stevenGravy
Copy link
Contributor

@zabszk please provide what the storage backend is for this. The session listing is based on the audit log so expect this is due to those records.

@stevenGravy stevenGravy added the audit-log Issues related to Teleports Audit Log label Jun 1, 2024
@zabszk
Copy link
Author

zabszk commented Jun 1, 2024

@zabszk please provide what the storage backend is for this. The session listing is based on the audit log so expect this is due to those records.

Local directory (default option) is used. I checked and there is one tar file with the matching name and inside the tar there is exactly one file.

I just made a test session and all logs are duplicated.

Audit logs

@stevenGravy
Copy link
Contributor

stevenGravy commented Jun 1, 2024 via email

@zabszk
Copy link
Author

zabszk commented Jun 1, 2024

No, I only specify the location for teleport logs (teleport -> log -> output). This bug occurs on two completely separated teleport installations. Both use Debian 12.

The bug only affects SSH Service in proxy recording mode. The issue is NOT present in node recording mode. Other services (DB, app) and "system logs" (certs issuance, etc...) are logged only once as well.

On the screenshot in my previous reply you can see that the duplicated "Session Ended" log entry has a different time logged (extra 5 seconds). I analyzed other logs and it's always exactly 5 seconds, even for 9 minutes long sessions:

  "session_start": "2024-06-01T11:49:38.97636617Z",
  "session_stop": "2024-06-01T11:58:26.328776262Z",
  "session_start": "2024-06-01T11:49:38.966423395Z",
  "session_stop": "2024-06-01T11:58:21.336166346Z",

@stevenGravy
Copy link
Contributor

Thanks for clarifying. Now that OpenSSH connections supports recording with node recording mode would recommend using that. I expect this is also due to the storage in some way.

@zabszk
Copy link
Author

zabszk commented Jun 1, 2024

We use recording proxy, because when using node recording mode the user can reboot the server (or just restart teleport service) and then there is no recording available for the entire session and even it's not easily visible that such session happened (you need to analyze the logs, you can't simply check the Session Recordings tab to see a session without recording available).

Regarding the bug - I just found out that if I restart teleport service on the node (in recording proxy mode) during the session, that specific session is displayed properly - only one recording is visible. So I guess that the bug is happening because the node doesn't handle proxy recording mode properly and submits some information (when session ends) that shouldn't be submitted in the proxy recording mode.

@zmb3
Copy link
Collaborator

zmb3 commented Jun 2, 2024

Are these Teleport nodes or OpenSSH servers?

@zabszk
Copy link
Author

zabszk commented Jun 2, 2024

Are these Teleport nodes or OpenSSH servers?

Teleport nodes. Sorry for not indicating it explicitly.

@zabszk
Copy link
Author

zabszk commented Jun 16, 2024

After updating to Teleport 16.0.0 it's even worse. Recording ends after less than a second and nothing is visible on the screen. Screenshot attached.

The bug occurs in proxy and node-sync recording modes. Node recording mode works. I haven't tested other modes.

EDIT: This bug is present in node recording mode as well if you click "Play" within the first seconds after the recording appears. If you click after these first seconds the recording plays fine (this "fix" doesn't work for proxy and node-sync modes).

Recording

@zabszk
Copy link
Author

zabszk commented Jul 1, 2024

I just retested proxy recording mode after updating to Teleport 16.0.3.

The first recording (the shorter one) plays (but the "Play" button starts working after about 10 seconds after the session finishes, otherwise it shows an empty recording - but that's the issue introduced in 16.0.0 for "node" recording mode as well).

The second recording (the longer one, the duplicate) now doesn't play at all (see screenshot from my previous reply), likely because it has a different Session ID. This wasn't an issue in Teleport 15 (see screenshots from the issue content and my first reply - IDs were the same).

Screenshots from proxy recording mode using Teleport 16.0.3 are below. I started only one session using the WebUI. Logs shows two session and the recording of the longer one (699b9e75-...) doesn't play.

audit log

recordings

@zabszk
Copy link
Author

zabszk commented Aug 25, 2024

After updating from 16.1.6 to 16.1.8 there is a difference. Now both recordings have the same length and the second recording is the working one (previously the first one was working and the second one was broken, now it's opposite).

Screenshot

Screenshot 2

@zmb3
Copy link
Collaborator

zmb3 commented Aug 28, 2024

@fspmarshall does #45877 resolve this?

@fspmarshall
Copy link
Contributor

@zmb3 I don't believe so. The case addressed in #45877 specifically results in an extra empty session recording, and only appears probabilistically when there is throttling/errors due to very high load that happens to occur at the start of the upload process. This issue seems to be something else.

@zabszk
Copy link
Author

zabszk commented Aug 28, 2024

After updating to 16.2.0 the first recording is the working one and the second (the later one) is broken - so it's like before 16.1.8. However both recordings have the same duration (just like after updating to 16.1.8).

@zabszk
Copy link
Author

zabszk commented Aug 28, 2024

@zmb3 I don't believe so. The case addressed in #45877 specifically results in an extra empty session recording, and only appears probabilistically when there is throttling/errors due to very high load that happens to occur at the start of the upload process. This issue seems to be something else.

The extra recording is empty - recording is visible on the list of recordings, but it has no content when you press "Play" and the second recording (the broken one) is not created if I restart the teleport agent during the session (which ofc results in session being terminated).

So it has something in common, but probably it's unrelated - just like you said. To me it looks like the agent tries to upload a recording (or something else) when it shouldn't, because this issue is present only in proxy recording mode. Switching to node recording mode fixes it (or at least was fixing it last time I checked).

@zabszk
Copy link
Author

zabszk commented Sep 6, 2024

I updated teleport to version 16.2.1 and the issue is still present, so PR #45877 (and #46265) is not related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audit-log Issues related to Teleports Audit Log bug proxy-recording
Projects
None yet
Development

No branches or pull requests

4 participants