I'm trying to configure a nginx web site so that it uses a self-signed certificate and I'm unable to configure Chrome so that it considers the self-signed certificate valid.
Let me give you more info about what I'm doing. I've started by creating the following cnf file for configuring the self-signed certificate:
[req]
default_bits = 2048
default_md = sha256
distinguished_name = req_distinguished_name
x509_extensions = x509_ext
prompt = no
[req_distinguished_name]
C = PT
ST = MD
L = Funchal
O = luisabreu
CN = Testing certificates
[x509_ext]
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid, issuer
basicConstraints = CA:TRUE
keyUsage = keyEncipherment, dataEncipherment, digitalSignature, nonRepudiation
extendedKeyUsage = serverAuth, clientAuth
subjectAltName = @alt_names
[alt_names]
DNS.1 = localhost
DNS.2 = testing.pt
IP.1 = 10.50.150.130
Since I'd like my certificate to be considered a CA root so that it could be imported to Chrome, I've set it on the basicConstraints field.
The certificate keys are generated by running the following command (assuming that the configuration file is called certificate.cnf):
openssl req -config certificate.cnf -new -x509 -sha256 -newkey rsa:2048 -nodes -keyout ssl.key -out ssl.crt -days 10500
Then, I copy the CA to the /usr/local/share/ca-certificates folder and run the update-ca-certificates command:
sudo cp ssl.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates
After updating the machine's CA store, I copy the public and private keys to the /etc/ssl/certs/ and /etc/ssl/private/ folder:
sudo cp ssl.crt /etc/ssl/certs/
sudo cp ssl.key /etc/ssl/private/
Then I've updated the default.conf file of the nginx so that it uses these files:
server {
listen 80;
listen 443 ssl;
server_name localhost;
ssl_certificate /etc/ssl/certs/ssl.crt;
ssl_certificate_key /etc/ssl/private/ssl.key;
And I've reloaded the config by running the following:
sudo nginx -s reload
Then, I've went into the chrome certificate store (chrome://settings/certificates) and I've imported the ssl.crt file. It does get imported without errors, but it does not show any info on the "This certificate has been verified for the following usages:"
Unfortunately, it seems like I'm still missing something because Chrome still complains about the certificate:
Can anyone help? Did I miss anything on the conf file used for generating the certificate? Do I need to generate a separate CA for signing the site's certificate? I've tried using the certificate on a windows machine and it worked (putting in on the Personal and Trusted CA fodlers of the Local machine's certificate store...)
Thanks.

