Creating self signed certificate for domain and subdomains - NET::ERR_CERT_COMMON_NAME_INVALID

前端 未结 9 2243
后悔当初
后悔当初 2020-12-04 10:27

I followed this tutorial for creating Signed SSL certificates on Windows for development purposes, and it worked great for one of my domains(I\'m using hosts file to simulat

9条回答
  •  半阙折子戏
    2020-12-04 11:04

    A workaround is to add the domain names you use as "subjectAltName" (X509v3 Subject Alternative Name). This can be done by changing your OpenSSL configuration (/etc/ssl/openssl.cnf on Linux) and modify the v3_req section to look like this:

    [ v3_req ]
    
    # Extensions to add to a certificate request
    
    basicConstraints = CA:FALSE
    keyUsage = nonRepudiation, digitalSignature, keyEncipherment
    subjectAltName = @alt_names
    
    [alt_names]
    DNS.1 = myserver.net
    DNS.2 = sub1.myserver.net
    

    With this in place, not forget to use the -extensions v3_req switch when generating your new certificate. (see also How can I generate a self-signed certificate with SubjectAltName using OpenSSL?)

提交回复
热议问题