-
Notifications
You must be signed in to change notification settings - Fork 225
OCPBUGS-62238: configure tls profile for router metrics #1378
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ import ( | |
| "github.com/google/go-cmp/cmp/cmpopts" | ||
|
|
||
| operatorv1 "github.com/openshift/api/operator/v1" | ||
| "github.com/openshift/library-go/pkg/crypto" | ||
|
|
||
| "github.com/openshift/cluster-ingress-operator/pkg/manifests" | ||
| "github.com/openshift/cluster-ingress-operator/pkg/operator/controller" | ||
|
|
@@ -983,6 +984,18 @@ func desiredRouterDeployment(ci *operatorv1.IngressController, config *Config, i | |
| } | ||
| env = append(env, corev1.EnvVar{Name: "SSL_MIN_VERSION", Value: minTLSVersion}) | ||
|
|
||
| tlsProfileMetrics := tlsProfileSpecForSecurityProfile(apiConfig.Spec.TLSSecurityProfile) | ||
|
|
||
| // User facing config uses OpenSSL names. Internally we always use IANA ones. | ||
| // OpenSSLToIANACipherSuites() converts and also removes any invalid cipher, otherwise router would crash. | ||
| ianaNames := crypto.OpenSSLToIANACipherSuites(tlsProfileMetrics.Ciphers) | ||
| if len(ianaNames) == 0 { | ||
| log.Info("no valid ciphers found on TLS profile configuration, using Intermediate profile") | ||
| ianaNames = crypto.OpenSSLToIANACipherSuites(configv1.TLSProfiles[configv1.TLSProfileIntermediateType].Ciphers) | ||
| } | ||
| env = append(env, corev1.EnvVar{Name: "ROUTER_METRICS_TLS_CIPHERS", Value: strings.Join(ianaNames, ":")}) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If Isn't it better to set ROUTER_METRICS_TLS_CIPHERS only when len(ianaNames) > 0
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just realized that this is already handled by router: in case envvar is missing or empty, it defaults to the intermediate profile. So assigning empty is fine. Moreover apiserver api already validates if the user input has at least one valid tls1.0-1.2 cipher name, so it ensures that this will never be empty. |
||
| env = append(env, corev1.EnvVar{Name: "ROUTER_METRICS_TLS_MIN_VERSION", Value: string(tlsProfileMetrics.MinTLSVersion)}) | ||
|
|
||
| usingIPv4 := false | ||
| usingIPv6 := false | ||
| for _, clusterNetworkEntry := range networkConfig.Status.ClusterNetwork { | ||
|
|
||
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.
I could be useful to add a small guard/comment or unit test to cover the case when
TLSSecurityProfileis nil.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 is already implemented inside
tlsProfileSpecForSecurityProfile(): in case the profile is nil, it uses the intermediate profile.