Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating a CSR for root domain (includes www or not?)

Tags:

ssl

heroku

csr

I am trying to set up SSL for the first time. I purchased my domain and SSL certificate from Gandi.net. Their docs say

subdomain.example.com indicates the subdomain that you want to protect. This is the most important part. If you have a single-address certificate to activate, you should put in the full subdomain (e.g. foo.example.com). The www subdomain is added automatically by the CA, for example, example.com will secure both example.com and www.example.com If you have a wildcard certificate, you should put in a * for the subdomain (e.g. *.example.com). Wildcard certificates also secure the raw domain (with no subdomain). - http://wiki.gandi.net/en/ssl/csr

I am hosting my app on Heroku and their docs say:

The Common Name field must match the secure domain. You cannot purchase a certificate for the root domain, e.g., example.com, and expect to secure www.example.com. The inverse is also true. Additionally, SSL Endpoint only supports one certificate per app. Please keep this in mind for multi-domain applications and specify a Common Domain that matches all required domains. - https://devcenter.heroku.com/articles/ssl-endpoint#acquire-ssl-certificate

These seem to conflict. Please advise!

like image 480
speg Avatar asked Aug 23 '13 12:08

speg


People also ask

Do you need www in SSL cert?

No. If you have a non-www and fully-qualified domain name (FQDN) of the same domain, a single domain (standard) SSL certificate would be enough to cover both. However, if you have multiple subdomains that you need to cover, then you need a wildcard SSL certificate.

Does a wildcard certificate cover www?

A SSL/TLS Wildcard certificate is a single certificate with a wildcard character (*) in the domain name field. This allows the certificate to secure multiple sub domain names (hosts) pertaining to the same base domain. For example, a wildcard certificate for *. (domainname).com, could be used for www.

What is needed to generate a CSR?

When you generate a CSR, most server software asks for the following information: common name (e.g., www.example.com), organization name and location (country, state/province, city/town), key type (typically RSA), and key size (2048-bit minimum).

Does CSR contain domain name?

CSR (Certificate Signing Request) is basically general information sent to the Certificate Authority who will be validating your order and issuing the certificate. It contains reference about your company, its address and, most importantly, the domain name behind your online business.


2 Answers

You'll want to get a certificate from an authority that supports the Subject Alternate Name X.509 extension.

This will let you get a domain with its Common Name set to www.mydomain.com, and an Alternate Name set to mydomain.com(as Lloeki noted, you should provide both names as alternate names).

like image 120
Thomas Orozco Avatar answered Oct 29 '22 15:10

Thomas Orozco


It depends what Certificate Authority(CA) you have been choosen to purchase certificate. Some of them provide alternate domain name including "www" like option some of them no.

As you have written above:

I am hosting my app on Heroku and their docs say:

The Common Name field must match the secure domain. You cannot purchase a certificate for the root domain, e.g., example.com, and expect to secure www.example.com. The inverse is also true. Additionally, SSL Endpoint only supports one certificate per app. Please keep this in mind for multi-domain applications and specify a Common Domain that matches all required domains. - https://devcenter.heroku.com/articles/ssl-endpoint#acquire-ssl-certificate

It is true - because yourdomain.com and wwww.yourdomain.com are considered as different domains (multi-domain) and your certificate has to be trusted to recognize both of them. So before generating CSR string please attentively read requirements for CSR string and features provided by a CA.

like image 2
vitaliy zadorozhnyy Avatar answered Oct 29 '22 15:10

vitaliy zadorozhnyy