From 01b2fad3d28aa0116316f23637753d661d051326 Mon Sep 17 00:00:00 2001 From: Matias <83959431+mativm02@users.noreply.github.com> Date: Tue, 27 Feb 2024 10:53:28 -0300 Subject: [PATCH] updating JSON tags and field names for TLS max and min versions --- config/config.go | 8 ++++---- gateway/dashboard_register.go | 4 ++-- gateway/proxy_muxer.go | 4 ++-- gateway/rpc_storage_handler.go | 4 ++-- gateway/server.go | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/config/config.go b/config/config.go index b5531771d02..35d3d8b9b2c 100644 --- a/config/config.go +++ b/config/config.go @@ -154,11 +154,11 @@ type StorageOptionsConf struct { // Maximum TLS version that is supported. // Options: ["1.0", "1.1", "1.2", "1.3"]. // Defaults to "1.3". - MaxVersion string `json:"max_version"` + MaxVersion string `json:"tls_max_version"` // Minimum TLS version that is supported. // Options: ["1.0", "1.1", "1.2", "1.3"]. // Defaults to "1.2". - MinVersion string `json:"min_version"` + MinVersion string `json:"tls_min_version"` } type NormalisedURLConfig struct { @@ -424,10 +424,10 @@ type HttpServerOptionsConfig struct { ServerName string `json:"server_name"` // Minimum TLS version. Possible values: https://tyk.io/docs/basic-config-and-security/security/tls-and-ssl/#values-for-tls-versions - MinVersion uint16 `json:"min_version"` + TLSMinVersion uint16 `json:"min_version"` // Maximum TLS version. - MaxVersion uint16 `json:"max_version"` + TLSMaxVersion uint16 `json:"max_version"` // When mTLS enabled, this option allows to skip client CA announcement in the TLS handshake. // This option is useful when you have a lot of ClientCAs and you want to reduce the handshake overhead, as some clients can hit TLS handshake limits. diff --git a/gateway/dashboard_register.go b/gateway/dashboard_register.go index 1e17710e8a4..5683a3bd1ae 100644 --- a/gateway/dashboard_register.go +++ b/gateway/dashboard_register.go @@ -77,8 +77,8 @@ func (gw *Gateway) initialiseClient() *http.Client { // Setup HTTPS client tlsConfig := &tls.Config{ InsecureSkipVerify: gw.GetConfig().HttpServerOptions.SSLInsecureSkipVerify, - MinVersion: gw.GetConfig().HttpServerOptions.MinVersion, - MaxVersion: gw.GetConfig().HttpServerOptions.MaxVersion, + MinVersion: gw.GetConfig().HttpServerOptions.TLSMinVersion, + MaxVersion: gw.GetConfig().HttpServerOptions.TLSMaxVersion, } dashClient.Transport = &http.Transport{TLSClientConfig: tlsConfig} diff --git a/gateway/proxy_muxer.go b/gateway/proxy_muxer.go index 89b23f6d4ad..3a8216c3033 100644 --- a/gateway/proxy_muxer.go +++ b/gateway/proxy_muxer.go @@ -523,8 +523,8 @@ func (m *proxyMux) generateListener(listenPort int, protocol string, gw *Gateway tlsConfig := tls.Config{ GetCertificate: dummyGetCertificate, ServerName: httpServerOptions.ServerName, - MinVersion: httpServerOptions.MinVersion, - MaxVersion: httpServerOptions.MaxVersion, + MinVersion: httpServerOptions.TLSMinVersion, + MaxVersion: httpServerOptions.TLSMaxVersion, ClientAuth: tls.NoClientCert, InsecureSkipVerify: httpServerOptions.SSLInsecureSkipVerify, CipherSuites: getCipherAliases(httpServerOptions.Ciphers), diff --git a/gateway/rpc_storage_handler.go b/gateway/rpc_storage_handler.go index fa5c53bfe7e..5ba76c059da 100644 --- a/gateway/rpc_storage_handler.go +++ b/gateway/rpc_storage_handler.go @@ -126,8 +126,8 @@ func (r *RPCStorageHandler) Connect() bool { rpcConfig := rpc.Config{ UseSSL: slaveOptions.UseSSL, SSLInsecureSkipVerify: slaveOptions.SSLInsecureSkipVerify, - SSLMinVersion: r.Gw.GetConfig().HttpServerOptions.MinVersion, - SSLMaxVersion: r.Gw.GetConfig().HttpServerOptions.MaxVersion, + SSLMinVersion: r.Gw.GetConfig().HttpServerOptions.TLSMinVersion, + SSLMaxVersion: r.Gw.GetConfig().HttpServerOptions.TLSMaxVersion, ConnectionString: slaveOptions.ConnectionString, RPCKey: slaveOptions.RPCKey, APIKey: slaveOptions.APIKey, diff --git a/gateway/server.go b/gateway/server.go index 5e86ffd75fd..f9003991688 100644 --- a/gateway/server.go +++ b/gateway/server.go @@ -1308,12 +1308,12 @@ func (gw *Gateway) initialiseSystem() error { gwConfig.ProxySSLMaxVersion = gwConfig.ProxySSLMinVersion } - if gwConfig.HttpServerOptions.MaxVersion == 0 { - gwConfig.HttpServerOptions.MaxVersion = tls.VersionTLS12 + if gwConfig.HttpServerOptions.TLSMaxVersion == 0 { + gwConfig.HttpServerOptions.TLSMaxVersion = tls.VersionTLS12 } - if gwConfig.HttpServerOptions.MinVersion > gwConfig.HttpServerOptions.MaxVersion { - gwConfig.HttpServerOptions.MaxVersion = gwConfig.HttpServerOptions.MinVersion + if gwConfig.HttpServerOptions.TLSMinVersion > gwConfig.HttpServerOptions.TLSMaxVersion { + gwConfig.HttpServerOptions.TLSMaxVersion = gwConfig.HttpServerOptions.TLSMinVersion } if gwConfig.UseDBAppConfigs && gwConfig.Policies.PolicySource != config.DefaultDashPolicySource {