SSL/TLS: Certificate chain challenges

Update #1: I've updated the part "Get them into our webserver" by adding a link back to the first SSL/TLS Post where i describe how to correctly create the bundle files!

In my last post i've described what you need to do with the new site and intermediate certificates you got from your issuer in the paragraph "Get the certificate(s) in place".

Sometimes they can make your life harder when the chain is incorrect or you're losing legacy support when you use them. So here is my post about some challenges you may encounter when dealing with certificate chains and how to avoid them.

Different and missing intermediates

Recently i had to update a certificate chain running with GeoTrust TrueBusinessID Organization-validated certificates using 2048bit RSA / SHA-1 signed certificates.

Since SHA-1 signed certificates aren't secure anymore and it's highly advisable to use SHA-2 (SHA-256 or higher) cert's, i've updated the chain to 2048bit RSA / SHA-256 certificates - still GeoTrust TrueBusinessID OV cert's.

The first thing you'll notice is that the signing intermediate - the first intermediate which has issued your site certificate - is a different one. The SHA-1 signed cert had the "GeoTrust SSL CA - G2" whereas the SHA-256 signed was issues by "GeoTrust SSL CA - G3". So far so good.

But here is the first problem. Your apache2 or nginx bundle may only contain this single intermediate (The G3 intermediate) and would pass the Qualys SSL Labs test, since in recent browsers the G3 certificate is in the trusted store*.

But if you test your chain for example with older OpenSSL versions or with the Symantec SSL Toolbox they will tell you that your certificate is valid but the chain is incomplete. The problem is that older software or trusted stores do not contain the newer G3 intermediate.

*trusted store: a collection of root certificates your operating system or browser trusts in the first place so it can validate site certificates with them. On *nix systems they're mostly packed into a single bundle file called ca-certificates.pem.

Okay. But how to deal with it?

This is the tricky part if you've never done this before. We need to go step by step to find out the complete certificate chain back to the first root certificate even older trusted stores know (and trust in turn).

You can check every ssl certificate - site or intermediates - for various parameters like the issuer which we're looking for or other details like the encryption and signing algorithms.

In fact OpenSSL can do this for you with the following easy command:

openssl x509 -text -noout -in <certificate.pem/.crt>

If we try that with our G3 certificate the output is:

    Version: 3 (0x2)
    Serial Number: 146031 (0x23a6f)
Signature Algorithm: sha256WithRSAEncryption
    Issuer: C=US, O=GeoTrust Inc., CN=GeoTrust Global CA
        Not Before: Nov  5 21:36:50 2013 GMT
        Not After : May 20 21:36:50 2022 GMT
    Subject: C=US, O=GeoTrust Inc., CN=GeoTrust SSL CA - G3
    Subject Public Key Info:
        Public Key Algorithm: rsaEncryption
            Public-Key: (2048 bit)
            Exponent: 65537 (0x10001)
    X509v3 extensions:
        X509v3 Authority Key Identifier: 

        X509v3 Subject Key Identifier: 
        X509v3 Basic Constraints: critical
            CA:TRUE, pathlen:0
        X509v3 Key Usage: critical
            Certificate Sign, CRL Sign
        X509v3 CRL Distribution Points: 

            Full Name:

        Authority Information Access: 
            OCSP - URI:

        X509v3 Certificate Policies: 
            Policy: 2.16.840.1.113733.1.7.54

        X509v3 Subject Alternative Name: 
Signature Algorithm: sha256WithRSAEncryption

The interesting part for us is the Issuer field. It reads C=US, O=GeoTrust Inc., CN=GeoTrust Global CA.

Okay. So to complete our apache2/nginx bundle file, we need to find this intermediate and add it accordingly.

The 3-headed hydra

When trying to find an intermediate or root certificate from a certificate issuer, the first step is to go to the issuers website and try to get the certificate from them. They have a web page which lists all of their root and intermediates namely called signing CA's. Some of them are as old as the sun and others are so new that they're still not used for signing.

Anyways. We're looking at GeoTrusts certificates page for a certificate with the CN (Common Name) "GeoTrust Global CA" and indeed we found one.

Great!...... really?

If you add this to your bundle openssl will tell you, that you're using a self-signed certificate, SSL Labs will complain about the attached anchor (the root CA) and Symantec will tell you the same again that your chain is incomplete.

What the f***!?

In fact there exists three GeoTrust Global CA signing CA's. We got one which is also recognized only by newer trusted stores and not yet the path we really want for legacy systems.

If you have a look at the SSL-Tools website you can see all three available certificates. For real legacy support we have to use one that was issued by the very first Root CA - the Equifax Secure Certificate Authority.

When doing so, even systems with a really old trusted store are able to verify the whole certificate chain up to our shiny new SHA-256 certificate because we can validate each certificate up to the ancient Equifax Secure Certificate Authority.

Getting the chain right

Okay. We will use the Global CA certificate with the fingerprint 7359­755c­6df9­a0ab­c306­0bce­3695­64c8­ec45­42a3 and attach it to our bundle.

Now the certificate chain is complete and looks like the following: -> GeoTrust SSL CA - G3 -> GeoTrust Global CA -> Equifax Secure Certificate Authority.

We did it! As a bonus here is how to bundle them for nginx and apache2.

Get them into our webserver

I've explained a lot for this step in the first part of the SSL/TLS series, in "Get the certificate(s) in place", so i'll only post you the parameters and what they contain.


SSLCertificateFile /etc/ssl/certs/example_com_032015.crt
SSLCertificateChainFile /etc/ssl/certs/example_com_032015_bundle.crt
SSLCertificateKeyFile /etc/ssl/private/example_com_032015.key

The SSLCertificateFile only contains our site or leaf certificate The SSLCertificateChainFile contains all other intermediates except the very first root CA Equifax Secure Certificate Authority and the .key file is obvious.


This one is quite easy as you remember that all intermediates and the site certificate are bundled together into a single certificate file

ssl_certificate /etc/ssl/certs/example_com_032015_nginx.crt

What i did not mentioned before is that nginx also can separate the site and intermediate certificates in the ssl_trusted_certificate parameter which works similar to apache2. This is optional now but necessary when using OCSP Stapling or when you want to verify client certificates. OCSP stapling will be covered in a later post. For this parameter you need at least nginx 1.3.7 or higher.


SSL/TLS can be easy but also can be a real brain f*ck if you do it wrong. The worst thing which can happen is that customers complain that they cannot connect to your site or service anymore but you can. Those wrongly configured certiticate chains can be the cause and really hard to find as one in the first place so be careful with that!