Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions api/proto/teleport/legacy/types/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4995,6 +4995,15 @@ message WindowsDesktopSpecV3 {
// NonAD marks this desktop as a standalone host that is
// not joined to an Active Directory domain.
bool NonAD = 4 [(gogoproto.jsontag) = "non_ad"];
// ScreenSize specifies the size of the screen to use for sessions
// on this host. In most cases this should be unspecified, in which
// case Teleport will fill the browser window.
Resolution ScreenSize = 5 [(gogoproto.jsontag) = "screen_size,omitempty"];
}

message Resolution {
uint32 Width = 1 [(gogoproto.jsontag) = "width,omitempty"];
uint32 Height = 2 [(gogoproto.jsontag) = "height,omitempty"];
}

// RegisterUsingTokenRequest is a request to register with the auth server using
Expand Down
24 changes: 24 additions & 0 deletions api/types/desktop.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ import (
"github.com/gravitational/teleport/api/utils"
)

const (
MaxRDPScreenWidth = 8192
MaxRDPScreenHeight = 8192
)

// WindowsDesktopService represents a Windows desktop service instance.
type WindowsDesktopService interface {
// ResourceWithLabels provides common resource methods.
Expand Down Expand Up @@ -132,6 +137,10 @@ type WindowsDesktop interface {
// NonAD checks whether this is a standalone host that
// is not joined to an Active Directory domain.
NonAD() bool
// GetScreenSize returns the desired size of the screen to use for sessions
// to this host. Returns (0, 0) if no screen size is set, which means to
// use the size passed by the client over TDP.
GetScreenSize() (width, height uint32)
// Copy returns a copy of this windows desktop
Copy() *WindowsDesktopV3
// CloneResource returns a copy of the WindowDesktop as a ResourceWithLabels
Expand Down Expand Up @@ -179,9 +188,24 @@ func (d *WindowsDesktopV3) CheckAndSetDefaults() error {
if err := d.ResourceHeader.CheckAndSetDefaults(); err != nil {
return trace.Wrap(err)
}

if d.Spec.ScreenSize != nil {
if d.Spec.ScreenSize.Width > MaxRDPScreenWidth || d.Spec.ScreenSize.Height > MaxRDPScreenHeight {
return trace.BadParameter("invalid screen size %dx%d (maximum %dx%d)",
d.Spec.ScreenSize.Width, d.Spec.ScreenSize.Height, MaxRDPScreenWidth, MaxRDPScreenHeight)
}
}

return nil
}

func (d *WindowsDesktopV3) GetScreenSize() (width, height uint32) {
if d.Spec.ScreenSize == nil {
return 0, 0
}
return d.Spec.ScreenSize.Width, d.Spec.ScreenSize.Height
}

// NonAD checks whether host is part of Active Directory
func (d *WindowsDesktopV3) NonAD() bool {
return d.Spec.NonAD
Expand Down
Loading