The preferred resolution is to upgrade to SCS for VMware Tanzu 3.1.5. This resolves the issue with a code fix.
If you cannot upgrade, you can apply one of the following workarounds. The specific workaround is different for
SCS for VMware Tanzu 3.1.3 and
SCS for VMware Tanzu 3.1.4 - the differences are highlighted.
In the SCS for VMware Tanzu VM:
The script located at
/var/vcap/jobs/truststore-builder/bin/pre-start
adds CAs to the trust store.
If the alias is not unique it will skip it, showing an error like the one below:
Unable to add /C=US/O=Pivotal to truststore - skipping
Therefore each CA needs to have a unique alias.
As soon as you can SSH into the SCS for VMware Tanzu machine on an Apply Changes, go to the
/var/vcap/jobs/truststore-builder/bin/pre-start
script.
Fix for 3.1.3
Insert this into the script between the alias assignment and the keytool to check and make unique:
if [[ $alias == *Pivotal* ]]; then alias+="$(date | md5sum | cut -c1-6)" fi
In total it will look like this:
trust_cert() {
local input_file alias
input_file=$1
alias="$(openssl x509 -in "$input_file" -noout -subject | sed -e 's/subject= //')"
if [[ $alias == *Pivotal* ]]; then
alias+="$(date | md5sum | cut -c1-6)"
fi
keytool \
-importcert \
-alias "$alias" \
-file "$input_file" \
-storepass "$TRUST_STORE_PASSWORD" \
-keystore "$TRUST_STORE_LOCATION" \
-trustcacerts \
-noprompt > /dev/null 2>&1 \
&& echo "Added $alias to truststore" \
|| echo "Unable to add $alias to truststore - skipping"
}
Fix for 3.1.4
This line attempts to generate unique aliases on first assignment:
alias="$(openssl x509 -in "$input_file" -noout -subject | sed -e 's/subject= //')/$(date | md5sum | cut -c1-6)"
The problem is:
date | md5sum | cut -c1-6
If performed rapidly, it yields the same result. Therefore, the result is not unique and skipped, and the deployment fails.
Change to:
alias="$(openssl x509 -in "$input_file" -noout -subject | sed -e 's/subject= //')/$(RANDOM)"
this utilizes linux's
RANDOM env variable to generate a random number and therefore each alias will be unique and deployment is successful.