Skip to content

Commit

Permalink
fix @espadolini review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tigrato committed May 24, 2022
1 parent c0eaab8 commit 547a930
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
3 changes: 0 additions & 3 deletions lib/kube/proxy/forwarder.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ import (
"github.com/gravitational/teleport/lib/httplib"
"github.com/gravitational/teleport/lib/kube/proxy/streamproto"
kubeutils "github.com/gravitational/teleport/lib/kube/utils"

"github.com/gravitational/teleport/lib/labels"
"github.com/gravitational/teleport/lib/reversetunnel"
"github.com/gravitational/teleport/lib/services"
Expand Down Expand Up @@ -1055,8 +1054,6 @@ func (f *Forwarder) execNonInteractive(ctx *authContext, w http.ResponseWriter,
SessionRecording: ctx.recordingConfig.GetMode(),
}

sessionStartEvent.Impersonator = ctx.Identity.GetIdentity().Impersonator

if err := f.cfg.StreamEmitter.EmitAuditEvent(f.ctx, sessionStartEvent); err != nil {
f.log.WithError(err).Warn("Failed to emit event.")
}
Expand Down
12 changes: 4 additions & 8 deletions lib/kube/proxy/sess.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,11 +668,7 @@ func (s *session) lockedSetupLaunch(request *remoteCommandRequest, q url.Values,
SessionID: s.id.String(),
WithMFA: s.ctx.Identity.GetIdentity().MFAVerified,
}
userMetadata := apievents.UserMetadata{
User: s.ctx.User.GetName(),
Login: s.ctx.User.GetName(),
Impersonator: s.ctx.Identity.GetIdentity().Impersonator,
}

conMetadata := apievents.ConnectionMetadata{
RemoteAddr: s.req.RemoteAddr,
LocalAddr: s.sess.kubeAddress,
Expand All @@ -688,7 +684,7 @@ func (s *session) lockedSetupLaunch(request *remoteCommandRequest, q url.Values,
},
ServerMetadata: serverMetadata,
SessionMetadata: sessionMetadata,
UserMetadata: userMetadata,
UserMetadata: s.sess.eventUserMeta(),
ConnectionMetadata: conMetadata,
CommandMetadata: apievents.CommandMetadata{
Command: strings.Join(request.cmd, " "),
Expand All @@ -715,7 +711,7 @@ func (s *session) lockedSetupLaunch(request *remoteCommandRequest, q url.Values,
},
ServerMetadata: serverMetadata,
SessionMetadata: sessionMetadata,
UserMetadata: userMetadata,
UserMetadata: s.sess.eventUserMeta(),
ConnectionMetadata: conMetadata,
// Bytes transmitted from user to pod.
BytesTransmitted: s.io.CountRead(),
Expand All @@ -735,7 +731,7 @@ func (s *session) lockedSetupLaunch(request *remoteCommandRequest, q url.Values,
},
ServerMetadata: serverMetadata,
SessionMetadata: sessionMetadata,
UserMetadata: userMetadata,
UserMetadata: s.sess.eventUserMeta(),
ConnectionMetadata: conMetadata,
Interactive: true,
Participants: s.allParticipants(),
Expand Down

0 comments on commit 547a930

Please sign in to comment.