diff --git a/README.md b/README.md index 9f3bd29f40a939a945be094c5a1fa4685e9496bf..65b4a1fc198915db2efbfbf10fef6c8ea7fa0129 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,8 @@ Client: # If true puts splits "user@domain.com" into the user and domain component so that # domain gets set in the rdp file and the domain name is stripped from the username SplitUserDomain: false + # If true, removes "username" (and "domain" if SplitUserDomain is true) from RDP file. + # NoUsername: true Security: # a random string of 32 characters to secure cookies on the client # make sure to share this amongst different pods diff --git a/cmd/rdpgw/config/configuration.go b/cmd/rdpgw/config/configuration.go index 52a30186ca0c3964931ac331d3e580663de7ee84..0a083d26cbb3a1bfe998ad4e8790fd9a1b19683c 100644 --- a/cmd/rdpgw/config/configuration.go +++ b/cmd/rdpgw/config/configuration.go @@ -94,6 +94,7 @@ type ClientConfig struct { // kept for backwards compatibility UsernameTemplate string `koanf:"usernametemplate"` SplitUserDomain bool `koanf:"splituserdomain"` + NoUsername string `koanf:"nousername"` } func ToCamel(s string) string { diff --git a/cmd/rdpgw/main.go b/cmd/rdpgw/main.go index 8b8892fe4af79b6e41d555a0bc7c81fdc50af35b..750d04d98ecbd0c733af386d20ea21afd5f87239 100644 --- a/cmd/rdpgw/main.go +++ b/cmd/rdpgw/main.go @@ -110,6 +110,7 @@ func main() { RdpOpts: web.RdpOpts{ UsernameTemplate: conf.Client.UsernameTemplate, SplitUserDomain: conf.Client.SplitUserDomain, + NoUsername: conf.Client.NoUsername, }, GatewayAddress: url, TemplateFile: conf.Client.Defaults, diff --git a/cmd/rdpgw/web/web.go b/cmd/rdpgw/web/web.go index 97c6bcbbf08d1cf6c92375f3c976cfb8261d3519..a22d83545c1f97d4075e9b155daa7900906105d4 100644 --- a/cmd/rdpgw/web/web.go +++ b/cmd/rdpgw/web/web.go @@ -37,6 +37,7 @@ type Config struct { type RdpOpts struct { UsernameTemplate string SplitUserDomain bool + NoUsername bool } type Handler struct { @@ -210,9 +211,11 @@ func (h *Handler) HandleDownload(w http.ResponseWriter, r *http.Request) { } } - d.Settings.Username = render - if domain != "" { - d.Settings.Domain = domain + if !NoUsername { + d.Settings.Username = render + if domain != "" { + d.Settings.Domain = domain + } } d.Settings.FullAddress = host d.Settings.GatewayHostname = h.gatewayAddress.Host