Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Apr 21, 2011 10:11 am 
Offline
Senior Member

Joined: Mon May 14, 2007 8:20 am
Posts: 81
Hello,

I am running nginx on centos 5 with many virtual hosts.
I need to install a few SSL certificates for various domains and I am a bit confused. Each domain would have its own and distinct certificate.

(1) Can I install several certificates if the domains share the same IP or do I need a new IP for each certificate and domain?

(2) I have a failover system to redirect traffic to another linode. Would the client to buy two certificates?

(3) I understand that there are single-root certificates and wild-card certificates. In my nginx configuration file, I usually have:
listen some_ip:80;
server_name example.com;
server_name www.example.com;
Would I need a single or a wildcard certificate? Is there a way to write the configuration file so that only the single-root certificate is needed?

Thank you in advance for your answers


Top
   
 Post subject:
PostPosted: Thu Apr 21, 2011 11:30 am 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
For your first question, no, it's not possible. The web server doesn't know what domain you want to access until after the encrypted session begins, and the certificate is needed before session begins. So there's no way for the webserver to know what certificate it should use until after its used the certificate; a paradox.

Wildcard certificates are a solution if the different sites are on subdomains of the same domain, you would use a single certificate for multiple domains (foo.domain.com and bar.domain.com would both use a *.domain.com certificate).

For your second question, no, as long as the failover site uses the same domain; certificates are not tied to IPs, but to domains, as far as the client is concerned.


Top
   
 Post subject:
PostPosted: Thu Apr 21, 2011 3:51 pm 
Offline
Senior Member

Joined: Wed May 13, 2009 1:18 am
Posts: 681
Guspaz wrote:
For your first question, no, it's not possible. The web server doesn't know what domain you want to access until after the encrypted session begins, and the certificate is needed before session begins. So there's no way for the webserver to know what certificate it should use until after its used the certificate; a paradox.

Note that technically this isn't an absolute limitation since SNI was introduced (which embeds the server name information within the encrypted session negotiation, so the information is available before the session begins), but I agree in practice at the moment, since unless you know all your clients support it, it may not be a practical solution.

To the OP, you can cover example.com and www.example.com with the "Subject Alternate Names" field in the certificate. For example, the primary CN in the certificate would be for www.example.com (or whichever of the two is your primary use name), but you'd have an alternate name value for example.com (you should also repeat the CN in the SAN field for best compatibility). Making a wildcard certificate (a wildcard value in the CN) would only be needed if you had other hosts/subdomains beneath example.com.

Whether or not your certificate provider lets you create such certificates (or more likely charges more for them) is up to that porvider. Some give them different names like a UC or UCC certificate. Of course, if you're self-signing, do anything you want.

For what it's worth (and only because I just recently had reason to use them, not to try to change to a certificate authority discussion), a free certificate from StartSSL I made recently automatically included the unadorned domain name as an alternate name in the certificate. That is, creating a single host certificate for www.example.com will should include example.com as an alternate name automatically. I've used very few commercial CAs, so maybe that's common behavior, I don't know.

-- David


Top
   
 Post subject:
PostPosted: Fri Apr 22, 2011 7:04 am 
Offline
Junior Member

Joined: Mon Apr 11, 2011 9:49 pm
Posts: 49
I use apache, and it allows me to setup a cert for a specific vhost. Might consider doing that?


Top
   
 Post subject:
PostPosted: Fri Apr 22, 2011 9:42 am 
Offline
Senior Member

Joined: Tue Aug 12, 2008 8:41 am
Posts: 56
superfastcars wrote:
I use apache, and it allows me to setup a cert for a specific vhost. Might consider doing that?

That likely uses Server Name Indication (SNI) which requires client support. Client support is actually pretty pervasive, the biggest "blocker" being Internet Explorer running on Windows XP (IE on Vista or 7 is fine). If supporting IE on XP (over HTTPS) isn't a concern for you then using SNI is the ideal solution.


Top
   
 Post subject:
PostPosted: Tue May 10, 2011 9:26 pm 
Offline
Junior Member

Joined: Mon Apr 11, 2011 9:49 pm
Posts: 49
dbb wrote:
superfastcars wrote:
I use apache, and it allows me to setup a cert for a specific vhost. Might consider doing that?

That likely uses Server Name Indication (SNI) which requires client support. Client support is actually pretty pervasive, the biggest "blocker" being Internet Explorer running on Windows XP (IE on Vista or 7 is fine). If supporting IE on XP (over HTTPS) isn't a concern for you then using SNI is the ideal solution.
Perhaps.. but I'll show you what vhost.conf has in it for that specific cert it needs;
Code:
<VirtualHost mywebsite.com:443>
        ServerAdmin me@mywebsite.com
        ServerName mywebsite.com
        ServerAlias www.mywebsite.com

        DocumentRoot /path/to/public_html/

        SSLEngine on
        SSLProtocol all -SSLv2
        SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
        SSLCertificateFile /path/to/ssl/mywebsite.com.crt
        SSLCertificateKeyFile /path/to/ssl/mywebsite.com.key
        SSLCertificateChainFile /path/to/ssl/mysslcompany.ca
        SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown

        CustomLog /path/to/logs/ssl_request.log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x "%r" %b"
        ErrorLog /path/to/logs/error.log
        CustomLog /path/to/logs/access.log combined
</VirtualHost>


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group