I used make-dummmy-cert that comes with apache 2.2 and ssl_mod to make a self-signed certificate, I tried www.domain.com domain.com *.domain.com, none of them would work for both www.domain.com and domain.com. The browser would say The certificate is only valid for domain.com( or www.domain.com or *.domain.com respectively) how do I make a self-signed cert that would work for both cases?

link|improve this question

72% accept rate
feedback

1 Answer

*.example.com won't match example.com because the star only matches subdomains of example.com. *.example.com will however match www.example.com and foo.example.com.

What I think you need to do if you really want to match both is to create a certificate with multiple CNs entries in the SubjectAltName, one for example.com and one for *.example.com (or www.example.com, if you don't need to match any other subdomains). This link might help: http://www.openssl.org/docs/apps/x509v3_config.html#Subject_Alternative_Name_

EDIT:

@Bill Weiss is right, I just checked one of the certs I have from GoDaddy and it has both www.example.com and example.com in the SubjectAltName, and both work in the browser. So it sounds like you can get what you need for cheap.

Good luck,

--jed

link|improve this answer
I am going to get a commercial certificate with multiple CNs, any suggestions that are cheap and decent? – user12145 Apr 14 '10 at 21:06
@user12145 Wildcard certificates aren't cheap at all, but the cheapest I've found have been through godaddy.com's certificate service. – Jed Daniels Apr 14 '10 at 21:09
but wildcard certificates won't work for example.com right? I don't need to match subdomains. – user12145 Apr 14 '10 at 21:13
1  
GoDaddy will throw in a SubjectAltName for example.com. At least, that's been my experience. Talk to your CA about it, they'll help you. – Bill Weiss Apr 14 '10 at 21:53
Other providers also add a free SubjectAltName: Comodo, DigiCert, and GlobalSign – Robert Apr 15 '10 at 15:19
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.