diff --git a/README.md b/README.md index 36bfa7e7d5ac19ca22457c6adebfb0b360418897..0a1f58e413496f515a87111dab9520de5a1fe8f6 100644 --- a/README.md +++ b/README.md @@ -35,12 +35,11 @@ server: # port to listen on port: 443 # list of acceptable desktop hosts to connect to - farmHosts: + hosts: - localhost:3389 + - my-{{ preferred_username }}-host:3389 # Allow the user to connect to any host (insecure) enableOverride: false - # Set the desktop host to connect to filled in by the claims from oidc - hostTemplate: my-{{ preferred_username }}-host:3389 # Open ID Connect specific settings (required) openId: @@ -54,10 +53,11 @@ caps: tokenAuth: true # connection timeout in minutes, 0 is limitless idleTimeout: 10 - DisablePrinter: true - DisablePort: true - DisablePnp: true - DisableDrive: true + EnablePrinter: true + EnablePort: true + EnablePnp: true + EnableDrive: true + EnableClipboard: true ``` ## Use diff --git a/config/configuration.go b/config/configuration.go index 1dc64cc9b2871ae7c35abbead49c45a91a4ab447..10e0bd9f8643d5e8f1a8a0315f273588292f9b2a 100644 --- a/config/configuration.go +++ b/config/configuration.go @@ -16,28 +16,27 @@ type ServerConfig struct { Port int CertFile string KeyFile string - FarmHosts []string + Hosts []string EnableOverride bool - HostTemplate string } type OpenIDConfig struct { - ProviderUrl string + ProviderUrl string ClientId string ClientSecret string } type RDGCapsConfig struct { - SmartCardAuth bool - TokenAuth bool - IdleTimeout int - RedirectAll bool - DisableRedirect bool - DisableClipboard bool - DisablePrinter bool - DisablePort bool - DisablePnp bool - DisableDrive bool + SmartCardAuth bool + TokenAuth bool + IdleTimeout int + RedirectAll bool + DisableRedirect bool + EnableClipboard bool + EnablePrinter bool + EnablePort bool + EnablePnp bool + EnableDrive bool } func init() { @@ -64,4 +63,4 @@ func Load(configFile string) Configuration { } return conf -} \ No newline at end of file +} diff --git a/main.go b/main.go index 804872adbc832cea785e576be0a9bc937a9b3664..6ee11e11fa7bec78bb3032db77836636b25ac4a3 100644 --- a/main.go +++ b/main.go @@ -91,9 +91,17 @@ func main() { // create the gateway handlerConfig := protocol.HandlerConf{ - TokenAuth: true, + IdleTimeout: conf.Caps.IdleTimeout, + TokenAuth: conf.Caps.TokenAuth, + SmartCardAuth: conf.Caps.SmartCardAuth, RedirectFlags: protocol.RedirectFlags{ - Clipboard: true, + Clipboard: conf.Caps.EnableClipboard, + Drive: conf.Caps.EnableDrive, + Printer: conf.Caps.EnablePrinter, + Port: conf.Caps.EnablePort, + Pnp: conf.Caps.EnablePnp, + DisableAll: conf.Caps.DisableRedirect, + EnableAll: conf.Caps.RedirectAll, }, } gw := protocol.Gateway{ diff --git a/protocol/handler.go b/protocol/handler.go index 247fbb8b7f0afefffce12bc20ca2e3dbc4fde818..98cb9cd1e63fcd839fa919a8fdff7647b0b9c3b0 100644 --- a/protocol/handler.go +++ b/protocol/handler.go @@ -22,8 +22,8 @@ type RedirectFlags struct { Drive bool Printer bool Pnp bool - disableAll bool - enableAll bool + DisableAll bool + EnableAll bool } type Handler struct { @@ -408,10 +408,10 @@ func createPacket(pktType uint16, data []byte) (packet []byte) { func makeRedirectFlags(flags RedirectFlags) int { var redir = 0 - if flags.disableAll { + if flags.DisableAll { return HTTP_TUNNEL_REDIR_DISABLE_ALL } - if flags.enableAll { + if flags.EnableAll { return HTTP_TUNNEL_REDIR_ENABLE_ALL }