Tomcat 8.5.4 SSL 配置麻烦

Tomcat 8.5.4 SSL 配置麻烦

版本详情:

Using CATALINA_BASE:   /apps/TOMCAT/tomcat
Using CATALINA_HOME:   /apps/TOMCAT/tomcat
Using CATALINA_TMPDIR: /apps/TOMCAT/tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /apps/TOMCAT/tomcat/bin/bootstrap.jar:/apps/TOMCAT/tomcat/bin/tomcat-juli.jar
Server version: Apache Tomcat/8.5.4
Server built:   Jul 6 2016 08:43:30 UTC
Server number:  8.5.4.0
OS Name:        SunOS
OS Version:     5.11
Architecture:   sparcv9
JVM Version:    1.8.0_92-b14
JVM Vendor:     Oracle Corporation

密钥工具列表:

keytool -list
Enter keystore password:

Keystore type: JKS
Keystore provider: SUN

Your keystore contains 3 entries

root, Sep 16, 2016, trustedCertEntry,
Certificate fingerprint (SHA1): xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:
intermediate, Sep 16, 2016, trustedCertEntry,
Certificate fingerprint (SHA1): xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:
server, Sep 16, 2016, PrivateKeyEntry,
Certificate fingerprint (SHA1): xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:

server.xml 连接

    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
         This connector uses the NIO implementation with the JSSE engine. When
         using the JSSE engine, the JSSE configuration attributes must be used.
    -->


   <Connector
        port="8443"
        protocol="org.apache.coyote.http11.Http11NioProtocol"
        maxThreads="150"
        SSLEnabled="true"
        keystorePass="XXXXX"
        sslProtocol="TLS"
        clientAuth="false">
        scheme="https"
        keyAlias="server"
        certificateKeystoreFile="/apps/JAVA/tomcat.jks"
<!--        <SSLHostConfig>
            <Certificate certificateKeystoreFile="/apps/JAVA/tomcat.jks"
                         type="RSA" />
        </SSLHostConfig>
-->
    </Connector>

我正在运行 configtest.sh 并得到以下结果:

SEVERE: Failed to initialize end point associated with ProtocolHandler ["https-jsse-nio-8443"]
java.lang.IllegalArgumentException: java.io.IOException: Alias name tomcat does not identify a key entry
.
.
SEVERE: Failed to initialize connector [Connector[HTTP/1.1-8443]]
org.apache.catalina.LifecycleException: Failed to initialize component [Connector[HTTP/1.1-8443]]
.
.
Caused by: org.apache.catalina.LifecycleException: Protocol handler initialization failed
        at org.apache.catalina.connector.Connector.initInternal(Connector.java:1012)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
        ... 12 more
Caused by: java.lang.IllegalArgumentException: java.io.IOException: Alias name tomcat does not identify a key entry
        at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:103)
        at org.apache.tomcat.util.net.AbstractJsseEndpoint.initialiseSsl(AbstractJsseEndpoint.java:81)
        at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:245)
        at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:866)
        at org.apache.tomcat.util.net.AbstractJsseEndpoint.init(AbstractJsseEndpoint.java:213)
        at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:558)
        at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:65)
        at org.apache.catalina.connector.Connector.initInternal(Connector.java:1010)
        ... 13 more
Caused by: java.io.IOException: Alias name tomcat does not identify a key entry
        at org.apache.tomcat.util.net.jsse.JSSEUtil.getKeyManagers(JSSEUtil.java:213)
        at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:101)
        ... 20 more
  1. 我不知道它从哪里获取了别名 tomcat
  2. server.xml 中指定的 keyalias 似乎没有影响
  3. 条目 certificateKeystoreFile="/apps/JAVA/tomcat.jks" 没有影响,我必须创建一个 $USER/.keystore 文件

有人遇到过这个问题吗?我该如何纠正?

欢呼 OSP

答案1

升级到 8.5.5 解决了这个问题。希望这能有所帮助

相关内容