File tree Expand file tree Collapse file tree 3 files changed +48
-0
lines changed
lib/usagereporter/teleport Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -299,6 +299,12 @@ func ConvertAuditEvent(event apievents.AuditEvent) Anonymizable {
299
299
}
300
300
case * apievents.CrownJewelCreate :
301
301
return & AccessGraphCrownJewelCreateEvent {}
302
+ case * apievents.SessionRecordingAccess :
303
+ return & SessionRecordingAccessEvent {
304
+ SessionType : e .SessionType ,
305
+ UserName : e .User ,
306
+ Format : e .Format ,
307
+ }
302
308
}
303
309
304
310
return nil
Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ import (
22
22
"github.com/stretchr/testify/assert"
23
23
"github.com/stretchr/testify/require"
24
24
25
+ "github.com/gravitational/teleport"
26
+ "github.com/gravitational/teleport/api/types"
25
27
apievents "github.com/gravitational/teleport/api/types/events"
26
28
prehogv1a "github.com/gravitational/teleport/gen/proto/go/prehog/v1alpha"
27
29
"github.com/gravitational/teleport/lib/utils"
@@ -212,6 +214,30 @@ func TestConvertAuditEvent(t *testing.T) {
212
214
},
213
215
},
214
216
},
217
+ {
218
+ desc : "SessionRecordingAccess" ,
219
+ event : & apievents.SessionRecordingAccess {
220
+ UserMetadata : apievents.UserMetadata {
221
+ User : "some-user" ,
222
+ },
223
+ SessionType : string (types .SSHSessionKind ),
224
+ Format : teleport .PTY ,
225
+ },
226
+ expected : & SessionRecordingAccessEvent {
227
+ SessionType : string (types .SSHSessionKind ),
228
+ UserName : "some-user" ,
229
+ Format : teleport .PTY ,
230
+ },
231
+ expectedAnonymized : & prehogv1a.SubmitEventRequest {
232
+ Event : & prehogv1a.SubmitEventRequest_SessionRecordingAccess {
233
+ SessionRecordingAccess : & prehogv1a.SessionRecordingAccessEvent {
234
+ SessionType : string (types .SSHSessionKind ),
235
+ UserName : anonymizer .AnonymizeString ("some-user" ),
236
+ Format : teleport .PTY ,
237
+ },
238
+ },
239
+ },
240
+ },
215
241
}
216
242
217
243
for _ , tt := range cases {
Original file line number Diff line number Diff line change @@ -1272,6 +1272,22 @@ func (u *UserTaskStateEvent) Anonymize(a utils.Anonymizer) prehogv1a.SubmitEvent
1272
1272
}
1273
1273
}
1274
1274
1275
+ // SessionRecordingAccessEvent is an event that is emitted after an user access
1276
+ // a session recording.
1277
+ type SessionRecordingAccessEvent prehogv1a.SessionRecordingAccessEvent
1278
+
1279
+ func (s * SessionRecordingAccessEvent ) Anonymize (a utils.Anonymizer ) prehogv1a.SubmitEventRequest {
1280
+ return prehogv1a.SubmitEventRequest {
1281
+ Event : & prehogv1a.SubmitEventRequest_SessionRecordingAccess {
1282
+ SessionRecordingAccess : & prehogv1a.SessionRecordingAccessEvent {
1283
+ SessionType : s .SessionType ,
1284
+ UserName : a .AnonymizeString (s .UserName ),
1285
+ Format : s .Format ,
1286
+ },
1287
+ },
1288
+ }
1289
+ }
1290
+
1275
1291
// ConvertUsageEvent converts a usage event from an API object into an
1276
1292
// anonymizable event. All events that can be submitted externally via the Auth
1277
1293
// API need to be defined here.
You can’t perform that action at this time.
0 commit comments