Remediating a wrong VCF Services runtime platform or VCFA ingress certificate.
search cancel

Remediating a wrong VCF Services runtime platform or VCFA ingress certificate.

book

Article ID: 439651

calendar_today

Updated On:

Products

VCF Automation VMware vSphere ESXi

Issue/Introduction

This KB article details the procedure for using a script to remediate an incorrect platform ingress certificate

Environment

VCF Automation 9.1.x
VCF Automation 9.0.x
VCF services runtime

Cause

This issue typically occurs when an invalid or incorrect certificate is applied. Common reasons include:

1. Incorrect Hostname or Subject Alternative Name (SAN)
2. Expired certificate
3. Self-signed or untrusted certificate

Resolution

This KB should be used when the VMSP platform ingress is serving an incorrect certificate, which can manifest as:

  1. External integrations failing to connect to the VMSP platform with TLS/certificate trust errors (e.g., "SSL certificate problem: unable to get local issuer certificate" or "PKIX path building failed").
  2. Browser certificate warnings when accessing the platform FQDN -- the certificate is issued by an unexpected CA or doesn't match the expected domain.
  3. openssl s_client -connect <platform-fqdn>:443 returns a certificate that doesn't match what was originally configured (wrong CN/SAN, wrong issuer, or self-signed when a CA-signed cert was expected).

This document is intended to remediate the following cases:

  • Wrong hostname/SAN
  • Expired certificate
  • Self-signed/untrusted

Please run the attach cert-remediation.sh to renew the certificate.

1. Take a ssh to the VCFA node. 

2. Copy the attached script into /tmp folder. 

3. Change the permission of the file. 

   chmod +x cert-remediation.sh

4. Run the below command to execute the script:

   ./cert-remediation.sh

 

***  INFO SHA1 and MD5 sum of the cert-remediation.sh

Algorithm       Hash                                                                                      Path                                                                                                                                          
---------           ----                                                                                          ----                                                                                                                                          
MD5              B0BFE0B9226F6896CD3BBB5D19B9FACB                        cert-remediation.sh   

SHA1            9ECB8EBF699C6E7960D58F67E142299899B2C8AA         cert-remediation.sh    

Additional Information

Prerequisites

  • bash, curl, jq, openssl on the machine that runs the script.
  • Network access to the platform FQDN (HTTPS, port 443) and the VCFA FQDN for the final check.
  • The platform admin password (the default user is [email protected]).
  • kubectl with access to the prelude namespace on the VMSP cluster. This is optional but recommended for vcfa. Without it, the script prints the resync command for you to run later.
  • Three PEM files (see Preparing the certificate files).

Preparing the certificate files

OptionFileContents
--cert-fileFull chainYour server certificate first, then the intermediate(s), optionally the root.
--key-filePrivate keyThe key you generated with the CSR. Must be unencrypted.
--ca-fileRoot CAThe root CA certificate only (subject equals issuer).

Your CA may send these as separate files. Build the chain yourself if needed:

cat your_domain.crt intermediate.crt > fullchain.pem

All files must be PEM (text with -----BEGIN ...----- lines). Convert .pfx, .p7b or .der files first.

Check the files before you run the script

# certificate and key match (the two hashes must be identical; RSA keys)
openssl x509 -noout -modulus -in fullchain.pem | openssl sha1
openssl rsa  -noout -modulus -in key.pem       | openssl sha1

# certificate covers your FQDN, and its expiry
openssl x509 -noout -subject -ext subjectAltName -enddate -in fullchain.pem

# chain validates against the root
openssl verify -CAfile ca.pem fullchain.pem

The VCFA certificate should cover both <vcfa-fqdn> and *.<vcfa-fqdn>, because VCFA routes serve both hostnames.

Which file is the root?

for f in *.pem; do
  echo "== $f ($(grep -c 'BEGIN CERTIFICATE' $f) certs)"
  openssl x509 -in $f -noout -subject -issuer
done

The root is the certificate whose subject= and issuer= are identical. The chain file has your FQDN in the subject of its first certificate.

Usage

./cert-remediation-vcfa.sh --platform-fqdn <fqdn> --ingress-type <type> \
    --cert-file <path> --key-file <path> --ca-file <path> \
    --password <password> [options]

Required options

OptionDescription
--platform-fqdnPlatform FQDN. The script signs in and calls the API here.
--cert-fileFull chain PEM.
--key-filePrivate key PEM.
--ca-fileRoot CA PEM.
--passwordPassword for the API user.

Optional options

OptionDefaultDescription
--ingress-typeplatformplatform, fleet, instance or vcfa.
--vcfa-fqdn--platform-fqdnVCFA FQDN, used for the final certificate check.
--username[email protected]API user.
--namespacepreludeNamespace holding the ingress-vcfa-tls* secrets (vcfa only).
--skip-resyncoffvcfa only: don't force the Kyverno resync.
--component-iddiscoveredSkips component discovery.
--timeout600Seconds to wait for the apply task.
--no-waitoffDon't wait for the task.
--dry-runoffPrint the payload and component ID, make no changes.

Replacing the VCFA FQDN certificate

  1. Dry run first. This checks sign-in, finds the vcfa component and prints the payload (it contains the private key, so don't share the output):
    ./cert-remediation-vcfa.sh --platform-fqdn <platform-fqdn> --ingress-type vcfa \
      --vcfa-fqdn <vcfa-fqdn> \
      --cert-file fullchain.pem --key-file key.pem --ca-file ca.pem \
      --password '<password>' --dry-run
  2. Run it for real (same command without --dry-run). The apply task takes about 5 minutes.
  3. The script then:
    • waits for the task to finish,
    • annotates ingress-vcfa-tls-external to force the sync and waits for ingress-vcfa-tls to show the new serial,
    • reads the certificate the VCFA FQDN now serves.

To replace the other certificates, use --ingress-type platform, fleet or instance (no --vcfa-fqdn needed).

Attachments

cert-remediation.sh get_app