我正在尝试配置在 Unix 上运行的 SSL onn apache Tomcat Java Servlet 应用程序,但尽管进行了多次尝试并试图在网络上找到答案,但还是没有运气。任何人都可以帮忙吗?我做了以下动作:
生成 Java 密钥库和密钥对
/usr/lib/jvm/java-6-sun-1.6.0.26/bin/keytool -genkey -v -keyalg RSA -alias tomcat
-keypass changeit -storepass changeit -keystore /mykeystore/keystore.jks -keysize 2048
生成证书签名请求
/usr/lib/jvm/java-6-sun-1.6.0.26/bin/keytool -certreq -keyalg RSA -alias tomcat -file
/mykeystore/tomcat.csr -storepass changeit -keystore /mykeystore/keystore.jks
导入根证书和中间 CA 证书
vi /mykeystore/root.crt
/usr/lib/jvm/java-6-sun-1.6.0.26/bin/keytool -import -alias root -trustcacerts -file
/mykeystore/root.crt -keystore /mykeystore/keystore.jks
vi /mykeystore/tomcat.crt
/usr/lib/jvm/java-6-sun-1.6.0.26/bin/keytool -import -alias tomcat -file /mykeystore
/tomcat.crt -keystore /mykeystore/keystore.jks
更新 server.xml
<-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
maxThreads="200"
scheme="https" secure="true" SSLEnabled="true"
keystoreFile="/mykeystore/keystore.jks" keystorePass="changeit"
clientAuth="false" sslProtocol="TLS"/>
重启Tomcat
service apache2 restart
我得到错误:
在地址监听传输 dt_socket:8000 24-May-2012 20:54:10 org.apache.catalina.core.AprLifecycleListener init INFO:在 java 上找不到基于 APR 的 Apache Tomcat Native 库,该库允许在生产环境中实现最佳性能.library.path:/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/i386/server:/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib /i386:/usr/lib/jvm/java-6-sun-1.6.0.26/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib 5 月 24 日-2012 20:54:11 org.apache.coyote.http11.Http11Protocol init 信息:在 http-8080 上初始化 Coyote HTTP/1.1 2012 年 5 月 24 日 20:54:12 org.apache.coyote.http11.Http11Protocol init
SEVERE: Error initializing endpoint
java.io.IOException: jsse.invalid_ssl_conf
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.checkConfig(JSSESocketFactory.java:846)
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.init(JSSESocketFactory.java:522)
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.createSocket(JSSESocketFactory.java:156)
at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:538)
at org.apache.coyote.http11.Http11Protocol.init(Http11Protocol.java:176)
at org.apache.catalina.connector.Connector.initialize(Connector.java:1022)
at org.apache.catalina.core.StandardService.initialize(StandardService.java:703)
at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:838)
at org.apache.catalina.startup.Catalina.load(Catalina.java:538)
at org.apache.catalina.startup.Catalina.load(Catalina.java:562)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:261)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: javax.net.ssl.SSLException: No available certificate or key corresponds to the SSL
cipher suites which are enabled.
at com.sun.net.ssl.internal.ssl.SSLServerSocketImpl.checkEnabledSuites(SSLServerSocketImpl.java:310)
at com.sun.net.ssl.internal.ssl.SSLServerSocketImpl.accept(SSLServerSocketImpl.java:255)
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.checkConfig(JSSESocketFactory.java:842)
... 15 more
2012 年 5 月 24 日 20:54:12 org.apache.catalina.core.StandardService 初始化
请帮忙。非常感谢。