You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Neil Aggarwal <ne...@JAMMConsulting.com> on 2014/08/13 00:01:01 UTC
How to access multiple virtual hosts with a single SSL instance?
Hello:
Up until now, I have always run Apache in front of Tomcat.
I am wondering if I should change to using Tomcat as a standalone server.
My concern is how to use multiple virtual hosts with a single SSL instance
running on the standard https port.
With httpd server, I can access my webapp using the directory name in
the URL. For example, if I have an app called app1, it uses URLs that
look like this:
http://www.app1.com/app1/index.html
https://ssl.example.com/app1/index.html
If I have another app, it would use urls like this:
http://www.app2.com/app2/index.html
https://ssl.example.com/app2/index.html
This is because mod_jk will forward anything with the app name as the
first part of the URL to Tomcat.
>From what I am reading in the documentation, Tomcat uses the hostname
to determine the webapp to use. That won't work since they need to
use the same hostname in ssl mode.
Thanks,
Neil
--
Neil Aggarwal, (972) 834-1565
We lend money to investors to buy or refinance single family rent houses.
No origination fees, quick approval, no credit check.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: How to access multiple virtual hosts with a single SSL instance?
Posted by Neil Aggarwal <ne...@JAMMConsulting.com>.
Hello all:
> How to use multiple virtual hosts with a single SSL instance
> running on the standard https port.
I just came across SNI which allows me to use separate SSL
certificates for each virtual server.
Unfortunately, it looks like Tomcat does not yet support it.
I guess I am sticking to using Apache in front of Tomcat.
Thanks,
Neil
--
Neil Aggarwal, (972) 834-1565
We lend money to investors to buy or refinance single family rent houses.
No origination fees, quick approval, no credit check.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: How to access multiple virtual hosts with a single SSL instance?
Posted by Mark Eggers <it...@yahoo.com.INVALID>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Chris,
On 8/13/2014 5:32 AM, Christopher Schultz wrote:
> Mark,
>
> On 8/13/14, 1:52 AM, Mark Eggers wrote:
>> On 8/12/2014 8:45 PM, Christopher Schultz wrote:
>>> Neil,
>
>>> On 8/12/14, 6:01 PM, Neil Aggarwal wrote:
>>>> Up until now, I have always run Apache in front of Tomcat. I
>>>> am wondering if I should change to using Tomcat as a
>>>> standalone server.
>
>>>> My concern is how to use multiple virtual hosts with a single
>>>> SSL instance running on the standard https port.
>
>>>> With httpd server, I can access my webapp using the directory
>>>> name in the URL. For example, if I have an app called
>>>> app1, it uses URLs that look like this:
>>>> http://www.app1.com/app1/index.html
>>>> https://ssl.example.com/app1/index.html
>
>>>> If I have another app, it would use urls like this:
>>>> http://www.app2.com/app2/index.html
>>>> https://ssl.example.com/app2/index.html
>
>>>> This is because mod_jk will forward anything with the app
>>>> name as the first part of the URL to Tomcat.
>
>>>>> From what I am reading in the documentation, Tomcat uses
>>>>> the hostname
>>>> to determine the webapp to use. That won't work since they
>>>> need to use the same hostname in ssl mode.
>
>>> Tomcat uses both hostname + path to determine where the request
>>> should go: if you have multiple virtual hosts, then /foo
>>> might map to two different virtual hosts depending upon the
>>> Host header (or URL, which generally agree with each other).
>
>>> The only complication TLS adds is that a certificate often only
>>> has one single hostname in it, and the server can only bind to
>>> "all interfaces" on a single port (e.g. 443) a single time.
>>> Thus, administrators often have to pick a certificate that will
>>> work for everyone.
>
>>> As you have mentioned, SNI offers a way around this: the client
>>> can notify the server which host they are attempting to
>>> contact and the server can reply with the preferred certificate
>>> for that host. I don't believe Tomcat has direct support for
>>> SNI, though Java 7+ should be able to handle it if the server
>>> software (Tomcat in this case) is capable. I haven't looked
>>> into how it can be done, but at this point, Tomcat should
>>> probably include this feature, at least for JSSE.
>
>>> There are other ways to get around this, including using
>>> wildcard TLS certificates, binding to different network
>>> interfaces to get s unique interface/port combination for each
>>> certificate, etc.
>
>>> Tomcat /can/ be used, here, but it currently takes some
>>> creativity.
>
>>> -chris
>
>
>> Chris,
>
>> Does Java 7 have server side support for SNI? I had this
>> discussion on the list a while back, and I think we came to the
>> conclusion that SNI was not supported. I'll have to dig through
>> my archives and the public archives to make sure I'm not
>> mistaken.
>
>> Ah no - server side SNI is not available until Java 8. I don't
>> know if Tomcat 8 can take advantage of that or not (haven't
>> looked at the code). However Tomcat 7 plus Java 7 equals no
>> server side SNI.
>
>
> It looks like it's possible to hack it, but it looks like a
> non-trivial effort:
> http://stackoverflow.com/questions/15100386/java-support-for-server-name-indication-sni-in-server-role
>
>
This looks more like a POC than something that would be supportable in
a production environment. The second link indicates as much.
> (See the links in the first answer)
>
>> You're stuck with fronting Tomcat with something like Apache
>> HTTPD and using a SAN cert. This is what we currently do in
>> production. Later versions of Apache HTTPD support SSL named
>> virtual hosts (with a little care).
>
> Yeah, I read the prior correspondence between you and markt and
> saw that was your conclusion. A second problem with Tomcat is the
> lack of support for SNI through tcnative/APR/OpenSSL. At some
> point, maybe I'll try to figure out how to do SNI with OpenSSL and
> do all the plumbing through the Java code.
>
That would be really interesting and useful. It won't solve my
original constraint (browser / OS combinations that don't support
SNI), but it would position me to move to a Tomcat-only stack when
that requirement is relaxed.
> -chris
. . . just my two cents
/mde/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (MingW32)
iQEcBAEBAgAGBQJT64cqAAoJEEFGbsYNeTwt+08IAJC6RbIEwoO7mva3sRap6TVu
swTKNJ/6xb6Uq8dB1hLSnNOhO5fLpcB6BJTl6DTEUhIJzt5rFJDRFFu5GMvutWal
3jo9zDKbaOCXKtuCh46B+K412Z8k55v1Ru7PQT63L7ecjAb/Fh/u0sUDVIqCMHlH
2uexD+AQKqnIZHYuI/IUIH+oMWLE+De2BjHWNW2ZD66rAAAZDsFVsMLoYSTunWkk
QpHFjDSU0L0Q4Bkuuwq3EL3QNEwuwhM/n4ugsTQZDKmvasVKWHSvC09UvjH9YPSl
hhqJuap7id3eIO20GyOGjcPoWx9ansud3pnWQWumzWFTkPXXJSqsdilApYMqgJA=
=svyu
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: How to access multiple virtual hosts with a single SSL instance?
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Mark,
On 8/13/14, 1:52 AM, Mark Eggers wrote:
> On 8/12/2014 8:45 PM, Christopher Schultz wrote:
>> Neil,
>
>> On 8/12/14, 6:01 PM, Neil Aggarwal wrote:
>>> Up until now, I have always run Apache in front of Tomcat. I am
>>> wondering if I should change to using Tomcat as a standalone
>>> server.
>
>>> My concern is how to use multiple virtual hosts with a single
>>> SSL instance running on the standard https port.
>
>>> With httpd server, I can access my webapp using the directory
>>> name in the URL. For example, if I have an app called app1,
>>> it uses URLs that look like this:
>>> http://www.app1.com/app1/index.html
>>> https://ssl.example.com/app1/index.html
>
>>> If I have another app, it would use urls like this:
>>> http://www.app2.com/app2/index.html
>>> https://ssl.example.com/app2/index.html
>
>>> This is because mod_jk will forward anything with the app name
>>> as the first part of the URL to Tomcat.
>
>>>> From what I am reading in the documentation, Tomcat uses the
>>>> hostname
>>> to determine the webapp to use. That won't work since they
>>> need to use the same hostname in ssl mode.
>
>> Tomcat uses both hostname + path to determine where the request
>> should go: if you have multiple virtual hosts, then /foo might
>> map to two different virtual hosts depending upon the Host header
>> (or URL, which generally agree with each other).
>
>> The only complication TLS adds is that a certificate often only
>> has one single hostname in it, and the server can only bind to
>> "all interfaces" on a single port (e.g. 443) a single time. Thus,
>> administrators often have to pick a certificate that will work
>> for everyone.
>
>> As you have mentioned, SNI offers a way around this: the client
>> can notify the server which host they are attempting to contact
>> and the server can reply with the preferred certificate for that
>> host. I don't believe Tomcat has direct support for SNI, though
>> Java 7+ should be able to handle it if the server software
>> (Tomcat in this case) is capable. I haven't looked into how it
>> can be done, but at this point, Tomcat should probably include
>> this feature, at least for JSSE.
>
>> There are other ways to get around this, including using
>> wildcard TLS certificates, binding to different network
>> interfaces to get s unique interface/port combination for each
>> certificate, etc.
>
>> Tomcat /can/ be used, here, but it currently takes some
>> creativity.
>
>> -chris
>
>
> Chris,
>
> Does Java 7 have server side support for SNI? I had this discussion
> on the list a while back, and I think we came to the conclusion
> that SNI was not supported. I'll have to dig through my archives
> and the public archives to make sure I'm not mistaken.
>
> Ah no - server side SNI is not available until Java 8. I don't know
> if Tomcat 8 can take advantage of that or not (haven't looked at
> the code). However Tomcat 7 plus Java 7 equals no server side SNI.
It looks like it's possible to hack it, but it looks like a
non-trivial effort:
http://stackoverflow.com/questions/15100386/java-support-for-server-name-indication-sni-in-server-role
(See the links in the first answer)
> You're stuck with fronting Tomcat with something like Apache HTTPD
> and using a SAN cert. This is what we currently do in production.
> Later versions of Apache HTTPD support SSL named virtual hosts
> (with a little care).
Yeah, I read the prior correspondence between you and markt and saw
that was your conclusion. A second problem with Tomcat is the lack of
support for SNI through tcnative/APR/OpenSSL. At some point, maybe
I'll try to figure out how to do SNI with OpenSSL and do all the
plumbing through the Java code.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBCAAGBQJT61rFAAoJEBzwKT+lPKRYdocQAKIGtrNhd9Zyd/mlhf/vnQ2p
DWhe4qnz0PLK+eVG0uzYkpqmDpYDGSRLho+d/HkdAmYdaQUoD61ht/RnilHQhJIJ
4AaPpxGbX1+/CGUhbrk1gIh4Clm5nnWSiGsYOjBg6ZdhJvt4QFQ4Js/aadq1ThWw
eGIk5dGhL359DNE3pnkeK1CsP2Zl1ExcPaAZ3G4F1og8TpbwD9XsNgdxr8LBpUnk
rhoE3AL9H4QxvPDqS7Y7nkUmvgsbr0npgTyZxGhC/R5ALRILBp5lJf1Z+ycGszNc
qVRzpx3hljoiBrxdkZT12mpA4B+40eIbomxFEQgu4c8Mtj9FE7qzSBWLtkeHP7X9
dvpCrhG9BzUsbvYOlN6ITqELw5P6vzg1N39yFKTCl1qqqhpq+a10jNngrHhoTL6B
vD3u19qR3XuVncl5zEsI6qJt1S7V1IvIXtheJsq1dn8OyX20XG+b/f53hCae0BNm
i1a7ozXbAVC5JLepKDgFIShpHjzcpAEnyyXIjaIYAqJsD9CdvWS7+0Vw4Uucirw1
p+GMvgD8tCJ5+bYTpKo8/viqjRe9WhpRVAzUGFEqfkuvYt5lyJOisbFjmeUxXxZ8
8c1NNaVtZPxav0kG282+wtVaQaaq9VN6vIs2HEatcwwwfWIi2Byf5I5Kuq6ajpcF
HvLtCyXYRjwdW+CGX1YV
=Sn55
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: How to access multiple virtual hosts with a single SSL instance?
Posted by Mark Eggers <it...@yahoo.com.INVALID>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 8/12/2014 8:45 PM, Christopher Schultz wrote:
> Neil,
>
> On 8/12/14, 6:01 PM, Neil Aggarwal wrote:
>> Up until now, I have always run Apache in front of Tomcat. I am
>> wondering if I should change to using Tomcat as a standalone
>> server.
>
>> My concern is how to use multiple virtual hosts with a single
>> SSL instance running on the standard https port.
>
>> With httpd server, I can access my webapp using the directory
>> name in the URL. For example, if I have an app called app1, it
>> uses URLs that look like this:
>> http://www.app1.com/app1/index.html
>> https://ssl.example.com/app1/index.html
>
>> If I have another app, it would use urls like this:
>> http://www.app2.com/app2/index.html
>> https://ssl.example.com/app2/index.html
>
>> This is because mod_jk will forward anything with the app name
>> as the first part of the URL to Tomcat.
>
>>> From what I am reading in the documentation, Tomcat uses the
>>> hostname
>> to determine the webapp to use. That won't work since they need
>> to use the same hostname in ssl mode.
>
> Tomcat uses both hostname + path to determine where the request
> should go: if you have multiple virtual hosts, then /foo might map
> to two different virtual hosts depending upon the Host header (or
> URL, which generally agree with each other).
>
> The only complication TLS adds is that a certificate often only
> has one single hostname in it, and the server can only bind to
> "all interfaces" on a single port (e.g. 443) a single time. Thus,
> administrators often have to pick a certificate that will work for
> everyone.
>
> As you have mentioned, SNI offers a way around this: the client
> can notify the server which host they are attempting to contact and
> the server can reply with the preferred certificate for that host.
> I don't believe Tomcat has direct support for SNI, though Java 7+
> should be able to handle it if the server software (Tomcat in this
> case) is capable. I haven't looked into how it can be done, but at
> this point, Tomcat should probably include this feature, at least
> for JSSE.
>
> There are other ways to get around this, including using wildcard
> TLS certificates, binding to different network interfaces to get s
> unique interface/port combination for each certificate, etc.
>
> Tomcat /can/ be used, here, but it currently takes some
> creativity.
>
> -chris
>
Chris,
Does Java 7 have server side support for SNI? I had this discussion on
the list a while back, and I think we came to the conclusion that SNI
was not supported. I'll have to dig through my archives and the public
archives to make sure I'm not mistaken.
Ah no - server side SNI is not available until Java 8. I don't know if
Tomcat 8 can take advantage of that or not (haven't looked at the
code). However Tomcat 7 plus Java 7 equals no server side SNI.
You're stuck with fronting Tomcat with something like Apache HTTPD and
using a SAN cert. This is what we currently do in production. Later
versions of Apache HTTPD support SSL named virtual hosts (with a
little care).
. . . just my (late night) 2 cents
/mde/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (MingW32)
iQEbBAEBAgAGBQJT6v05AAoJEEFGbsYNeTwtrrIH+OFbR9JGOvdkVQHQH0/Gqiel
OPEk0lQj55FqdBAu68zyP58SeKw0PAI8+C5BX7kLtcFBkgrGGsbuzdIMG4rjNuEY
qrFcilq7wLZrelolIv8zaFnEwmcV/C6uNtbq6wN1hlDW/gaiuuqCd266Dh8ClF0i
iCGydpFlUO/+J8ytKZY+kj5YPNi1S7RqmC0dpT9nYIDbQbK82DYC56FLmg8Tb8AR
TKkJ+ClBLiojHdC9aZaRtZXPPmrOxm9S8pMA9MgNBhQnctv1+TvC0mMsGk3Spy21
clQSckNy+buuRmiJ+VJ1DFlt4Ba1EJgNAbnMe7rivGKq/rg/0rQYbrQvkwb64Q==
=B438
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: How to access multiple virtual hosts with a single SSL instance?
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Neil,
On 8/12/14, 6:01 PM, Neil Aggarwal wrote:
> Up until now, I have always run Apache in front of Tomcat. I am
> wondering if I should change to using Tomcat as a standalone
> server.
>
> My concern is how to use multiple virtual hosts with a single SSL
> instance running on the standard https port.
>
> With httpd server, I can access my webapp using the directory name
> in the URL. For example, if I have an app called app1, it uses
> URLs that look like this: http://www.app1.com/app1/index.html
> https://ssl.example.com/app1/index.html
>
> If I have another app, it would use urls like this:
> http://www.app2.com/app2/index.html
> https://ssl.example.com/app2/index.html
>
> This is because mod_jk will forward anything with the app name as
> the first part of the URL to Tomcat.
>
>> From what I am reading in the documentation, Tomcat uses the
>> hostname
> to determine the webapp to use. That won't work since they need
> to use the same hostname in ssl mode.
Tomcat uses both hostname + path to determine where the request should
go: if you have multiple virtual hosts, then /foo might map to two
different virtual hosts depending upon the Host header (or URL, which
generally agree with each other).
The only complication TLS adds is that a certificate often only has
one single hostname in it, and the server can only bind to "all
interfaces" on a single port (e.g. 443) a single time. Thus,
administrators often have to pick a certificate that will work for
everyone.
As you have mentioned, SNI offers a way around this: the client can
notify the server which host they are attempting to contact and the
server can reply with the preferred certificate for that host. I don't
believe Tomcat has direct support for SNI, though Java 7+ should be
able to handle it if the server software (Tomcat in this case) is
capable. I haven't looked into how it can be done, but at this point,
Tomcat should probably include this feature, at least for JSSE.
There are other ways to get around this, including using wildcard TLS
certificates, binding to different network interfaces to get s unique
interface/port combination for each certificate, etc.
Tomcat /can/ be used, here, but it currently takes some creativity.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBCAAGBQJT6t9WAAoJEBzwKT+lPKRY0sUP/iManPcB08Bzpzcp3jHQQfyd
iwM9V0jGAxrI5DLV30B+vPdNGut+Rcy8mW3CqEqsFMWC8o4LzJdzEfRGBjzjtvIJ
TZxVjQy+Jk/OcyuzAsV92f6U6gVKgcYnyEOkEGFgf/GG06n1RJmmAaG63GZ6qLLv
9OD7eP/wDrpFi1kp+u+RZHez+ZU2XQjsgpH0jOgaMoxqfU0LsxK032chP3vq6aAS
VMh2ncTcSN4N5ibs/vIpLliyEV4bop1P5ZLWhid/smaU0OjlMowsYZ8jb6X90lOs
SsJnC4hKvWTzuyLRNsZ1xf/vU/nScOUQjrQRivpBxgPK0IOSZE7bzu5nc3kYqXTn
xBX/w5Bxb/be2g7hl7jee8Y75flgcfb0tcL6IL50keLV3n95ucqwt3Lb0ZwlCNDT
DWNc5LBufR6rQFTtPG0H6zi/5Siw49ZY9KlIyb1bQGPJ+IiCE2fg+GZ2K84y1Ib/
/kC+GtxpMHABVRC6aPFDFaLuG0NAUwWE437ObpWA2r00uUo0eiZhCAyOZePpl8vJ
zW/R0Va8XDMZauUbSCSQPlV/OX2uPdlIWygzMfCsRrsjJ6A7LLrlMmVh6075rE8D
UQ7oDU7aT/47/DG0yd3OiPYlUx/vq+S5ycYpmstT4s+fPMznO2PHdBDN5GSEkD+6
F945J2LFes2AvdA2m1hE
=9sTp
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org