mirror of
https://github.com/bolkedebruin/rdpgw.git
synced 2026-03-29 23:16:37 +00:00
Fix check against disabled TLS
This commit is contained in:
@@ -11,6 +11,20 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
TlsDisable = "disable"
|
||||||
|
TlsAuto = "auto"
|
||||||
|
|
||||||
|
HostSelectionSigned = "signed"
|
||||||
|
HostSelectionRoundRobin = "roundrobin"
|
||||||
|
|
||||||
|
SessionStoreCookie = "cookie"
|
||||||
|
SessionStoreFile = "file"
|
||||||
|
|
||||||
|
AuthenticationOpenId = "openid"
|
||||||
|
AuthenticationBasic = "local"
|
||||||
|
)
|
||||||
|
|
||||||
type Configuration struct {
|
type Configuration struct {
|
||||||
Server ServerConfig `koanf:"server"`
|
Server ServerConfig `koanf:"server"`
|
||||||
OpenId OpenIDConfig `koanf:"openid"`
|
OpenId OpenIDConfig `koanf:"openid"`
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ func main() {
|
|||||||
log.Printf("Starting remote desktop gateway server")
|
log.Printf("Starting remote desktop gateway server")
|
||||||
cfg := &tls.Config{}
|
cfg := &tls.Config{}
|
||||||
|
|
||||||
if conf.Server.Tls == "disable" {
|
if conf.Server.Tls == config.TlsDisable {
|
||||||
log.Printf("TLS disabled - rdp gw connections require tls, make sure to have a terminator")
|
log.Printf("TLS disabled - rdp gw connections require tls, make sure to have a terminator")
|
||||||
} else {
|
} else {
|
||||||
// auto config
|
// auto config
|
||||||
@@ -203,7 +203,7 @@ func main() {
|
|||||||
ServerConf: &gwConfig,
|
ServerConf: &gwConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
if conf.Server.Authentication == "local" {
|
if conf.Server.Authentication == config.AuthenticationBasic {
|
||||||
h := web.BasicAuthHandler{SocketAddress: conf.Server.AuthSocket}
|
h := web.BasicAuthHandler{SocketAddress: conf.Server.AuthSocket}
|
||||||
http.Handle("/remoteDesktopGateway/", common.EnrichContext(h.BasicAuth(gw.HandleGatewayProtocol)))
|
http.Handle("/remoteDesktopGateway/", common.EnrichContext(h.BasicAuth(gw.HandleGatewayProtocol)))
|
||||||
} else {
|
} else {
|
||||||
@@ -216,7 +216,7 @@ func main() {
|
|||||||
http.Handle("/metrics", promhttp.Handler())
|
http.Handle("/metrics", promhttp.Handler())
|
||||||
http.HandleFunc("/tokeninfo", web.TokenInfo)
|
http.HandleFunc("/tokeninfo", web.TokenInfo)
|
||||||
|
|
||||||
if conf.Server.Tls == "disabled" {
|
if conf.Server.Tls == config.TlsDisable {
|
||||||
err = server.ListenAndServe()
|
err = server.ListenAndServe()
|
||||||
} else {
|
} else {
|
||||||
err = server.ListenAndServeTLS("", "")
|
err = server.ListenAndServeTLS("", "")
|
||||||
|
|||||||
Reference in New Issue
Block a user