Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Displaying mode and controls to additional participants #46450

Merged
merged 45 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
d6b4b65
Displaying mode and controls to additional participants
mvbrock Sep 10, 2024
88b01a6
Merge branch 'master' into mvbrock/display-controls-on-session-join
mvbrock Sep 10, 2024
53b4708
Merge branch 'master' into mvbrock/display-controls-on-session-join
mvbrock Sep 11, 2024
cae1e58
Moving SessionControlsInfoBroadcast over to kube/proxy
mvbrock Sep 12, 2024
6c2982a
Merge branch 'master' into mvbrock/display-controls-on-session-join
mvbrock Sep 12, 2024
612d574
Merge branch 'master' into mvbrock/display-controls-on-session-join
mvbrock Sep 16, 2024
d6eea0b
Transitioning to consistent proxy-emitted mode+controls
mvbrock Sep 17, 2024
c5fa24f
Moving message broadcast so new participant wont see it
mvbrock Sep 17, 2024
c173ccc
Merge branch 'master' into mvbrock/display-controls-on-session-join
mvbrock Sep 17, 2024
2838c41
Possible unit test fix (cant seem to test locally)
mvbrock Sep 17, 2024
b304f3d
Fixed unit test
mvbrock Sep 17, 2024
b403553
Merge branch 'master' into mvbrock/display-controls-on-session-join
mvbrock Sep 17, 2024
ec01f11
Adding a line break before messaging the participant
mvbrock Sep 18, 2024
c471c2c
Merge branch 'master' into mvbrock/display-controls-on-session-join
mvbrock Sep 18, 2024
f7b895d
Linter errors
mvbrock Sep 18, 2024
b66ad27
Emitting audit event and controls message for additional parties, i.e…
mvbrock Sep 19, 2024
1b7cfbd
Revert "Emitting audit event and controls message for additional part…
mvbrock Sep 19, 2024
5fa8f70
Add User Tasks resource - protos (#46059)
marcoandredinis Sep 18, 2024
ce6a269
Add notice to web UI that users arent equal to MAU (#46686)
avatus Sep 18, 2024
32efcae
Clarify TLS requirements in the Jira guide (#46484)
ptgott Sep 18, 2024
b8cf72b
Remove TXT record validation of custom DNS zones in VNet (#46709)
ravicious Sep 18, 2024
567cf90
docs: mention the --days flag when executing an audit log query (#45764)
djohns7 Sep 18, 2024
4849fc2
Remove access-graph path resolution, proxy `/enterprise` requests (#4…
ryanclark Sep 18, 2024
36af69c
update e ref (#46726)
nklaassen Sep 18, 2024
74a1e46
fix: tolerate mismatched key PEM headers (#46725)
nklaassen Sep 18, 2024
b357f9b
Use dynamic base path for favicon images (#46719)
avatus Sep 18, 2024
dca5f57
Add Datadog Incident Management plugin support (#46271)
bernardjkim Sep 18, 2024
5099b02
Add AutoUpdate Client/Cache implementation (#46661)
vapopov Sep 19, 2024
98177f3
User Tasks: services and clients implementation (#46131)
marcoandredinis Sep 19, 2024
ad60933
expanding testplan for host user creation (#46729)
eriktate Sep 19, 2024
91f70ff
Fix operator docs reference generator bug (#46732)
ptgott Sep 19, 2024
ec76c7a
[auto] Update AMI IDs for 16.4.0 (#46746)
teleport-post-release-automation[bot] Sep 19, 2024
c8d4563
Remove deprecated HTTP RemoteCluster endpoints (#46756)
strideynet Sep 19, 2024
2881f07
Add `tbot` helm chart to `version.mk` (#46763)
strideynet Sep 19, 2024
a5ec9d0
Remove LockConfiguration.LockName (#46772)
rosstimothy Sep 19, 2024
c76965e
adding a reference to to the host user guide (#46765)
eriktate Sep 19, 2024
cb6d927
Replace more Logrus usage with Slog (#46757)
strideynet Sep 19, 2024
067064e
Update AWS roles ARNs displayed on `tsh app login` for AWS console ap…
gabrielcorado Sep 19, 2024
48fae88
bulk audit event export api (#46399)
fspmarshall Sep 19, 2024
cd1d735
Reverting back to using the emitSessionJoin boolean
mvbrock Sep 19, 2024
88ad804
Merge branch 'master' into mvbrock/display-controls-on-session-join
mvbrock Sep 19, 2024
b02528d
Merge remote-tracking branch 'origin/master' into mvbrock/display-con…
mvbrock Sep 19, 2024
34d6adc
Merge branch 'master' into mvbrock/display-controls-on-session-join
mvbrock Sep 19, 2024
071190c
Nits and removing a debug log
mvbrock Sep 20, 2024
0eab2ce
Merge branch 'master' into mvbrock/display-controls-on-session-join
mvbrock Sep 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2165,8 +2165,6 @@ 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 = nc.RunInteractiveShell(ctx, mode, session, tc.OnChannelRequest, beforeStart)
return trace.Wrap(err)
Expand Down
6 changes: 5 additions & 1 deletion lib/kube/proxy/sess.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ import (
"github.com/gravitational/teleport/lib/utils"
)

// SessionControlsInfoBroadcast is sent in tandem with session creation to inform any joining
// users about the session controls.
const SessionControlsInfoBroadcast = "Controls\r\n - CTRL-C: Leave the session\r\n - t: Forcefully terminate the session (moderators only)"

const sessionRecorderID = "session-recorder"
mvbrock marked this conversation as resolved.
Show resolved Hide resolved

const (
Expand Down Expand Up @@ -498,7 +502,7 @@ func newSession(ctx authContext, forwarder *Forwarder, req *http.Request, params
s.io.OnReadError = s.disconnectPartyOnErr

s.BroadcastMessage("Creating session with ID: %v...", id.String())
s.BroadcastMessage(srv.SessionControlsInfoBroadcast)
s.BroadcastMessage(SessionControlsInfoBroadcast)

go func() {
if _, open := <-s.io.TerminateNotifier(); open {
Expand Down
21 changes: 16 additions & 5 deletions lib/srv/sess.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package srv

import (
"bytes"
"context"
"encoding/json"
"errors"
Expand Down Expand Up @@ -66,10 +67,6 @@ const (
PresenceMaxDifference = time.Minute
)

// SessionControlsInfoBroadcast is sent in tandem with session creation
// to inform any joining users about the session controls.
const SessionControlsInfoBroadcast = "Controls\r\n - CTRL-C: Leave the session\r\n - t: Forcefully terminate the session (moderators only)"

const (
// sessionRecordingWarningMessage is sent when the session recording is
// going to be disabled.
Expand Down Expand Up @@ -1291,7 +1288,6 @@ func (s *session) startInteractive(ctx context.Context, scx *ServerContext, p *p
s.io.AddReader("reader", inReader)
s.io.AddWriter(sessionRecorderID, utils.WriteCloserWithContext(scx.srv.Context(), s.Recorder()))
s.BroadcastMessage("Creating session with ID: %v", s.id)
s.BroadcastMessage(SessionControlsInfoBroadcast)
mvbrock marked this conversation as resolved.
Show resolved Hide resolved

if err := s.startTerminal(ctx, scx); err != nil {
return trace.Wrap(err)
Expand Down Expand Up @@ -1941,6 +1937,21 @@ func (s *session) addParty(p *party, mode types.SessionParticipantMode) error {
s.participants[p.id] = p
p.ctx.AddCloser(p)

// Display participant mode and available controls to additional participants
if len(s.parties) > 1 {
var modeCtrl bytes.Buffer
modeCtrl.WriteString(fmt.Sprintf("Teleport > Joining session with participant mode: %s\r\n", string(mode)))
modeCtrl.WriteString("Teleport > Controls\r\n")
modeCtrl.WriteString("Teleport > - CTRL-C: Leave the session\r\n")
if p.mode == types.SessionModeratorMode {
modeCtrl.WriteString("Teleport > - t: Forcefully terminate the session\r\n")
}
_, err := p.Write(modeCtrl.Bytes())
if err != nil {
s.log.Errorf("Could not write bytes: %v", err)
}
}

// Write last chunk (so the newly joined parties won't stare at a blank
// screen).
if _, err := p.Write(s.io.GetRecentHistory()); err != nil {
Expand Down
Loading