Restrict traefik.toml to static configuration.
This commit is contained in:
parent
f49800e56a
commit
093658836e
78 changed files with 274 additions and 440 deletions
|
@ -2,6 +2,7 @@ package integration
|
|||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/containous/traefik/integration/try"
|
||||
|
@ -14,12 +15,13 @@ type FileSuite struct{ BaseSuite }
|
|||
|
||||
func (s *FileSuite) SetUpSuite(c *check.C) {
|
||||
s.createComposeProject(c, "file")
|
||||
|
||||
s.composeProject.Start(c)
|
||||
}
|
||||
|
||||
func (s *FileSuite) TestSimpleConfiguration(c *check.C) {
|
||||
cmd, display := s.traefikCmd(withConfigFile("fixtures/file/simple.toml"))
|
||||
file := s.adaptFile(c, "fixtures/file/simple.toml", struct{}{})
|
||||
defer os.Remove(file)
|
||||
cmd, display := s.traefikCmd(withConfigFile(file))
|
||||
defer display(c)
|
||||
err := cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
[entryPoints.web]
|
||||
address = ":8080"
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
[entryPoints.web]
|
||||
address = ":8080"
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
[entryPoints.web]
|
||||
address = ":8000"
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
[entryPoints.web]
|
||||
address = ":8000"
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
[entryPoints.web]
|
||||
address = ":8000"
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
[entryPoints.web]
|
||||
address = ":8000"
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ fblo6RBxUQ==
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
[global]
|
||||
checkNewVersion = false
|
||||
sendAnonymousUsage = false
|
||||
|
||||
[log]
|
||||
filePath = "traefik.log"
|
||||
level = "ERROR"
|
||||
|
||||
[accessLog]
|
||||
filePath = "access.log"
|
||||
|
||||
[entryPoints]
|
||||
[entryPoints.web]
|
||||
address = ":8000"
|
||||
[entryPoints.api]
|
||||
address = ":7888"
|
||||
|
||||
[api]
|
||||
entryPoint = "api"
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
[http.routers]
|
||||
[http.routers.router1]
|
||||
Service = "service1"
|
||||
rule = "Path(`/test1`)"
|
||||
|
||||
[http.services]
|
||||
[http.services.service1]
|
||||
[http.services.service1.loadBalancer]
|
||||
|
||||
[[http.services.service1.loadBalancer.servers]]
|
||||
url = "http://127.0.0.1:8081"
|
|
@ -17,6 +17,7 @@
|
|||
exposedByDefault = false
|
||||
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
[providers.rest]
|
||||
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
[entryPoints.api]
|
||||
address = ":8080"
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
[ping]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
@ -32,5 +32,5 @@
|
|||
[http.services]
|
||||
[http.services.service.loadBalancer]
|
||||
[[http.services.service.loadBalancer.servers]]
|
||||
url = "{{.Server}}"
|
||||
url = "{{ .Server }}"
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
[ping]
|
||||
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
[http.middlewares]
|
||||
[http.middlewares.authentication.basicAuth]
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
[api]
|
||||
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
[api]
|
||||
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
[api]
|
||||
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
[api]
|
||||
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
[api]
|
||||
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
[api]
|
||||
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
[tcp]
|
||||
[tcp.routers]
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
[api]
|
||||
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
watch = true
|
||||
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
samplingServerURL = "http://{{.IP}}:5778/sampling"
|
||||
localAgentHostPort = "{{.IP}}:6831"
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
httpEndpoint = "http://{{.IP}}:9411/api/v1/spans"
|
||||
debug = true
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
[api]
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
[providers.file]
|
||||
filename = "{{ .SelfFilename }}"
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package integration
|
|||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/containous/traefik/integration/try"
|
||||
|
@ -25,7 +26,9 @@ func (s *HeadersSuite) TestSimpleConfiguration(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *HeadersSuite) TestCorsResponses(c *check.C) {
|
||||
cmd, display := s.traefikCmd(withConfigFile("fixtures/headers/cors.toml"))
|
||||
file := s.adaptFile(c, "fixtures/headers/cors.toml", struct{}{})
|
||||
defer os.Remove(file)
|
||||
cmd, display := s.traefikCmd(withConfigFile(file))
|
||||
defer display(c)
|
||||
|
||||
err := cmd.Start()
|
||||
|
|
|
@ -25,7 +25,9 @@ type HTTPSSuite struct{ BaseSuite }
|
|||
// "snitest.com", which happens to match the CN of 'snitest.com.crt'. The test
|
||||
// verifies that traefik presents the correct certificate.
|
||||
func (s *HTTPSSuite) TestWithSNIConfigHandshake(c *check.C) {
|
||||
cmd, display := s.traefikCmd(withConfigFile("fixtures/https/https_sni.toml"))
|
||||
file := s.adaptFile(c, "fixtures/https/https_sni.toml", struct{}{})
|
||||
defer os.Remove(file)
|
||||
cmd, display := s.traefikCmd(withConfigFile(file))
|
||||
defer display(c)
|
||||
err := cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
@ -59,7 +61,9 @@ func (s *HTTPSSuite) TestWithSNIConfigHandshake(c *check.C) {
|
|||
// SNI hostnames of "snitest.org" and "snitest.com". The test verifies
|
||||
// that traefik routes the requests to the expected backends.
|
||||
func (s *HTTPSSuite) TestWithSNIConfigRoute(c *check.C) {
|
||||
cmd, display := s.traefikCmd(withConfigFile("fixtures/https/https_sni.toml"))
|
||||
file := s.adaptFile(c, "fixtures/https/https_sni.toml", struct{}{})
|
||||
defer os.Remove(file)
|
||||
cmd, display := s.traefikCmd(withConfigFile(file))
|
||||
defer display(c)
|
||||
err := cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
@ -113,7 +117,9 @@ func (s *HTTPSSuite) TestWithSNIConfigRoute(c *check.C) {
|
|||
|
||||
// TestWithTLSOptions verifies that traefik routes the requests with the associated tls options.
|
||||
func (s *HTTPSSuite) TestWithTLSOptions(c *check.C) {
|
||||
cmd, display := s.traefikCmd(withConfigFile("fixtures/https/https_tls_options.toml"))
|
||||
file := s.adaptFile(c, "fixtures/https/https_tls_options.toml", struct{}{})
|
||||
defer os.Remove(file)
|
||||
cmd, display := s.traefikCmd(withConfigFile(file))
|
||||
defer display(c)
|
||||
err := cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
@ -197,7 +203,9 @@ func (s *HTTPSSuite) TestWithTLSOptions(c *check.C) {
|
|||
|
||||
// TestWithConflictingTLSOptions checks that routers with same SNI but different TLS options get fallbacked to the default TLS options.
|
||||
func (s *HTTPSSuite) TestWithConflictingTLSOptions(c *check.C) {
|
||||
cmd, display := s.traefikCmd(withConfigFile("fixtures/https/https_tls_options.toml"))
|
||||
file := s.adaptFile(c, "fixtures/https/https_tls_options.toml", struct{}{})
|
||||
defer os.Remove(file)
|
||||
cmd, display := s.traefikCmd(withConfigFile(file))
|
||||
defer display(c)
|
||||
err := cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
@ -265,7 +273,9 @@ func (s *HTTPSSuite) TestWithConflictingTLSOptions(c *check.C) {
|
|||
// "snitest.org", which does not match the CN of 'snitest.com.crt'. The test
|
||||
// verifies that traefik closes the connection.
|
||||
func (s *HTTPSSuite) TestWithSNIStrictNotMatchedRequest(c *check.C) {
|
||||
cmd, display := s.traefikCmd(withConfigFile("fixtures/https/https_sni_strict.toml"))
|
||||
file := s.adaptFile(c, "fixtures/https/https_sni_strict.toml", struct{}{})
|
||||
defer os.Remove(file)
|
||||
cmd, display := s.traefikCmd(withConfigFile(file))
|
||||
defer display(c)
|
||||
err := cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
@ -289,7 +299,9 @@ func (s *HTTPSSuite) TestWithSNIStrictNotMatchedRequest(c *check.C) {
|
|||
// "snitest.org", which does not match the CN of 'snitest.com.crt'. The test
|
||||
// verifies that traefik returns the default certificate.
|
||||
func (s *HTTPSSuite) TestWithDefaultCertificate(c *check.C) {
|
||||
cmd, display := s.traefikCmd(withConfigFile("fixtures/https/https_sni_default_cert.toml"))
|
||||
file := s.adaptFile(c, "fixtures/https/https_sni_default_cert.toml", struct{}{})
|
||||
defer os.Remove(file)
|
||||
cmd, display := s.traefikCmd(withConfigFile(file))
|
||||
defer display(c)
|
||||
err := cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
@ -323,7 +335,9 @@ func (s *HTTPSSuite) TestWithDefaultCertificate(c *check.C) {
|
|||
// which does not match the CN of 'snitest.com.crt'. The test
|
||||
// verifies that traefik returns the default certificate.
|
||||
func (s *HTTPSSuite) TestWithDefaultCertificateNoSNI(c *check.C) {
|
||||
cmd, display := s.traefikCmd(withConfigFile("fixtures/https/https_sni_default_cert.toml"))
|
||||
file := s.adaptFile(c, "fixtures/https/https_sni_default_cert.toml", struct{}{})
|
||||
defer os.Remove(file)
|
||||
cmd, display := s.traefikCmd(withConfigFile(file))
|
||||
defer display(c)
|
||||
err := cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
@ -357,7 +371,9 @@ func (s *HTTPSSuite) TestWithDefaultCertificateNoSNI(c *check.C) {
|
|||
// 'wildcard.snitest.com.crt', and `www.snitest.com.crt`. The test
|
||||
// verifies that traefik returns the non-wildcard certificate.
|
||||
func (s *HTTPSSuite) TestWithOverlappingStaticCertificate(c *check.C) {
|
||||
cmd, display := s.traefikCmd(withConfigFile("fixtures/https/https_sni_default_cert.toml"))
|
||||
file := s.adaptFile(c, "fixtures/https/https_sni_default_cert.toml", struct{}{})
|
||||
defer os.Remove(file)
|
||||
cmd, display := s.traefikCmd(withConfigFile(file))
|
||||
defer display(c)
|
||||
err := cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
@ -392,7 +408,9 @@ func (s *HTTPSSuite) TestWithOverlappingStaticCertificate(c *check.C) {
|
|||
// 'wildcard.snitest.com.crt', and `www.snitest.com.crt`. The test
|
||||
// verifies that traefik returns the non-wildcard certificate.
|
||||
func (s *HTTPSSuite) TestWithOverlappingDynamicCertificate(c *check.C) {
|
||||
cmd, display := s.traefikCmd(withConfigFile("fixtures/https/dynamic_https_sni_default_cert.toml"))
|
||||
file := s.adaptFile(c, "fixtures/https/dynamic_https_sni_default_cert.toml", struct{}{})
|
||||
defer os.Remove(file)
|
||||
cmd, display := s.traefikCmd(withConfigFile(file))
|
||||
defer display(c)
|
||||
err := cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
@ -425,7 +443,9 @@ func (s *HTTPSSuite) TestWithOverlappingDynamicCertificate(c *check.C) {
|
|||
// TestWithClientCertificateAuthentication
|
||||
// The client can send a certificate signed by a CA trusted by the server but it's optional
|
||||
func (s *HTTPSSuite) TestWithClientCertificateAuthentication(c *check.C) {
|
||||
cmd, display := s.traefikCmd(withConfigFile("fixtures/https/clientca/https_1ca1config.toml"))
|
||||
file := s.adaptFile(c, "fixtures/https/clientca/https_1ca1config.toml", struct{}{})
|
||||
defer os.Remove(file)
|
||||
cmd, display := s.traefikCmd(withConfigFile(file))
|
||||
defer display(c)
|
||||
err := cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
@ -481,7 +501,9 @@ func (s *HTTPSSuite) TestWithClientCertificateAuthentication(c *check.C) {
|
|||
// TestWithClientCertificateAuthentication
|
||||
// Use two CA:s and test that clients with client signed by either of them can connect
|
||||
func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipleCAs(c *check.C) {
|
||||
cmd, display := s.traefikCmd(withConfigFile("fixtures/https/clientca/https_2ca1config.toml"))
|
||||
file := s.adaptFile(c, "fixtures/https/clientca/https_2ca1config.toml", struct{}{})
|
||||
defer os.Remove(file)
|
||||
cmd, display := s.traefikCmd(withConfigFile(file))
|
||||
defer display(c)
|
||||
err := cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
@ -542,7 +564,9 @@ func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipleCAs(c *check
|
|||
// TestWithClientCertificateAuthentication
|
||||
// Use two CA:s in two different files and test that clients with client signed by either of them can connect
|
||||
func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipleCAsMultipleFiles(c *check.C) {
|
||||
cmd, display := s.traefikCmd(withConfigFile("fixtures/https/clientca/https_2ca2config.toml"))
|
||||
file := s.adaptFile(c, "fixtures/https/clientca/https_2ca2config.toml", struct{}{})
|
||||
defer os.Remove(file)
|
||||
cmd, display := s.traefikCmd(withConfigFile(file))
|
||||
defer display(c)
|
||||
err := cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
@ -777,7 +801,7 @@ func (s *HTTPSSuite) TestWithSNIDynamicConfigRouteWithChange(c *check.C) {
|
|||
c.Assert(err, checker.IsNil)
|
||||
|
||||
// Change certificates configuration file content
|
||||
modifyCertificateConfFileContent(c, tr1.TLSClientConfig.ServerName, dynamicConfFileName, "https")
|
||||
modifyCertificateConfFileContent(c, tr1.TLSClientConfig.ServerName, dynamicConfFileName)
|
||||
|
||||
req, err := http.NewRequest(http.MethodGet, "https://127.0.0.1:4443/", nil)
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
@ -846,14 +870,14 @@ func (s *HTTPSSuite) TestWithSNIDynamicConfigRouteWithTlsConfigurationDeletion(c
|
|||
c.Assert(err, checker.IsNil)
|
||||
|
||||
// Change certificates configuration file content
|
||||
modifyCertificateConfFileContent(c, "", dynamicConfFileName, "https02")
|
||||
modifyCertificateConfFileContent(c, "", dynamicConfFileName)
|
||||
|
||||
err = try.RequestWithTransport(req, 30*time.Second, tr2, try.HasCn("TRAEFIK DEFAULT CERT"), try.StatusCodeIs(http.StatusNotFound))
|
||||
c.Assert(err, checker.IsNil)
|
||||
}
|
||||
|
||||
// modifyCertificateConfFileContent replaces the content of a HTTPS configuration file.
|
||||
func modifyCertificateConfFileContent(c *check.C, certFileName, confFileName, entryPoint string) {
|
||||
func modifyCertificateConfFileContent(c *check.C, certFileName, confFileName string) {
|
||||
file, err := os.OpenFile("./"+confFileName, os.O_WRONLY, os.ModeExclusive)
|
||||
c.Assert(err, checker.IsNil)
|
||||
defer func() {
|
||||
|
@ -884,8 +908,10 @@ func modifyCertificateConfFileContent(c *check.C, certFileName, confFileName, en
|
|||
}
|
||||
}
|
||||
|
||||
func (s *HTTPSSuite) TestEntrypointHttpsRedirectAndPathModification(c *check.C) {
|
||||
cmd, display := s.traefikCmd(withConfigFile("fixtures/https/https_redirect.toml"))
|
||||
func (s *HTTPSSuite) TestEntryPointHttpsRedirectAndPathModification(c *check.C) {
|
||||
file := s.adaptFile(c, "fixtures/https/https_redirect.toml", struct{}{})
|
||||
defer os.Remove(file)
|
||||
cmd, display := s.traefikCmd(withConfigFile(file))
|
||||
defer display(c)
|
||||
err := cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
@ -986,7 +1012,9 @@ func (s *HTTPSSuite) TestEntrypointHttpsRedirectAndPathModification(c *check.C)
|
|||
// "bar.www.snitest.com", which matches the DNS SAN of '*.WWW.SNITEST.COM'. The test
|
||||
// verifies that traefik presents the correct certificate.
|
||||
func (s *HTTPSSuite) TestWithSNIDynamicCaseInsensitive(c *check.C) {
|
||||
cmd, display := s.traefikCmd(withConfigFile("fixtures/https/https_sni_case_insensitive_dynamic.toml"))
|
||||
file := s.adaptFile(c, "fixtures/https/https_sni_case_insensitive_dynamic.toml", struct{}{})
|
||||
defer os.Remove(file)
|
||||
cmd, display := s.traefikCmd(withConfigFile(file))
|
||||
defer display(c)
|
||||
err := cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
|
|
@ -15,6 +15,7 @@ import (
|
|||
"text/template"
|
||||
|
||||
"github.com/containous/traefik/pkg/log"
|
||||
"github.com/fatih/structs"
|
||||
"github.com/go-check/check"
|
||||
compose "github.com/libkermit/compose/check"
|
||||
checker "github.com/vdemeester/shakers"
|
||||
|
@ -150,7 +151,10 @@ func (s *BaseSuite) adaptFile(c *check.C, path string, tempObjects interface{})
|
|||
c.Assert(err, checker.IsNil)
|
||||
defer tmpFile.Close()
|
||||
|
||||
err = tmpl.ExecuteTemplate(tmpFile, prefix, tempObjects)
|
||||
model := structs.Map(tempObjects)
|
||||
model["SelfFilename"] = tmpFile.Name()
|
||||
|
||||
err = tmpl.ExecuteTemplate(tmpFile, prefix, model)
|
||||
c.Assert(err, checker.IsNil)
|
||||
err = tmpFile.Sync()
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@ func (s *SimpleSuite) TestRequestAcceptGraceTimeout(c *check.C) {
|
|||
Server string
|
||||
}{whoami})
|
||||
defer os.Remove(file)
|
||||
|
||||
cmd, display := s.traefikCmd(withConfigFile(file))
|
||||
defer display(c)
|
||||
err := cmd.Start()
|
||||
|
@ -223,7 +224,9 @@ func (s *SimpleSuite) TestNoAuthOnPing(c *check.C) {
|
|||
s.createComposeProject(c, "base")
|
||||
s.composeProject.Start(c)
|
||||
|
||||
cmd, output := s.traefikCmd(withConfigFile("./fixtures/simple_auth.toml"))
|
||||
file := s.adaptFile(c, "./fixtures/simple_auth.toml", struct{}{})
|
||||
defer os.Remove(file)
|
||||
cmd, output := s.traefikCmd(withConfigFile(file))
|
||||
defer output(c)
|
||||
|
||||
err := cmd.Start()
|
||||
|
@ -237,7 +240,7 @@ func (s *SimpleSuite) TestNoAuthOnPing(c *check.C) {
|
|||
c.Assert(err, checker.IsNil)
|
||||
}
|
||||
|
||||
func (s *SimpleSuite) TestDefaultEntrypointHTTP(c *check.C) {
|
||||
func (s *SimpleSuite) TestDefaultEntryPointHTTP(c *check.C) {
|
||||
s.createComposeProject(c, "base")
|
||||
s.composeProject.Start(c)
|
||||
|
||||
|
@ -255,7 +258,7 @@ func (s *SimpleSuite) TestDefaultEntrypointHTTP(c *check.C) {
|
|||
c.Assert(err, checker.IsNil)
|
||||
}
|
||||
|
||||
func (s *SimpleSuite) TestWithUnexistingEntrypoint(c *check.C) {
|
||||
func (s *SimpleSuite) TestWithNonExistingEntryPoint(c *check.C) {
|
||||
s.createComposeProject(c, "base")
|
||||
s.composeProject.Start(c)
|
||||
|
||||
|
@ -273,7 +276,7 @@ func (s *SimpleSuite) TestWithUnexistingEntrypoint(c *check.C) {
|
|||
c.Assert(err, checker.IsNil)
|
||||
}
|
||||
|
||||
func (s *SimpleSuite) TestMetricsPrometheusDefaultEntrypoint(c *check.C) {
|
||||
func (s *SimpleSuite) TestMetricsPrometheusDefaultEntryPoint(c *check.C) {
|
||||
s.createComposeProject(c, "base")
|
||||
s.composeProject.Start(c)
|
||||
|
||||
|
@ -419,7 +422,7 @@ func (s *SimpleSuite) TestXForwardedHeaders(c *check.C) {
|
|||
c.Assert(err, checker.IsNil)
|
||||
}
|
||||
|
||||
func (s *SimpleSuite) TestMultiprovider(c *check.C) {
|
||||
func (s *SimpleSuite) TestMultiProvider(c *check.C) {
|
||||
s.createComposeProject(c, "base")
|
||||
s.composeProject.Start(c)
|
||||
|
||||
|
@ -453,10 +456,10 @@ func (s *SimpleSuite) TestMultiprovider(c *check.C) {
|
|||
},
|
||||
}
|
||||
|
||||
json, err := json.Marshal(config)
|
||||
jsonContent, err := json.Marshal(config)
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
request, err := http.NewRequest(http.MethodPut, "http://127.0.0.1:8080/api/providers/rest", bytes.NewReader(json))
|
||||
request, err := http.NewRequest(http.MethodPut, "http://127.0.0.1:8080/api/providers/rest", bytes.NewReader(jsonContent))
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
response, err := http.DefaultClient.Do(request)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue