Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions pkg/operator/controller/ingress/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Copy link
Contributor

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 TLSSecurityProfile is nil.

Copy link
Member Author

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.


// 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, ":")})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If tlsProfileMetrics.Ciphers is empty OR conversion drops everything, strings.Join(ianaNames, ":") becomes "".

Isn't it better to set ROUTER_METRICS_TLS_CIPHERS only when len(ianaNames) > 0

Copy link
Member Author

Choose a reason for hiding this comment

The 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 {
Expand Down