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 to listen on
port: 443 port: 443
# list of acceptable desktop hosts to connect to # list of acceptable desktop hosts to connect to
farmHosts: hosts:
- localhost:3389 - localhost:3389
- my-{{ preferred_username }}-host:3389
# Allow the user to connect to any host (insecure) # Allow the user to connect to any host (insecure)
enableOverride: false 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) # Open ID Connect specific settings (required)
openId: openId:
@@ -54,10 +53,11 @@ caps:
tokenAuth: true tokenAuth: true
# connection timeout in minutes, 0 is limitless # connection timeout in minutes, 0 is limitless
idleTimeout: 10 idleTimeout: 10
DisablePrinter: true EnablePrinter: true
DisablePort: true EnablePort: true
DisablePnp: true EnablePnp: true
DisableDrive: true EnableDrive: true
EnableClipboard: true
``` ```
## Use ## Use

View File

@@ -16,28 +16,27 @@ type ServerConfig struct {
Port int Port int
CertFile string CertFile string
KeyFile string KeyFile string
FarmHosts []string Hosts []string
EnableOverride bool EnableOverride bool
HostTemplate string
} }
type OpenIDConfig struct { type OpenIDConfig struct {
ProviderUrl string ProviderUrl string
ClientId string ClientId string
ClientSecret string ClientSecret string
} }
type RDGCapsConfig struct { type RDGCapsConfig struct {
SmartCardAuth bool SmartCardAuth bool
TokenAuth bool TokenAuth bool
IdleTimeout int IdleTimeout int
RedirectAll bool RedirectAll bool
DisableRedirect bool DisableRedirect bool
DisableClipboard bool EnableClipboard bool
DisablePrinter bool EnablePrinter bool
DisablePort bool EnablePort bool
DisablePnp bool EnablePnp bool
DisableDrive bool EnableDrive bool
} }
func init() { func init() {
@@ -64,4 +63,4 @@ func Load(configFile string) Configuration {
} }
return conf return conf
} }

12
main.go
View File

@@ -91,9 +91,17 @@ func main() {
// create the gateway // create the gateway
handlerConfig := protocol.HandlerConf{ handlerConfig := protocol.HandlerConf{
TokenAuth: true, IdleTimeout: conf.Caps.IdleTimeout,
TokenAuth: conf.Caps.TokenAuth,
SmartCardAuth: conf.Caps.SmartCardAuth,
RedirectFlags: protocol.RedirectFlags{ 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{ gw := protocol.Gateway{

View File

@@ -22,8 +22,8 @@ type RedirectFlags struct {
Drive bool Drive bool
Printer bool Printer bool
Pnp bool Pnp bool
disableAll bool DisableAll bool
enableAll bool EnableAll bool
} }
type Handler struct { type Handler struct {
@@ -408,10 +408,10 @@ func createPacket(pktType uint16, data []byte) (packet []byte) {
func makeRedirectFlags(flags RedirectFlags) int { func makeRedirectFlags(flags RedirectFlags) int {
var redir = 0 var redir = 0
if flags.disableAll { if flags.DisableAll {
return HTTP_TUNNEL_REDIR_DISABLE_ALL return HTTP_TUNNEL_REDIR_DISABLE_ALL
} }
if flags.enableAll { if flags.EnableAll {
return HTTP_TUNNEL_REDIR_ENABLE_ALL return HTTP_TUNNEL_REDIR_ENABLE_ALL
} }