mirror of
https://github.com/traefik/traefik.git
synced 2025-08-07 15:17:09 +02:00
add unit test for cipherSuite serversTransport validation
This commit is contained in:
parent
337171ad1d
commit
02cac33a40
@ -6,6 +6,7 @@ import (
|
|||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"crypto/x509/pkix"
|
"crypto/x509/pkix"
|
||||||
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -118,9 +119,6 @@ PtvuNc5EImfSkuPBYLBslNxtjbBvAYgacEdY+gRhn2TeIUApnND58lCWsKbNHLFZ
|
|||||||
ajIPbTY+Fe9OTOFTN48ujXNn
|
ajIPbTY+Fe9OTOFTN48ujXNn
|
||||||
-----END PRIVATE KEY-----`)
|
-----END PRIVATE KEY-----`)
|
||||||
|
|
||||||
var cipherSuite = []uint16{tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256}
|
|
||||||
var cipherSuiteName = []string{"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256"}
|
|
||||||
|
|
||||||
func TestKeepConnectionWhenSameConfiguration(t *testing.T) {
|
func TestKeepConnectionWhenSameConfiguration(t *testing.T) {
|
||||||
srv := httptest.NewUnstartedServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
|
srv := httptest.NewUnstartedServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
|
||||||
rw.WriteHeader(http.StatusOK)
|
rw.WriteHeader(http.StatusOK)
|
||||||
@ -196,18 +194,23 @@ func TestCipherSuites(t *testing.T) {
|
|||||||
|
|
||||||
srv.TLS = &tls.Config{
|
srv.TLS = &tls.Config{
|
||||||
Certificates: []tls.Certificate{cert},
|
Certificates: []tls.Certificate{cert},
|
||||||
CipherSuites: cipherSuite,
|
|
||||||
MaxVersion: tls.VersionTLS12,
|
MaxVersion: tls.VersionTLS12,
|
||||||
|
CipherSuites: []uint16{
|
||||||
|
tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
srv.StartTLS()
|
srv.StartTLS()
|
||||||
|
|
||||||
|
fmt.Printf("cipher: %v, version: %v\n", srv.TLS.CipherSuites, srv.TLS.MaxVersion)
|
||||||
|
|
||||||
transportManager := NewTransportManager(nil)
|
transportManager := NewTransportManager(nil)
|
||||||
|
|
||||||
dynamicConf := map[string]*dynamic.ServersTransport{
|
dynamicConf := map[string]*dynamic.ServersTransport{
|
||||||
"test": {
|
"test": {
|
||||||
ServerName: "example.com",
|
ServerName: "example.com",
|
||||||
RootCAs: []types.FileOrContent{types.FileOrContent(LocalhostCert)},
|
RootCAs: []types.FileOrContent{types.FileOrContent(LocalhostCert)},
|
||||||
CipherSuites: cipherSuiteName,
|
CipherSuites: []string{"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"},
|
||||||
|
MaxVersion: "VersionTLS12",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user