Tomcat SSL
Tomcat支持SSL加密,目前Tomcat v8.5.73以上可以支持到TLS 1.3。加密时首先需要生成密钥库,可使用如下命令:
keytool -genkey -alias tomcat -keyalg rsa -keysize 4096 -dname CN=CA -keystore /home/user/Software/php/tomcat/ssl/server.store
SSL有多种实现方式,考虑到跨平台兼容性,这里使用JDK提供的JSSE(Java Secure Socket Extension),一个实例配置如下:
<Connector port="8080" protocol="org.apache.coyote.http11.Http11Nio2Protocol"
scheme="https"
secure="true"
SSLEnabled="true"
keystoreFile="/home/user/Software/php/tomcat/ssl/server.store"
clientAuth="false"
keystorePass="123456"
sslProtocol="TLS"
connectionTimeout="20000"
sslImplementationName="org.apache.tomcat.util.net.jsse.JSSEImplementation">
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
</Connector>
已将其升级为HTTP/2协议。