Improve config

This commit is contained in:
Bolke de Bruin 2020-07-21 10:29:18 +02:00
parent 01345b9416
commit 097a2deca7
4 changed files with 34 additions and 27 deletions

View file

@ -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

View file

@ -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
}
}

12
main.go
View file

@ -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{

View file

@ -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
}