Skip to content

Commit

Permalink
Emit the correct session ID for SessionLeave events
Browse files Browse the repository at this point in the history
Fixes #9574
  • Loading branch information
zmb3 committed Jan 5, 2022
1 parent 672425f commit 422e640
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ func testAuditOn(t *testing.T, suite *integrationTestSuite) {
start := findByType(events.SessionStartEvent)
require.Equal(t, first, start)
require.Equal(t, 0, start.GetInt("bytes"))
require.NotEmpty(t, start.GetString(events.SessionEventID))
require.Equal(t, string(sessionID), start.GetString(events.SessionEventID))
require.NotEmpty(t, start.GetString(events.TerminalSize))

// If session are being recorded at nodes, the SessionServerID should contain
Expand All @@ -522,15 +522,15 @@ func testAuditOn(t *testing.T, suite *integrationTestSuite) {
end := findByType(events.SessionEndEvent)
require.NotNil(t, end)
require.Equal(t, 0, end.GetInt("bytes"))
require.NotEmpty(t, end.GetString(events.SessionEventID))
require.Equal(t, string(sessionID), end.GetString(events.SessionEventID))

// there should always be 'session.leave' event
leave := findByType(events.SessionLeaveEvent)
require.NotNil(t, leave)
require.Equal(t, 0, leave.GetInt("bytes"))
require.NotEmpty(t, leave.GetString(events.SessionEventID))
require.Equal(t, string(sessionID), leave.GetString(events.SessionEventID))

// all of them should have a proper time:
// all of them should have a proper time
for _, e := range history {
require.False(t, e.GetTime("time").IsZero())
}
Expand Down
2 changes: 1 addition & 1 deletion lib/srv/sess.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func (s *SessionRegistry) emitSessionLeaveEvent(party *party) {
ServerAddr: party.ctx.ServerConn.LocalAddr().String(),
},
SessionMetadata: apievents.SessionMetadata{
SessionID: party.id.String(),
SessionID: party.s.ID(),
},
UserMetadata: apievents.UserMetadata{
User: party.user,
Expand Down

0 comments on commit 422e640

Please sign in to comment.