Validate provided external certificates during tenant creation (#1245)
Signed-off-by: Lenin Alevski <alevsk.8772@gmail.com> Co-authored-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user