Skip to content

Commit

Permalink
[v11] Include ssh protocol in start, end audit events (#18895)
Browse files Browse the repository at this point in the history
* Include ssh protocol in start, end audit events
  • Loading branch information
stevenGravy authored Nov 30, 2022
1 parent 4c49423 commit 4fe862c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/srv/sess.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ import (

const sessionRecorderID = "session-recorder"

const PresenceVerifyInterval = time.Second * 15
const PresenceMaxDifference = time.Minute
const (
PresenceVerifyInterval = time.Second * 15
PresenceMaxDifference = time.Minute
)

// SessionControlsInfoBroadcast is sent in tandem with session creation
// to inform any joining users about the session controls.
Expand Down Expand Up @@ -161,6 +163,7 @@ func (s *SessionRegistry) findSessionLocked(id rsession.ID) (*session, bool) {
sess, found := s.sessions[id]
return sess, found
}

func (s *SessionRegistry) findSession(id rsession.ID) (*session, bool) {
s.sessionsMux.Lock()
defer s.sessionsMux.Unlock()
Expand Down Expand Up @@ -702,6 +705,7 @@ func (s *session) emitSessionStartEvent(ctx *ServerContext) {
UserMetadata: ctx.Identity.GetUserMetadata(),
ConnectionMetadata: apievents.ConnectionMetadata{
RemoteAddr: ctx.ServerConn.RemoteAddr().String(),
Protocol: events.EventProtocolSSH,
},
SessionRecording: ctx.SessionRecordingConfig.GetMode(),
InitialCommand: initialCommand,
Expand Down Expand Up @@ -831,7 +835,11 @@ func (s *session) emitSessionEndEvent() {
SessionMetadata: apievents.SessionMetadata{
SessionID: string(s.id),
},
UserMetadata: ctx.Identity.GetUserMetadata(),
UserMetadata: ctx.Identity.GetUserMetadata(),
ConnectionMetadata: apievents.ConnectionMetadata{
RemoteAddr: ctx.ServerConn.RemoteAddr().String(),
Protocol: events.EventProtocolSSH,
},
EnhancedRecording: s.hasEnhancedRecording,
Interactive: s.term != nil,
StartTime: start,
Expand Down

0 comments on commit 4fe862c

Please sign in to comment.