You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Richard Huntrods <hu...@athabascau.ca> on 2019/06/22 21:19:33 UTC
Connector difference explanation request - two ways of getting SSL in
server.xml
Apologies if this is really basic, but I've seen two ways of handling
https (SSL) for tomcat and don't understand the differences.
The first example uses letsencrypt cert files 'in situ' (i.e. where they
have been created). The second example uses the same files, but
converted by a manual shell script into a single .keystore file, stored
in ./tomcat/keys
The thing I really don't understand is the different protocols used.
Fair warning: the second example is something I've been using for a
while, so it may be out of fashion even though it works. The first
example is "brand new" that I got online and want to use mainly because
it removes the manual conversion step from cert to .keystore.
<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true">
<SSLHostConfig>
<Certificate
certificateFile="/etc/letsencrypt/live/mydomain.com/cert.pem"
certificateKeyFile="/etc/letsencrypt/live/mydomain.com/privkey.pem"
certificateChainFile="/etc/letsencrypt/live/mydomain.com/chain.pem" />
</SSLHostConfig>
</Connector>
vs.
<Connector port="443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" enableLookups="false" scheme="https" secure="true"
keystoreFile="./keys/.keystore" keystorePass="mypass"
clientAuth="false" sslProtocol="TLS" />
My system:
OS: Ubuntu 18.04.2 LTS (server)
Tomcat: 8.5.41 (installed from tomcat distribution, not via apt get)
Java: OpenJDK "11.0.3" 2019-04-16
Everything works fine. I'm mostly just curious about the other
differences between the two connectors.
Thanks in advance.
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
--
This communication is intended for the use of the recipient to whom it is addressed, and may contain confidential, personal, and or privileged information. Please contact us immediately if you are not the intended recipient of this communication, and do not copy, distribute, or take action relying on it. Any communications received in error, or subsequent reply, should be deleted or destroyed.
---
Re: Connector difference explanation request - two ways of getting
SSL in server.xml
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Richard,
On 6/22/19 17:19, Richard Huntrods wrote:
> Apologies if this is really basic, but I've seen two ways of
> handling https (SSL) for tomcat and don't understand the
> differences.
>
> The first example uses letsencrypt cert files 'in situ' (i.e. where
> they have been created). The second example uses the same files,
> but converted by a manual shell script into a single .keystore
> file, stored in ./tomcat/keys
>
> The thing I really don't understand is the different protocols
> used.
>
> Fair warning: the second example is something I've been using for
> a while, so it may be out of fashion even though it works. The
> first example is "brand new" that I got online and want to use
> mainly because it removes the manual conversion step from cert to
> .keystore.
>
> <Connector port="443"
> protocol="org.apache.coyote.http11.Http11NioProtocol"
> maxThreads="150" SSLEnabled="true"> <SSLHostConfig> <Certificate
> certificateFile="/etc/letsencrypt/live/mydomain.com/cert.pem"
> certificateKeyFile="/etc/letsencrypt/live/mydomain.com/privkey.pem"
>
>
certificateChainFile="/etc/letsencrypt/live/mydomain.com/chain.pem" />
> </SSLHostConfig>> </Connector>
The above style of configuration is preferred in Tomcat 8.5 and later.
for the reasons Giuseppe wrote in his post.
WARNING: you are referencing the files created by tools like certbot.
certbot places those files into a series of directories only
accessible by root. You are either making them available to a wider
audience (in which case you should just think whether that is a good
idea, or if your setup will be broken if/when certbot runs again and
"repairs" its directories) or you are running Tomcat as root. Both of
these are probably not a good idea.
Definitely don't run as root.
I might consider having your certbot wrapper copy the specific files
you need somewhere Tomcat can read them after they are re-generated by
certbot. That way, Tomcat can only access the files it actually needs
instead of having access to the whole LE directory.
- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl0QbnEACgkQHPApP6U8
pFjlgA//ZDacvsKWgnMhbxgqxX4uM4Kxao+6rGkS7V7zNrL060GdbicyA8Fpt2Cg
LxOyGprMLuWQ3RFoPVGrRefzpV9G6wzBadbQGWB/66o+bo6+/FgcLlNcRKwRohNa
RDwyrw4NlkWPzeJli4BeZhsfxIkq0HI4jl7JIRYJxoyESE/Hi5UqPMkDxkIDitWZ
rWvqwJjALcNzcFRJ09ptTJAL9x06x+kosO1ioFzPOgagvFyZ9wRiZ0RkdK0hBExC
MIG3jBAt6a5xEH3WeGUqE3cbiAbP+U3Mn9iSXl23JyjVPXWlySXULj8TM7YZvNb8
4mCQAEhLZHMKc611upuQiIvlAk2tfv7P0FvGgOvgZILiWKAanr5aYDWIBva5jfek
/wfMLOJvdDgNrC87ltKlXsIfpgzT6LKdMrEQOOaE/x/E7IIJJgtOxC/qaWt++LWY
sYsgYsmlqlndLeMqpht+aexmImUP2GQoZJMmj+NSoCZg6I+II3Hi1b5nnQfRQu+e
sxXT0DMRcWxpEhOGRq8qxA5RcmGkgM6FcXKCkkQn3yLFxDdMC+hDycFTVxZSYolL
/jSJvZkvw5ohUfvqRAElcPaS26yMSYTiRiqjq0tY6Oq+SwP47SPtgzYZYMC1FJul
LlI1ivhWiSkkrEQQTUeUX0r7soop99tDy9moQV/T90aupCPDOpU=
=ES8m
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Connector difference explanation request - two ways of getting
SSL in server.xml
Posted by Mark Thomas <ma...@apache.org>.
On 22/06/2019 22:56, Giuseppe Sacco wrote:
> Hello Richard,
>
> Il giorno sab, 22/06/2019 alle 21.19 +0000, Richard Huntrods ha
> scritto:
>> Apologies if this is really basic, but I've seen two ways of handling
>> https (SSL) for tomcat and don't understand the differences.
> [...]
>> <Connector port="443"
>> protocol="org.apache.coyote.http11.Http11NioProtocol"
>> maxThreads="150" SSLEnabled="true">
>> <SSLHostConfig>
>> <Certificate
>> certificateFile="/etc/letsencrypt/live/mydomain.com/cert.pem"
>> certificateKeyFile="/etc/letsencrypt/live/mydomain.com/privkey.pem"
>> certificateChainFile="/etc/letsencrypt/live/mydomain.com/chain.pem"
>> />
>> </SSLHostConfig>
>> </Connector>
>>
>> vs.
>>
>> <Connector port="443" protocol="HTTP/1.1" SSLEnabled="true"
>> maxThreads="150" enableLookups="false" scheme="https"
>> secure="true"
>> keystoreFile="./keys/.keystore" keystorePass="mypass"
>> clientAuth="false" sslProtocol="TLS" />
>
> If I understand correctly, prior to 8.5, there were two different
> syntaxes: one for SSL implemented by JSSE and one for openssl. The new
> syntax allow to specify all parameters in one way that both
> implementations recognize.
Correct.
> Moreover, you may have configurations previously not possibile, i.e.,
> you may now have many certificates (one RSA, one EC, one DSS) on the
> same connector: the right certificate will be picked up dynamically
> based on the SSL cipher used.
Also correct.
To expand on that a little.
8.0.x support the following options for TLS connectors
BIO with JSSE
NIO with JSSE
NI2 with JSSE
APR/native with OpenSSL
Each connector was limited to a single certificate. SNI was not supported.
Using a JSSE based connector required you to use a Java keystore to hold
the keys and certs.
Use an OpenSSL based connector required you to use PEM files to hold the
keys and certs.
OpenSSL and JSSE based connectors had different configuration attributes.
In 8.0.x you have to use the second of the two configuration formats
(the one without the nested elements).
There was a significant refactoring of TLS support for 8.5.x and further
improvements have been added over time.
In 8.5.x onwards the Connector options are:
NIO with JSSE or OpenSSL
NIO2 with JSSE or OpenSSL
APR/Native with OpenSSL
Each connector can be configured with 1 or most Hosts (i.e. SNI support).
Each host can be configured with multiple certificates. (In theory RSA,
DSA or ECC. In practice RSA or ECC.) Multiple cert may increase the
range of ciphers available (depends on client capabilities).
You can use PEM files or Java keystores with any connector (i.e. they
are interchangeable).
The configuration attributes for JSSE and OpenSSL have been aligned
where possible.
The aim is that you should be able to switch between JSSE and OpenSSL by
only changing the attribute that controls the TLS implementation.
The addition of multiple hosts and certs meant a new configuration style
(the one with nested elements) was required. You can use the old style
and Tomcat will translate it under the covers to a single connector,
with a single host with a single certificate.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Connector difference explanation request - two ways of getting
SSL in server.xml
Posted by Giuseppe Sacco <gi...@eppesuigoccas.homedns.org>.
Hello Richard,
Il giorno sab, 22/06/2019 alle 21.19 +0000, Richard Huntrods ha
scritto:
> Apologies if this is really basic, but I've seen two ways of handling
> https (SSL) for tomcat and don't understand the differences.
[...]
> <Connector port="443"
> protocol="org.apache.coyote.http11.Http11NioProtocol"
> maxThreads="150" SSLEnabled="true">
> <SSLHostConfig>
> <Certificate
> certificateFile="/etc/letsencrypt/live/mydomain.com/cert.pem"
> certificateKeyFile="/etc/letsencrypt/live/mydomain.com/privkey.pem"
> certificateChainFile="/etc/letsencrypt/live/mydomain.com/chain.pem"
> />
> </SSLHostConfig>
> </Connector>
>
> vs.
>
> <Connector port="443" protocol="HTTP/1.1" SSLEnabled="true"
> maxThreads="150" enableLookups="false" scheme="https"
> secure="true"
> keystoreFile="./keys/.keystore" keystorePass="mypass"
> clientAuth="false" sslProtocol="TLS" />
If I understand correctly, prior to 8.5, there were two different
syntaxes: one for SSL implemented by JSSE and one for openssl. The new
syntax allow to specify all parameters in one way that both
implementations recognize.
Moreover, you may have configurations previously not possibile, i.e.,
you may now have many certificates (one RSA, one EC, one DSS) on the
same connector: the right certificate will be picked up dynamically
based on the SSL cipher used.
Bye,
Giuseppe
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org