letsencrypt / certbot incomplete certificate chain error

‹ Overview of Kano OS | Downloading Ansible galaxy roles in parallel ›

Some tutorials on enabling HTTPS in Apache recommend adding this in the <VirtualHost *:443> configuration block:

SSLEngine on
SSLCertificateFile "/etc/letsencrypt/live/wtanaka.com/fullchain.pem"
SSLCertificateKeyFile "/etc/letsencrypt/live/wtanaka.com/privkey.pem"

When this configuration is used with Apache versions prior to 2.4.8, Apache is not able to parse the intermediate CA out of a chain certificate.

This results in the Qualys SSL Labs ssllabs.com tester reporting:

This server's certificate chain is incomplete. Grade capped to B.

and wget reporting an error like:

% wget -O/dev/null https://wtanaka.com/
--2017-02-20 01:15:32-- https://wtanaka.com/
...
ERROR: cannot verify wtanaka.com's certificate, issued by ‘/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3’:
  Unable to locally verify the issuer's authority.
To connect to wtanaka.com insecurely, use `--no-check-certificate'.

and curl reporting an error like:

% curl https://wtanaka.com/
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: http://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

The solution, if you are on an Apache version prior to 2.4.8, is to add an extra configuration line:

  SSLCertificateChainFile "/etc/letsencrypt/live/wtanaka.com/chain.pem"

Subscribe to All Posts - Wesley Tanaka