LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-11-2012, 06:24 AM   #1
j.smith1981
Member
 
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161

Rep: Reputation: 1
SSL Name Based Virtual Hosts Apache with SNI enabled not working as expected


I was asking about if it would be possible to use different security certs on 2 different virtual hosts based on their name, they both work on the same IP address 192.168.0.1 for example.

I was told the option named 'SSLStrictSNIVHostCheck' could be set to off to allow for this to work after reading:
I looked at this site:
http://en.wikipedia.org/wiki/Server_Name_Indication

Which explains that my version of apache which is:
Quote:
[me@myserver ~]$ rpm -q httpd
httpd-2.2.15-15.el6.centos.1.x86_64
Which should work right?

This config here is what I have setup for SSL:
Quote:
LoadModule ssl_module modules/mod_ssl.so

Listen 443

SSLPassPhraseDialog builtin

SSLSessionCache shmcb:/var/cache/mod_ssl/scache(512000)
SSLSessionCacheTimeout 300

SSLMutex default


SSLRandomSeed startup file:/dev/urandom 256
SSLRandomSeed connect builtin
#SSLRandomSeed startup file:/dev/random 512
#SSLRandomSeed connect file:/dev/random 512
#SSLRandomSeed connect file:/dev/urandom 512


SSLCryptoDevice builtin
#SSLCryptoDevice ubsec

NameVirtualHost *:443


SSLStrictSNIVHostCheck off

<VirtualHost *:443>

DocumentRoot "/www/myhost1.co.uk/html"
ServerName www.myhost1.co.uk:443



ErrorLog logs/ssl_error_log

TransferLog logs/ssl_access_log

LogLevel warn

SSLEngine on

SSLProtocol all TLSv1 -SSLv2

SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW

SSLCertificateFile /etc/pki/tls/certs/www.myhost1.co.uk.crt

SSLCertificateKeyFile /etc/pki/tls/private/www.myhost1.co.uk.key

<Files ~ "\.(cgi|shtml|phtml|php3?)$">
SSLOptions +StdEnvVars
</Files>


SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0




CustomLog logs/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost>

<VirtualHost *:443>

DocumentRoot "/www/myhost2.co.uk/html"
ServerName www.myhost2.me.uk:443



ErrorLog logs/ssl_error_log

TransferLog logs/ssl_access_log

LogLevel warn

SSLEngine on

SSLProtocol all -SSLv2

SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW

SSLCertificateFile /etc/pki/tls/certs/www.myhost2.me.uk.crt

SSLCertificateKeyFile /etc/pki/tls/private/www.myhost2.me.uk.key

<Files ~ "\.(cgi|shtml|phtml|php3?)$">
SSLOptions +StdEnvVars
</Files>


SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0




CustomLog logs/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost>
I have not changed my original configs which where posted here:
http://www.linuxquestions.org/questi...6/#post4590891 my none ssl based sites.

The problem actually is that when I go to say host www.myhost2.me.uk I get www.myhost1.co.uk's cert.

And I of course get www.myhost1.co.uk's cert when I go to the www.myhost1.co.uk site if that makes any sense?

Have I setup SSL with SNI option correctly?

Any replies are much appreciated as usual!
 
Old 05-11-2012, 07:10 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

Try to use plain:
Code:
ServerName www.myhost1.co.uk
...
ServerName www.myhost2.me.uk
Regards
 
1 members found this post helpful.
Old 05-11-2012, 08:47 AM   #3
j.smith1981
Member
 
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161

Original Poster
Rep: Reputation: 1
Just without the virtualhost tags so omit those you mean?

Thanks for your speedy reply,
Jez
 
Old 05-11-2012, 09:06 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
No, inside each of the 2 <VirtualHost ..> containers leave the ServerName without the trailing ":443"
 
1 members found this post helpful.
Old 05-11-2012, 09:10 AM   #5
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,473

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Depending on what you have in mind you may be better off with a multi-domain certificate for the IP address instead, SNI does rely on the client browser being SNI aware/compatible so you might want to take a look at wikipedia to see if you'll run in to problems with your desired audience.
 
1 members found this post helpful.
Old 05-16-2012, 11:11 AM   #6
j.smith1981
Member
 
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161

Original Poster
Rep: Reputation: 1
Thumbs up

Oh yes of course, I can't imagine right now anyone really using my webmail access which is what I wanted to use it for it's really just for me and my mailadmin being able to add alias users to mailboxes and things like that I use it for but my own personal use.

All the browsers I do use are compatible with this config, but if that should change then I will reassess my needs, thanks for the info though makes perfect sense I will mark this as solved though as it's completed what I wanted to achieve and many thanks for your advice it's much appreciated!

Thanks again,
Jez.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SSL certs and Virtual Hosts on Apache struct Linux - Server 3 01-09-2011 06:03 PM
Multiple SSL Virtual Hosts with Apache/mod_ssl/SNI ddenton Linux - Server 3 12-03-2008 02:20 AM
LXer: SSL-enabled Name-based Apache Virtual Hosts with mod_gnutls LXer Syndicated Linux News 0 08-10-2007 05:46 PM
Apache + Virtual Hosts + SSL = PLEASE HELP neocontrol Linux - Server 5 05-25-2007 09:33 AM
Apache + SSL + Virtual Hosts otisthegbs Linux - Software 3 10-05-2004 07:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration