I would like to ask how to generate end entity certificate based on my own CA root certificate? I've generated root CA this way:
openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes \
-keyout example.key -out example.crt -subj /CN=MyCompany \
-addext subjectAltName=IP:192.168.100.82
openssl pkcs12 -export -out cert.pfx -inkey example.key -in example.crt
I have imported cer file to Windows Trusted Root Certification Authorities and pfx file into IIS Server Certificates.
It works well with Chrome, IE and Edge, but Firefox reports a problem with my cert: MOZILLA_PKIX_ERROR_CA_CERT_USED_AS_END_ENTITY
I googled it and I learnt that I should have end-entity cert signed by my CA root cert. I was trying to generate end-entity cert with:
openssl genrsa -out server.key 4096
openssl req -new -key server.key -out server.csr -subj /CN=MyCompanyEE -addext subjectAltName=IP:192.168.100.82
openssl x509 -req -in server.csr -CA cert.pem -CAkey example.key -CAcreateserial -out server.crt -days 3650 -sha256
openssl pkcs12 -export -out server.pfx -inkey server.key -in server.crt
OpenSSL response:
Signature ok
subject=CN = MyCompanyEE
Getting CA Private Key
I have imported server.pfx into IIS Server Certificates too, and changed bindings for my web app to use server cert, but now it doesn't work in either Firefox or Chrome.
Firefox says: SSL_ERROR_BAD_CERT_DOMAIN,
Chrome says: NET::ERR_CERT_COMMON_NAME_INVALID.
What I'm doing wrong?
I wasn't able to generate certificate with OpenSSL for local website (available in intranet at 192.168.100.82:997) so - according to @Crypt32 advice - I changed approach and I've used PowerShell. You can find my working solution below:
Use below code for generating selfsigned root authority (MyCompany CA) and server (MyCompany) certificates:
Add root certificate to Trusted Root Certification Authorities in your system by press WIN+R, type: mmc, hit ENTER. In Microsoft Management Console choose
File->Add or Remove Snap-ins
and then, in new window,Certificates -> Add -> OK
. ExpandCertificates->Trusted Root Certification Authorities
. Right click on Certificates catalog placed inside Trusted Root Certification Authorities and chooseAll Tasks->Import...
and selectAuthority.cer
file fromC:\Users\bug_2\Certificates\
. Apply changes and close Microsoft Management Console.You can finds your new certificates (root and server) in IIS without any extra steps. Choose your website in IIS, click
Bindings...->Edit
and select server certificate (MyCompany). Apply changes.My website is available now at
https://192.168.100.82:997
on every web browsers (like Chrome, IE, Edge) except Firefox. For fix that run Firefox, typeabout:config
in address bar and setsecurity.enterprise_roots.enabled
to true. Restart Firefox.Now my localwebsite is available in intranet at https://192.168.100.82:997.