15

You can make an SSL certificate by using *.domain.com as the name.

But unfortunately, this doesn't cover https://domain.com

Is there any fix for this?

Dave Cheney
  • 18,307
  • 7
  • 48
  • 56
Unknown
  • 1,675
  • 6
  • 20
  • 27

5 Answers5

13

I seem to recall that *.domain.com actually violates RFC anyways (I think only lynx complains though :)

Create a certificate with domain.com as the CN and *.domain.com in the subjectAltName:dNSName names field - that works.

For openssl, add this to the extensions:

subjectAltName          = DNS:*.domain.com
MikeyB
  • 38,725
  • 10
  • 102
  • 186
6

Unfortunately you cannot do this. The rules for handling wildcards on subdomains are similar to the rules about cookies for subdomains.

www.domain.com       matches    *.domain.com
secure.domain.com    matches    *.domain.com
domain.com      does not match  *.domain.com
www.domain.com  does not match  domain.com

To handle this you will have to obtain two certificates, one for *.domain.com and the other for domain.com. You will need to use two separate IP address and vhosts two handle these domains separately.

Dave Cheney
  • 18,307
  • 7
  • 48
  • 56
  • 4
    You can absolutely do this - its done all the time - see above answer. This is accomplished using the CN and the subject alternate name extension. http://techbrahmana.blogspot.com/2013/10/creating-wildcard-self-signed.html – John Kloian Aug 03 '15 at 22:08
4

Wildcards these days will have *.domain.com and domain.com in the subject alternative name field (SAN). For instance take a look at quora.com's wildcard SSL cert

You will see

Subject Alternative Names: *.quora.com, quora.com

Yogi
  • 171
  • 4
2

Probably not the answer you're looking for, but I'm 99% sure there isn't a way. Redirect http://domain.com/ to https://www.domain.com/ and just use the *.domain.com as the SSL cert. It's far from perfect, but should hopefully cover most of the cases you are interested in. The only other alternative is to use different IP addresses for domain.com and www.domain.com. Then you can use different certificates for each IP.

Mark
  • 2,846
  • 19
  • 13
  • You are correct. "domain.com" is a subdomian of ".com", so the wildcard that would work for it would be "*.com". This is why a cert for *.domain.com works for "www.domain.com" but not, "www.acct.domain.com". – sysadmin1138 Jun 03 '09 at 03:00
1

No because they are completely different name space. redirecting the tld is not an option either because SSL is a transport encryption it has to decode the ssl before apache for example can even see the request host to redirect it.

Also as a side note: foo.bar.domain.com is also not valid for a wildcard cert (firefox from memory is the only one that will allow that.

Brendan
  • 914
  • 6
  • 5