Can't create new virtual host - create keystore cert validation error

We just updated/created new certificates, uploaded them in the TLS Keystore and updated the corresponding references (Apigee Edge). Previously running virtual hosts (sub1.domain.com, sub2.domain.com) using existing references are working fine. The updated certificates validate fine with openssl and chrome on the virtual hosts domain . 
The certificate is a wildcard certificate from let's encrypt, we uploaded the fullchain PEM and the private key.
Now we want to create a new virtual host for another subdomain (sub3.domain.com), but we receive the following error:

curl 'https://apigee.com/organizations/<my_org>/environments/test/virtualhosts' \
  -H 'Accept: application/json' \
  --data-raw '{"hostAliases":["sub3.domain.com"],"name":"my_vhost","port":"443","sSLInfo":{"enabled":"true","keyAlias":"domain.com","keyStore":"ref://domain.com","ignoreValidationErrors":false},"useBuiltInFreeTrialCert":false}' \


<< response status code 400
<< response body
{
  "code" : "messaging.config.beans.VirtualHostCACertValidationError",
  "message" : "Virtual host creation/update failed due to keystore cert validation error. Cert is invalid or cannot be trusted by java trust anchors or CAs",
  "contexts" : [ ]
}

 Thanks for any help resolving this issue!

0 3 219
3 REPLIES 3

May be  correct the Certificate Chain in the Keystore referenced in your virtual host configuration & looks like apigee does not have a way to trust your server's certificate because the CA which signed the certificate is not a Trusted CA.

May be follow below document & setup certs  as per below documentation.

 
Also sometimes dealing with virtual host also cause some issues with nginx configs /opt/nginx/conf.d and below document helps troubleshooting(refer first part).

 

Thanks for your reply! Actually we followed the docs to upload the fullchain and the uploaded certificates validate fine when we call an existing proxy endpoint (so CA should be fine I guess). Just in case we want to create a new virtual host with the uploaded certs we're getting this error which is kind of weird. 

We found a workaround, but it is still unclear for me, why it did not work initially.

Our certificate chain file (as obtained from certbot) consists of three certificates in the following order:

The ISRG Root X1 certificate is published in two flavors. Self-signed (by Let’s Encrypt) and cross-signed by DST Root CA X3, see https://letsencrypt.org/certificates/

If we exchange the ISRG Root X1 certificate from the cross-signed (which is used by default) to the self-signed version, the certificate chain is accepted by Apigee.

Why is the cross signed root certificate not accepted? Is that documented somewhere? I guess we are not the only ones using Apigee Edge with Let’sEncrypt certificates.