diff --git a/lib/client/api.go b/lib/client/api.go index 43112e98d1e00..8ec87bfcab4b5 100644 --- a/lib/client/api.go +++ b/lib/client/api.go @@ -1763,6 +1763,8 @@ func (tc *TeleportClient) Join(ctx context.Context, mode types.SessionParticipan } } + fmt.Printf("Joining session with participant mode: %v. \n\n", mode) + // running shell with a given session means "join" it: err = tc.runShell(ctx, nc, mode, session, beforeStart) return trace.Wrap(err) diff --git a/lib/client/kubesession.go b/lib/client/kubesession.go index 3450c4d0880f2..0e260e286dae0 100644 --- a/lib/client/kubesession.go +++ b/lib/client/kubesession.go @@ -58,6 +58,8 @@ func NewKubeSession(ctx context.Context, tc *TeleportClient, meta types.SessionT TLSClientConfig: tlsConfig, } + fmt.Printf("Joining session with participant mode: %v. \n\n", mode) + ws, resp, err := dialer.Dial(joinEndpoint, nil) if resp != nil && resp.Body != nil { defer resp.Body.Close() diff --git a/lib/kube/proxy/moderated_sessions_test.go b/lib/kube/proxy/moderated_sessions_test.go index 317540eacc569..fd157c27219dd 100644 --- a/lib/kube/proxy/moderated_sessions_test.go +++ b/lib/kube/proxy/moderated_sessions_test.go @@ -410,8 +410,8 @@ func TestModeratedSessions(t *testing.T) { // checks if moderator has joined the session. // Each time a user joins a session the following message is broadcasted - // User joined the session. - if strings.Contains(stringData, fmt.Sprintf("User %s joined the session.", moderatorUsername)) { + // User joined the session with participant mode: . + if strings.Contains(stringData, fmt.Sprintf("User %s joined the session with participant mode: moderator.", moderatorUsername)) { t.Logf("identified that moderator joined the session") // inform moderator goroutine that the user detected that he joined the // session. diff --git a/lib/kube/proxy/sess.go b/lib/kube/proxy/sess.go index c96d237d3c9a2..3651e6fac2b59 100644 --- a/lib/kube/proxy/sess.go +++ b/lib/kube/proxy/sess.go @@ -908,7 +908,7 @@ func (s *session) join(p *party) error { } s.io.AddWriter(stringID, p.Client.stdoutStream()) - s.BroadcastMessage("User %v joined the session.", p.Ctx.User.GetName()) + s.BroadcastMessage("User %v joined the session with participant mode: %v.", p.Ctx.User.GetName(), p.Mode) if p.Mode == types.SessionModeratorMode { s.eventsWaiter.Add(1) diff --git a/lib/srv/sess.go b/lib/srv/sess.go index 364a4358e6b63..2f692b3e0edaf 100644 --- a/lib/srv/sess.go +++ b/lib/srv/sess.go @@ -1486,8 +1486,8 @@ func (s *session) addParty(p *party, mode types.SessionParticipantMode) error { // Register this party as one of the session writers (output will go to it). s.io.AddWriter(string(p.id), p) - s.BroadcastMessage("User %v joined the session.", p.user) - s.log.Infof("New party %v joined session", p.String()) + s.BroadcastMessage("User %v joined the session with participant mode: %v.", p.user, p.mode) + s.log.Infof("New party %v joined the session with participant mode: %v.", p.String(), p.mode) if mode == types.SessionPeerMode { s.term.AddParty(1) diff --git a/tool/tsh/kube.go b/tool/tsh/kube.go index f21ef5e548c93..c2fd186331c2b 100644 --- a/tool/tsh/kube.go +++ b/tool/tsh/kube.go @@ -98,7 +98,7 @@ func newKubeJoinCommand(parent *kingpin.CmdClause) *kubeJoinCommand { CmdClause: parent.Command("join", "Join an active Kubernetes session."), } - c.Flag("mode", "Mode of joining the session, valid modes are observer and moderator").Short('m').Default("moderator").StringVar(&c.mode) + c.Flag("mode", "Mode of joining the session, valid modes are observer, moderator and peer.").Short('m').Default("observer").EnumVar(&c.mode, "observer", "moderator", "peer") c.Flag("cluster", clusterHelp).Short('c').StringVar(&c.siteName) c.Arg("session", "The ID of the target session.").Required().StringVar(&c.session) return c diff --git a/tool/tsh/tsh.go b/tool/tsh/tsh.go index 0b4f31a57f5b0..ee40964677379 100644 --- a/tool/tsh/tsh.go +++ b/tool/tsh/tsh.go @@ -800,7 +800,7 @@ func Run(ctx context.Context, args []string, opts ...cliOption) error { // join join := app.Command("join", "Join the active SSH or Kubernetes session") join.Flag("cluster", clusterHelp).Short('c').StringVar(&cf.SiteName) - join.Flag("mode", "Mode of joining the session, valid modes are observer and moderator").Short('m').Default("peer").StringVar(&cf.JoinMode) + join.Flag("mode", "Mode of joining the session, valid modes are observer, moderator and peer.").Short('m').Default("observer").EnumVar(&cf.JoinMode, "observer", "moderator", "peer") join.Flag("reason", "The purpose of the session.").StringVar(&cf.Reason) join.Flag("invite", "A comma separated list of people to mark as invited for the session.").StringsVar(&cf.Invited) join.Arg("session-id", "ID of the session to join").Required().StringVar(&cf.SessionID)