I have examined the problem and believe that Edge is falling victim to a bug in Java8 related to SNI.
See https://bugs.openjdk.java.net/browse/JDK-8144566
Some background. SNI is Server Name Indication, an extension to TLS that allows a TLS Server to deliver different certs to the client depending on the server host name the client has requested. This allows a single server to handle multiple endpoints, with different certs. This is really important for density - nobody wants to run a separate server for each different hostname that is available via https.
The sites at badssl.com use SNI. The problem is the Java HTTP client library does not properly handle SNI. Apigee Edge relies on Java, and as a result, the cert that Apigee Edge sees in your scenario, is not the cert associated to “expired.badssl.com”, but instead a fallback cert.
The cert for expired.badssl.com is actually expired (it has notAfter=Apr 12 23:59:59 2015 GMT) .
The fallback cert (CN = badssl-fallback-unknown-subdomain-or-no-sni) is not expired.
Therefore you are not seeing a rejection of the cert based on expiry, because in fact the cert Edge receives is not expired.
There is a second issue - and that is related to verification of the CN, or Common-Name. Your SSLInfo does not specify the CommonName element, and as a result, Edge is not verifying the CommonName.
To correct this, in all cases where you want to verify the names of certs, amend your SSLInfo so that it is like so:
<HTTPTargetConnection>
<SSLInfo>
<Enabled>true</Enabled>
<ClientAuthEnabled>false</ClientAuthEnabled>
<CommonName>COMMON-NAME-HERE</CommonName>
<IgnoreValidationErrors>false</IgnoreValidationErrors>
</SSLInfo>
<URL>https://expired.badssl.com</URL>
</HTTPTargetConnection>
In fact if you insert “badssl-fallback-unknown-subdomain-or-no-sni” for the CommonName (do not include the quotes), you will see that the HTTPTargetConnection succeeds. If you insert “expired.badssl.com”, you will see an error: Common-Name mismatch. This, again, is a side effect of the fact that Edge is receiving the fallback cert, not the cert you would expect to see for expired.badssl.com .
OK, so… to sum up.
- Edge is not properly handling targets that rely on SNI. This is due to a Java bug.
- Edge will properly verify the notAfter attribute on certs, and will reject expired certs. You cannot test this using expired.badssl.com , because of item #1.
I believe Apigee can work around the Java bug, but it may be some time before we can engineer a fix and test it, and deliver it. So for now, I would advise you to avoid using SNI in targets. For your reference, the ticket number for this is APIRT-3770.
Oh, and @aagrawal , if you want Apigee Support to track progress on the issue, please open a support ticket with the support desk, and mention that ticket. You may wish to escalate the issue if you are particularly affected. Of course if the problem is only occurring in your tests related to badssl.com, then it may not be appropriate to escalate.