Add global InsecureSkipVerify option to disable certificate checking

Signed-off-by: Stuart Clark <stuart.clark@Jahingo.com>
This commit is contained in:
Stuart Clark 2016-07-23 15:54:37 +01:00
parent 7abe68fac1
commit 4882519c0f
2 changed files with 5 additions and 0 deletions

View file

@ -33,6 +33,7 @@ type GlobalConfiguration struct {
DefaultEntryPoints DefaultEntryPoints `description:"Entrypoints to be used by frontends that do not specify any entrypoint"` DefaultEntryPoints DefaultEntryPoints `description:"Entrypoints to be used by frontends that do not specify any entrypoint"`
ProvidersThrottleDuration time.Duration `description:"Backends throttle duration: minimum duration between 2 events from providers before applying a new configuration. It avoids unnecessary reloads if multiples events are sent in a short amount of time."` ProvidersThrottleDuration time.Duration `description:"Backends throttle duration: minimum duration between 2 events from providers before applying a new configuration. It avoids unnecessary reloads if multiples events are sent in a short amount of time."`
MaxIdleConnsPerHost int `description:"If non-zero, controls the maximum idle (keep-alive) to keep per-host. If zero, DefaultMaxIdleConnsPerHost is used"` MaxIdleConnsPerHost int `description:"If non-zero, controls the maximum idle (keep-alive) to keep per-host. If zero, DefaultMaxIdleConnsPerHost is used"`
InsecureSkipVerify bool `description:"Disable SSL certificate verification"`
Retry *Retry `description:"Enable retry sending request if network error"` Retry *Retry `description:"Enable retry sending request if network error"`
Docker *provider.Docker `description:"Enable Docker backend"` Docker *provider.Docker `description:"Enable Docker backend"`
File *provider.File `description:"Enable File backend"` File *provider.File `description:"Enable File backend"`

View file

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
fmtlog "log" fmtlog "log"
"net/http" "net/http"
"crypto/tls"
"os" "os"
"reflect" "reflect"
"runtime" "runtime"
@ -173,6 +174,9 @@ func run(traefikConfiguration *TraefikConfiguration) {
globalConfiguration := traefikConfiguration.GlobalConfiguration globalConfiguration := traefikConfiguration.GlobalConfiguration
http.DefaultTransport.(*http.Transport).MaxIdleConnsPerHost = globalConfiguration.MaxIdleConnsPerHost http.DefaultTransport.(*http.Transport).MaxIdleConnsPerHost = globalConfiguration.MaxIdleConnsPerHost
if globalConfiguration.InsecureSkipVerify {
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
}
loggerMiddleware := middlewares.NewLogger(globalConfiguration.AccessLogsFile) loggerMiddleware := middlewares.NewLogger(globalConfiguration.AccessLogsFile)
defer loggerMiddleware.Close() defer loggerMiddleware.Close()