证书/密钥库配置问题 - JBoss AS 7

时间:2012-06-11 19:52:35

标签: jboss keystore keytool truststore

我一直试图让它工作一段时间,而我刚刚结束了。我正在尝试将从安全站点获得的证书添加到本地密钥库和信任库,然后使用JBoss 7.1配置将其获取。我主要试图遵循的文档是:http://docs.oracle.com/javase/1.5.0/docs/tooldocs/solaris/keytool.html

以下是我正在执行的内容:

  
      
  1. keytool -genkey -alias myalias.com -keypass changeit -storepass changeit -keystore keystore.jks

  2.   
  3. keytool -import -trustcacerts -keystore keystore.jks -storepass changeit -noprompt -alias myalias.com -file downloaded-certificate.pem

  4.   
  5. keytool -export -alias myalias.com -file cacerts.cer -keystore keystore.jks

  6.   

这是我的JBoss 7.1 standalone.xml文件的相关部分:

<connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
    <ssl name="ssl" password="changeit" key-alias="myalias.com" certificate-key-file="${JBOSS_HOME}/keystore.jks" protocol="TLSv1" verify-client="true" ca-certificate-file="${JBOSS_HOME}/keystore.jks"/>
</connector>

最后,这是JBoss启动时在日志中编写的堆栈跟踪的顶部:

15:39:35,882 ERROR [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-2) Error initializing endpoint: java.io.IOException: SSL configuration is invalid due to No available certificate or key corresponds to the SSL cipher suites which are enabled.
    at org.apache.tomcat.util.net.jsse.JSSESocketFactory.checkConfig(JSSESocketFactory.java:788) [jbossweb-7.0.13.Final.jar:]
    at org.apache.tomcat.util.net.jsse.JSSESocketFactory.init(JSSESocketFactory.java:493) [jbossweb-7.0.13.Final.jar:]
    at org.apache.tomcat.util.net.jsse.JSSESocketFactory.createSocket(JSSESocketFactory.java:168) [jbossweb-7.0.13.Final.jar:]
    at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:977) [jbossweb-7.0.13.Final.jar:]
    at org.apache.coyote.http11.Http11Protocol.init(Http11Protocol.java:190) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.connector.Connector.init(Connector.java:983) [jbossweb-7.0.13.Final.jar:]
etc...

非常感谢任何帮助!

2 个答案:

答案 0 :(得分:2)

如果您提供密钥库,则需要在ssl部分中指定别名,如下所示

key-alias="myalias.com"

另外,我认为证书文件是ca-certificate-file。

答案 1 :(得分:0)

证书/密钥库配置问题 - JBoss AS 7

步骤1:在standalone.xml文件中添加此行

<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
            <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" redirect-port="8443"/>
            <connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
                <ssl name="foo-ssl" key-alias="foo" password="name" certificate-key-file="../standalone/configuration/test.keystore" protocol="TLSv1" certificate-file="../standalone/configuration/intermediate.cer"/>
            </connector>
            <virtual-server name="default-host" enable-welcome-root="false">
                <alias name="localhost"/>
                <alias name="test.com"/>
            </virtual-server>
        </subsystem>

第2步

在web.xml文件中添加此行

<security-constraint>
         <web-resource-collection>
             <web-resource-name>HTTPs test</web-resource-name>
             <url-pattern>/*</url-pattern>
         </web-resource-collection>
         <user-data-constraint>
             <transport-guarantee>CONFIDENTIAL</transport-guarantee>
         </user-data-constraint>
    </security-constraint>