Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up httpS for multiple domain

I need to setup https for multiple domians xxxx.com xxxx.net (with single common certificate)

CA where we buying certificate ask to create Certificate Signing Request (CSR), but when I'm generating it with openssl - it asks only for one name

how to make one CSR for multiple domains ?

like image 331
Pydev UA Avatar asked Dec 15 '11 08:12

Pydev UA


1 Answers

Avoid certificates with multiple CNs (as suggested in comments), that's not how the specifications (RFC 2818 and RFC 6125) say it should work and, although it may work in some clients applications, it will usually fail. From RFC 2818:

If a subjectAltName extension of type dNSName is present, that MUST be used as the identity. Otherwise, the (most specific) Common Name field in the Subject field of the certificate MUST be used. Although the use of the Common Name is existing practice, it is deprecated and Certification Authorities are encouraged to use the dNSName instead.

Instead, generate certificates (or CSR) with multiple Subject Alternative Names (SANs).

If you're using OpenSSL, edit your openssl.cnf (or edit a copy) and set these properties, in the relevant sections ([req] and [ v3_req ]):

[req]
req_extensions = v3_req

[v3_req]
subjectAltName=DNS:www.example1.com,DNS:www.example2.com,DNS:www.example3.com

There's also a nice trick to use an environment variable for this (rather in than fixing it in a configuration file) here: http://www.crsr.net/Notes/SSL.html

You may also want to have one of them (any) in the CN.

(You may also be interested in this answer.)

like image 91
Bruno Avatar answered Oct 08 '22 10:10

Bruno