Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri Aug 13, 2010 2:15 pm 
Offline
Senior Newbie

Joined: Thu Sep 17, 2009 2:57 pm
Posts: 19
So, I've set up two domains (www.domain.com and ssl.domain.com) and are working fine. I've also set up certs/keys, etc for "ssl.domain.com". However, I want to limit SSL access to the ssl.domain.com only. ie, if someone tries https://www.domain.com I want it to fail.

In the past, I've used htaccess to forward a SSL request to other virtual hosts to the appropriate ssl domain. This required an edit to the htaccess for each virtual host. But, is there a better way?

I basically want to limit SSL request to the ssl.domain.com virtual host, and for SSL requests to other virtual hosts to fail.

Cheers,
Richard


Top
   
 Post subject:
PostPosted: Mon Aug 16, 2010 2:39 am 
Offline
Junior Member

Joined: Mon Nov 21, 2005 4:23 pm
Posts: 46
I'm no expert, but I don't think that what you're attempting is possible due to the way TLS/SSL works.

When you make a TLS request, the server doesn't yet know which domain the client is after, because the request for the domain itself is encrypted. Like I said, I'm no expert, so I'm having a hard time explaining it, but it basically works like this:

User types http://www.domain.com into the address bar of his browser.
Browser finds out what www.domain.com resolves to, let's say it's 1.2.3.4
Browser connects to server at 1.2.3.4, port 80, request contents of www.domain.com
Server responds.

Now, an encrypted connection:

User types https://ssl.domain.com.
Browser finds it's 1.2.3.4.
Browser connects to server at 1.2.3.4, port 443.
Browser requests an encrypted channel with server.
Server responds, all subsequent communication takes place on the encrypted channel.
Browser requests contents of ssl.domain.com.
Server responds.

See, since the encryption starts before the browser asks for a specific domain, the connection cannot be refused, by design.

The only way to achieve what you want, that I know of, is to add another IP and have the server listen to encrypted requests on that IP only.

Hope that makes sense.

edit: I went to WP to see if I could find an article that would explain the problem better, and I found there is a solution to the issue, it's called Server Name Indication, but the page says that it doesn't work with IE in XP, so it's not really that useful at this point.


Top
   
 Post subject:
PostPosted: Mon Aug 16, 2010 4:24 am 
Offline
Senior Newbie

Joined: Thu Sep 17, 2009 2:57 pm
Posts: 19
Hmm...I was suspecting this was the case.

Thanks for your confirmation.


Top
   
 Post subject:
PostPosted: Tue Aug 17, 2010 5:01 pm 
Offline
Senior Member

Joined: Sun Feb 21, 2010 5:12 pm
Posts: 64
Buck a month for another IP address.


Top
   
 Post subject:
PostPosted: Tue Aug 17, 2010 5:48 pm 
Offline
Senior Member

Joined: Wed May 13, 2009 1:18 am
Posts: 681
Note that while you can't stop the SSL connection to your domain from forming at the network layer (e.g., the SSL negotiation itself), I believe you should be able to configure your web server to reject certain virtual hosts if accessed over the SSL connection at a higher layer, no differently than if an invalid virtual host was received over a regular connection.

E.g., just don't define a virtual domain www.domain.com as listening on the SSL socket (and don't have a default domain on that socket either). Or define such a domain, but have it do some action to indicate why things are failing (a dummy page or whatever).

And of course, if your SSL certificate is just for ssl.domain.com, then your client's are likely to get browser warnings anyway when trying to connect at www.domain.com, which may further discourage attempting secure connections to that name.

It's not the same as refusing the network connection entirely, but perhaps just as suitable for your purposes.

-- David


Top
   
 Post subject:
PostPosted: Tue Aug 17, 2010 7:01 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
SSL requests to any other subdomain will fail automatically, i.e. most browsers will display a big scary warning instead of the requested page. If you find that your users regularly ignore such warnings, you can put a few rules in your .htaccess file (or in your webserver configuration) to enforce a specific $HTTP_HOST.


Top
   
 Post subject:
PostPosted: Tue Aug 17, 2010 7:21 pm 
Offline
Senior Member

Joined: Wed May 13, 2009 1:18 am
Posts: 681
Right, but a client warning won't prevent a connection if the client proceeds anyway, which is what I think the OP was looking to do. So yes, you'd want to take explicit configuration steps on the server to refuse unexpected virtual hosts on the SSL port.

-- David


Top
   
 Post subject:
PostPosted: Tue Aug 17, 2010 7:41 pm 
Offline
Senior Member
User avatar

Joined: Tue Nov 24, 2009 1:59 pm
Posts: 362
Until Server Name Indication will become widespread, the SSL certificate is being presented before client asks for a host.
So, while you can have more than one vhost, you can have only one certificate.

In other words, even if you set up server to reject access on the basis of HTTP_HOST, it'll look like

User: https://nossl.example
Browser: WARNING, certificate issued for sslenabled.example, do you want to continue?
User: Yes
Server: <rejects connection now>

Really, for now the rule is "one HTTPS per IP". Except when you have a wildcard cert and use SSL for many sub-domains.


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


Who is online

Users browsing this forum: No registered users and 1 guest


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