We have an internal/private PKI that issues certificates so only the employees of the company can access some subdomains (for example admin.example.com).

Here is the script we used to generate the certificates:

names="john maria foo bar"

for name in $names; do
        echo "$name"
        openssl genrsa -aes256 -out $name.key 2048

        # Creating the certificate signing request
        openssl req -new -key $name.key -out $name.csr

        # Signing the certificate
        openssl ca -in $name.csr -out $name.crt

        # Exporting both the key and the certificate in a p12 file
        openssl pkcs12 -export -clcerts -in $name.crt -inkey $name.key -out $name.p12
        # And now a bit of cleaning
        rm $name.csr

The script generates a .key , .crt and .p12 files for each employee, the employee can then add his p12 file to his browser (along with the company's CA Root certificate) to access the subdomain.

But recently, it wasn't working anymore with chrome, apparently there has been an update and we need to have SANs (Subject Alt Names) in the personals certificates used by the employees.

Following FAQ/subjectAltName (SAN), I modified the OpenSSL configuration file:

req_extensions = v3_req

[ v3_req ]

# Extensions to add to a certificate request

basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
subjectAltName = @alt_names

DNS.1 = admin.example.com
DNS.2 = admindashboard.example.com

but the resulting certificate didn't contain the SANs.

I removed the last part of the script which destroyed the .csr file, relaunched the script and tested a csr file with the command

openssl req -text -noout -in john.csr | grep DNS

At this point it seems to work since I got

DNS:admin.example.com, DNS:admindashboard.example.com

as a result.

But when I test the crt file with

openssl x509 -text -noout -in john.crt | grep DNS

I get nothing.

Am I missing something ?

  • 1
    DNS.1 = admin.example.com probably should not be used for a client certificate (it would be needed for a server certificate). I believe you need to use one of the other SAN name types to identify the client, like rfc822Name (email address) or directoryName (LDAP or directory services). Also see page 127 of RFC 5280. The RFC lists the types of names in a SAN. Another post of interest might be How to encode a username in PKIX certificate? on InfoSec.SE.
    – user56041
    Jun 14, 2017 at 13:38
  • Keep in mind browser support for client certificates pretty much sucks. It would not surprise me if it was plain broken in some browsers. Browser support is poor by design. Client certificates raise the bar on the secure channel; and its diametrically opposed to the web/browser security model where interception is a valid use case.
    – user56041
    Jun 14, 2017 at 13:38

1 Answer 1


OpenSSL will only copy the extension from the request to the certificate if it is configured to do so.

The option is called copy_extensions within the [ca] section of your config file.

If it is missing, or set to none then no extensions will be copied from your request to your certificate.

If set to copy it will copy any additional extensions from the request that are not in the certificate.

If set to copyall it will copy all extensions, overwriting any that are in the certificate.

man ca will tell you about it. It also comes with a warning. If you causally sign any request with the openssl ca command, when this option is set; you could end up issuing certificate with extensions such as CA:True. Check your requests first.

  • @garethTheRed Thank you, but it didn't work, I tried setting to copy_extensions to copy then copyall, both worked great as the generated file contains everything I wanted, I added the certificate to my browser, when I load admin.example.com It asks me if I want to use this certificate, when i check the certificate it still contains all I need but when the page is loaded it still says that I am not secure and when I check in the dev options, the certificate used is not the one I selected, it is similar but not the same dates, "issued to" and it doesn't contain the SANs
    – Gatoyu
    May 18, 2017 at 14:09
  • 1
    Can you clarify? Does it show the SAN when you run openssl x509 -noout -text -in john.crt? May 18, 2017 at 16:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .