Search code examples
sslopensslssl-certificate

Subject Alternative Name not present in certificate


I have generated a CSR that includes the field subject alt names:

openssl req -out mycsr.pem -new -key mykey.pem -days 365

When I inspect this it looks as expected with a new field present:

X509v3 Subject Alternative Name:
    DNS: my.alt.dns

However when I use this to sign a certificate that field is omitted for some reason.

I generate it with the following command:

openssl ca -out mycert.pem -infiles mycsr.pem

Can it be that my CA cert have to include the same Alt name for it to be included?


Solution

  • You can use:

    copy_extensions = copy 
    

    under your CA_default section in your openssl.cnf.

    but only when you're sure that you can trust the extensions in the CSR as pointed out in this thread: http://openssl.6102.n7.nabble.com/subjectAltName-removed-from-CSR-when-signing-td26928.html

    See also: How can I generate a self-signed certificate with SubjectAltName using OpenSSL?