-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TT-13629]: OAS upstream SSL configuration #6840
base: master
Are you sure you want to change the base?
Conversation
6f6eb36
to
569bcaf
Compare
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
API Changes --- prev.txt 2025-01-23 08:27:53.416521359 +0000
+++ current.txt 2025-01-23 08:27:48.204537201 +0000
@@ -3624,6 +3624,23 @@
Provider defines an issuer to validate and the Client ID to Policy ID
mappings.
+type Proxy struct {
+ // Enabled determines if the proxy is active.
+ Enabled bool `bson:"enabled" json:"enabled"`
+
+ // URL specifies the URL of the internal proxy.
+ URL string `bson:"url" json:"url"`
+}
+ Proxy contains the configuration for an internal proxy.
+
+ Tyk classic API definition: `proxy.proxy_url`
+
+func (p *Proxy) ExtractTo(api *apidef.APIDefinition)
+ ExtractTo extracts *Proxy into *apidef.ServiceDiscoveryConfiguration.
+
+func (p *Proxy) Fill(api apidef.APIDefinition)
+ Fill fills *Proxy from apidef.ServiceDiscoveryConfiguration.
+
type RateLimit struct {
// Enabled activates API level rate limiting for this API.
//
@@ -4011,6 +4028,58 @@
func (s *State) Fill(api apidef.APIDefinition)
Fill fills *State from apidef.APIDefinition.
+type TLSTransport struct {
+ // InsecureSkipVerify controls whether a client verifies the server's certificate chain and host name.
+ // If InsecureSkipVerify is true, crypto/tls accepts any certificate presented by the server and any host name in that certificate.
+ // In this mode, TLS is susceptible to machine-in-the-middle attacks unless custom verification is used.
+ // This should be used only for testing or in combination with VerifyConnection or VerifyPeerCertificate.
+ //
+ // Tyk classic API definition: `proxy.transport.ssl_insecure_skip_verify`
+ InsecureSkipVerify bool `bson:"insecureSkipVerify,omitempty" json:"insecureSkipVerify,omitempty"`
+
+ // Ciphers is a list of SSL ciphers to be used. If unset, the default ciphers will be used.
+ //
+ // Tyk classic API definition: `proxy.transport.ssl_ciphers`
+ Ciphers []string `bson:"ciphers,omitempty" json:"ciphers,omitempty"`
+
+ // MinVersion is the minimum SSL/TLS version that is acceptable.
+ // Tyk classic API definition: `proxy.transport.ssl_min_version`
+ MinVersion string `bson:"minVersion,omitempty" json:"minVersion,omitempty"`
+
+ // MaxVersion is the maximum SSL/TLS version that is acceptable.
+ MaxVersion string `bson:"maxVersion,omitempty" json:"maxVersion,omitempty"`
+
+ // ForceCommonNameCheck forces the validation of the hostname against the certificate Common Name.
+ //
+ // Tyk classic API definition: `proxy.transport.ssl_force_common_name_check`
+ ForceCommonNameCheck bool `bson:"forceCommonNameCheck,omitempty" json:"forceCommonNameCheck,omitempty"`
+}
+ TLSTransport contains the configuration for TLS transport settings. This
+ struct allows you to specify a custom proxy and set the minimum TLS versions
+ and any SSL ciphers.
+
+ Example:
+
+ {
+ "proxy_url": "http(s)://proxy.url:1234",
+ "minVersion": "1.0",
+ "maxVersion": "1.0",
+ "ciphers": [
+ "TLS_RSA_WITH_AES_128_GCM_SHA256",
+ "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA"
+ ],
+ "insecureSkipVerify": true,
+ "forceCommonNameCheck": false
+ }
+
+ Tyk classic API definition: `proxy.transport`
+
+func (t *TLSTransport) ExtractTo(api *apidef.APIDefinition)
+ ExtractTo extracts *TLSTransport into *apidef.ServiceDiscoveryConfiguration.
+
+func (t *TLSTransport) Fill(api apidef.APIDefinition)
+ Fill fills *TLSTransport from apidef.ServiceDiscoveryConfiguration.
+
type Test struct {
// ServiceDiscovery contains the configuration related to test Service Discovery.
// Tyk classic API definition: `proxy.service_discovery`
@@ -4284,6 +4353,14 @@
// LoadBalancing contains configuration for load balancing between multiple upstream targets.
LoadBalancing *LoadBalancing `bson:"loadBalancing,omitempty" json:"loadBalancing,omitempty"`
+
+ // TLSTransport contains the configuration for TLS transport settings.
+ // Tyk classic API definition: `proxy.transport`
+ TLSTransport *TLSTransport `bson:"tlsTransport,omitempty" json:"tlsTransport,omitempty"`
+
+ // Proxy contains the configuration for an internal proxy.
+ // Tyk classic API definition: `proxy.proxy_url`
+ Proxy *Proxy `bson:"proxy,omitempty" json:"proxy,omitempty"`
}
Upstream holds configuration for the upstream server to which Tyk should
proxy requests. |
ceeb01e
to
deead0c
Compare
"TLS_CHACHA20_POLY1305_SHA256", | ||
"TLS_FALLBACK_SCSV", | ||
"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305", | ||
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ciphers get added, removed, is there a way to not maintain a definite list which will be bitrot?
E.g. link to an implementation documentation page (crypto tls, other).
case tls.VersionTLS10: | ||
return "1.0" | ||
case tls.VersionTLS11: | ||
return "1.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be in internal/crypto or httputil (whereever more tls code lives, iirc crypto);
Edit: An alternative option is to do func (*TLSTransport) tlsVersion...
and keep it here, also good.
User description
Description
TT-13629
Related Issue
Motivation and Context
How This Has Been Tested
Screenshots (if appropriate)
Types of changes
Checklist
PR Type
Enhancement, Tests, Documentation
Description
Added TLS transport configuration to the upstream settings.
Introduced new
TLSTransport
andProxy
structs with fill and extract methods.Updated schema definitions to include TLS transport and proxy configurations.
Enhanced test coverage for TLS transport and proxy settings.
Changes walkthrough 📝
linter_test.go
Update linter tests for TLS transport settings
apidef/oas/linter_test.go
upstream_test.go
Add tests for TLS transport and proxy settings
apidef/oas/upstream_test.go
TLSTransport
andProxy
configurations.upstream.go
Add TLS transport and proxy configuration logic
apidef/oas/upstream.go
TLSTransport
andProxy
structs for upstream.x-tyk-api-gateway.json
Update schema for TLS transport and proxy
apidef/oas/schema/x-tyk-api-gateway.json
tlsTransport
andproxy
in upstream.