1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-09 13:05:56 +00:00

set min version on tls configuration even on the tests and examples

This commit is contained in:
Gerasimos (Makis) Maropoulos
2022-03-10 21:48:05 +02:00
parent 096349bb56
commit 7ab0f6fff5
8 changed files with 19 additions and 12 deletions

View File

@@ -22,7 +22,7 @@ import (
// Look `ProxyHandlerRemote` too.
func ProxyHandler(target *url.URL, config *tls.Config) *httputil.ReverseProxy {
if config == nil {
config = &tls.Config{MinVersion: tls.VersionTLS11}
config = &tls.Config{MinVersion: tls.VersionTLS13}
}
director := func(req *http.Request) {
@@ -89,7 +89,7 @@ func modifyProxiedRequest(req *http.Request, target *url.URL) {
// Look `ProxyHandler` too.
func ProxyHandlerRemote(target *url.URL, config *tls.Config) *httputil.ReverseProxy {
if config == nil {
config = &tls.Config{MinVersion: tls.VersionTLS11}
config = &tls.Config{MinVersion: tls.VersionTLS13}
}
director := func(req *http.Request) {

View File

@@ -27,8 +27,7 @@ func TestProxy(t *testing.T) {
config := &tls.Config{
InsecureSkipVerify: true,
MinVersion: tls.VersionTLS11,
MaxVersion: tls.VersionTLS12,
MinVersion: tls.VersionTLS13,
}
proxy := host.NewProxy("", u, config)

View File

@@ -25,7 +25,7 @@ func newTester(t *testing.T, baseURL string, handler http.Handler) *httpexpect.E
if strings.HasPrefix(baseURL, "http") { // means we are testing real serve time
transporter = &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true, MinVersion: tls.VersionTLS11},
TLSClientConfig: &tls.Config{InsecureSkipVerify: true, MinVersion: tls.VersionTLS13},
}
} else { // means we are testing the handler itself
transporter = httpexpect.NewBinder(handler)

View File

@@ -106,7 +106,7 @@ func CERT(addr string, cert tls.Certificate) (net.Listener, error) {
tlsConfig := &tls.Config{
Certificates: []tls.Certificate{cert},
PreferServerCipherSuites: true,
MinVersion: tls.VersionTLS11,
MinVersion: tls.VersionTLS13,
}
return tls.NewListener(l, tlsConfig), nil
}
@@ -146,7 +146,7 @@ func LETSENCRYPT(addr string, reuse bool, serverName string, cacheDirOptional ..
} else {
m.Cache = autocert.DirCache(cacheDir)
}
tlsConfig := &tls.Config{GetCertificate: m.GetCertificate, MinVersion: tls.VersionTLS11}
tlsConfig := &tls.Config{GetCertificate: m.GetCertificate, MinVersion: tls.VersionTLS13}
// use InsecureSkipVerify or ServerName to a value
if serverName == "" {