make insecure upstream servers configurable

This commit is contained in:
Willy Kloucek
2020-12-04 07:31:46 +01:00
parent 5be1970322
commit 200872b3b4
4 changed files with 23 additions and 0 deletions
+1
View File
@@ -106,6 +106,7 @@ type Config struct {
PreSignedURL PreSignedURL
AutoprovisionAccounts bool
EnableBasicAuth bool
Insecure bool
}
// OIDC is the config for the OpenID-Connect middleware. If set the proxy will try to authenticate every request
+7
View File
@@ -185,6 +185,13 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"PROXY_REVA_GATEWAY_ADDR"},
Destination: &cfg.Reva.Address,
},
&cli.BoolFlag{
Name: "insecure",
Value: false,
Usage: "allow insecure communication to upstream servers",
EnvVars: []string{"PROXY_INSECURE"},
Destination: &cfg.Insecure,
},
// OIDC
+7
View File
@@ -2,6 +2,7 @@ package proxy
import (
"context"
"crypto/tls"
"net/http"
"net/http/httputil"
"net/url"
@@ -37,6 +38,12 @@ func NewMultiHostReverseProxy(opts ...Option) *MultiHostReverseProxy {
}
rp.Director = rp.directorSelectionDirector
rp.Transport = &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: options.Config.Insecure,
},
}
if options.Config.Policies == nil {
rp.logger.Info().Str("source", "runtime").Msg("Policies")
options.Config.Policies = defaultPolicies()