Skip to content

Commit

Permalink
updating JSON tags and field names for TLS max and min versions
Browse files Browse the repository at this point in the history
  • Loading branch information
mativm02 committed Feb 27, 2024
1 parent 485ebf8 commit 01b2fad
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions gateway/dashboard_register.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions gateway/proxy_muxer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions gateway/rpc_storage_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions gateway/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 01b2fad

Please sign in to comment.