Google Chrome 58 making NET::ERR_CERT_COMMON_NAME_INVALID all over the place

We use self signed certificates at LeadSift for our dev and qa servers behind the firewall and have our team just import the certificate into their computers. Recently after months of it working just fine, I got an error on Google Chrome which looked like this.

Attackers might be trying to steal your information from site.dev.leadsift.com (for example, passwords, messages, or credit cards). NET::ERR_CERT_COMMON_NAME_INVALID

This server could not prove that it is site.dev.leadsift.com; its security certificate is from [missing_subjectAltName]. This may be caused by a misconfiguration or an attacker intercepting your connection. Learn more.

After a bit of googling, turns out that in Chrome 58 (released April 19 2017) introduced some changes that breaks certificates that do not have use Subject Alternative Names. The common name field is (used to be) the common way to identify your website in SSL certs. New to me, but turns out to be relatively old, the common name field has been phased out in 1999 to be replaced with the x509 Subject Alternative Names (SAN) extension field. Support for this field has only started gaining adoption in 2007. What changed recently is google decided to go ahead and remove the 20 year old deprecated (meaning slated for remove) common name fields (how could they right 😛 ).

Since most tutorial and articles on how to use openssl do not even mention SAN. Moreover, adding SAN to your openssl commands is really clunky and most current tutorials ask the user to edit global config files to add SAN to the certs, very few people have added SAN to their self signed certificates. The good news is all (guessing here, its at the very least a “most“) SSL certificates issued by a CA already have SAN added to them. Hence, the internet didn’t break two weeks ago 🙂 when google pushed this update.

tlDr; Well then, how do you solve this?! … ok 🙂

Solution #1 – #HACK – get chrome to accept the old cert

Tell everyone who needs to access your site to change their chrome settings to revert back to the Common Name field rather than the SAN field. More info on that can be found in the Chromium documentation https://www.chromium.org/administrators/policy-list-3#EnableCommonNameFallbackForLocalAnchors

I do not like this solution so won’t divulge further into how to do it here. the link above should be sufficient.

Solution #2 –  Re-generate your certificate

I spent sometime getting my certs to generate with SAN in a nice way, without having to hack the global openssl conf file. What I did instead is create a local conf file that you can pass into the openssl commands.

Here is this allusive conf file, an added benefit of this conf is that you no longer need to manually type out the answers to those openssl questions. The following config will result in a wildcard cert with SAN. Change the values as necessary to your setup.

Here are the commands that use this conf file to generate a CSR and then a x509 certificate from the CSR that includes the proper info.

This cert works fine with Chrome 58 and should be fine for the foreseeable future (or until sha256 is also cracked 🙂 ).