I have created a self-signed SSL certificate for the localhost CN. Firefox accepts this certificate after initially complaining about it, as expected. Chrome and IE, however, refuse to accept it, even after adding the certificate to the system certificate store under Trusted Roots. Even though the certificate is listed as correctly installed when I click "View certificate information" in Chrome's HTTPS popup, it still insists the certificate cannot be trusted.
What am I supposed to do to get Chrome to accept the certificate and stop complaining about it?
On the Mac, you can create a certificate that's fully trusted by Chrome and Safari at the system level by doing the following:
The above uses the following scripts, and a supporting file
v3.ext
, to avoid subject alternative name missing errorsIf you want to create a new self signed cert that's fully trusted using your own root authority, you can do it using these scripts.
create_root_cert_and_key.sh
create_certificate_for_domain.sh
v3.ext
One more step - How to make the self signed certs fully trusted in Chrome/Safari
To allow the self signed certificates to be FULLY trusted in Chrome and Safari, you need to import a new certificate authority into your Mac. To do so follow these instructions, or the more detailed instructions on this general process on the mitmproxy website:
and as a bonus, if you need java clients to trust the certificates, you can do so by importing your certs into the java keystore. Note this will remove the cert from the keystore if it already exists, as it needs to to update it in case things change. It of course only does this for the certs being imported.
import_certs_in_current_folder_into_java_keystore.sh
I had success following the answer by kellen with the vital update from Toby J, but had to make this revision:
When creating the self-signed certificate, it was necessary to place the new
subjectAltName
field under thev3_ca
extensions, instead ofv3_req
. I copied/etc/ssl/openssl.conf
to a temporary file and then added a linesubjectAltName = DNS:*.example.com
under[ v3_ca ]
. Then passed that file to the cert creation command, something likeand followed kellen's updated steps.
If you're on a mac and not seeing the export tab or how to get the certificate this worked for me:
Click "Certificate Information"
Now you should see this:
Drag that little certificate icon do your desktop (or anywhere).
Double click the .cer file that was downloaded, this should import it into your keychain and open Keychain Access to your list of certificates.
In some cases, this is enough and you can now refresh the page.
Otherwise:
Now reload the page in question and it should be problem solved! Hope this helps.
Edit from Wolph
To make this a little easier you can use the following script (source):
Save the following script as
whitelist_ssl_certificate.ssh
:Make the script executable (from the shell):
Run the script for the domain you want (simply copy/pasting the full url works):
It didn't work for me when I tried to import the certificate in the browser... In chrome open Developer Tools > Security, and select View certificate. Click the Details tab and export it.
// LINUX
Run this command and if you see the file You've just imported You are good to go!
// Windows
On the left side select Trusted Root Certification Authorities => Personal. Click on actions tab => All actions/import then choose the file You exported before from the browser
Don't forget to restart chrome!!!
GOOD LUCK! ;)
I was experiencing the same issue: I had installed the certificate in to Windows' Trusted Root Authorities store, and Chrome still refused the certificate, with the error
ERR_CERT_COMMON_NAME_INVALID
. Note that when the certificate is not properly installed in the store, the error isERR_CERT_AUTHORITY_INVALID
.As hinted by the name of the error, this comment, and this question, the problem was lying in the declared domain name in the certificate. When prompted for the "Common Name" while generating the certificate, I had to enter the domain name I was using to access the site (
localhost
in my case). I restarted Chrome usingchrome://restart
and it was finally happy with this new certificate.For a test environment
You can use
--ignore-certificate-errors
as a command line parameter when launching chrome (Working on Version 28.0.1500.52 on Ubuntu).This will cause it to ignore the errors and connect without warning. If you already have a version of chrome running, you will need to close this before relaunching from the command line or it will open a new window but ignore the parameters.
I configure Intellij to launch chrome this way when doing debugging, as the test servers never have valid certificates.
I wouldn't recommend normal browsing like this though, as certificate checks are an important security feature, but this may be helpful to some.