From 3f60df9071e5d34e1f9b0e22174c535a0c5ca57e Mon Sep 17 00:00:00 2001 From: Lenin Alevski Date: Fri, 19 Nov 2021 16:37:34 -0800 Subject: [PATCH] Validate provided external certificates during tenant creation (#1245) Signed-off-by: Lenin Alevski Co-authored-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com> --- operatorapi/operator_tenants_helper.go | 5 +++++ portal-ui/src/screens/Console/Speedtest/STResults.tsx | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/operatorapi/operator_tenants_helper.go b/operatorapi/operator_tenants_helper.go index 10f238ca4..4c6a75a7d 100644 --- a/operatorapi/operator_tenants_helper.go +++ b/operatorapi/operator_tenants_helper.go @@ -19,6 +19,7 @@ package operatorapi import ( "context" "crypto" + "crypto/tls" "encoding/base64" "encoding/hex" "fmt" @@ -307,6 +308,10 @@ func createOrReplaceExternalCertSecrets(ctx context.Context, clientSet K8sClient if err != nil { return nil, err } + // check if the key pair is valid + if _, err = tls.X509KeyPair(tlsCrt, tlsKey); err != nil { + return nil, err + } externalTLSCertificateSecret := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: keyPairSecretName, diff --git a/portal-ui/src/screens/Console/Speedtest/STResults.tsx b/portal-ui/src/screens/Console/Speedtest/STResults.tsx index 1cc77bf4e..6f29fc9e6 100644 --- a/portal-ui/src/screens/Console/Speedtest/STResults.tsx +++ b/portal-ui/src/screens/Console/Speedtest/STResults.tsx @@ -312,7 +312,8 @@ const STResults = ({ classes, results, start, autotune }: ISTResults) => { {clnMetrics.length <= 1 && ( - Please wait while we get {autotune? "the initial" : "the system"} results... + Please wait while we get {autotune ? "the initial" : "the system"}{" "} + results... )} @@ -391,9 +392,7 @@ const STResults = ({ classes, results, start, autotune }: ISTResults) => { {start ? ( - - Preliminar Results: - + Preliminar Results: ) : ( {jsonView ? "JSON Results:" : "Detailed Results:"}