ssl - JBoss 相互证书身份验证在 SSL 握手时失败

标签 ssl jboss certificate mutual-authentication

我遵循了这篇博文中的所有步骤 http://virgo47.wordpress.com/2010/08/23/tomcat-web-application-with-ssl-client-certificates/除了我使用的是 JBoss7.0.2 而不是 6.x 版本。

目的是要求任何客户端提供客户端证书,实现客户端和服务器之间的相互认证。

我已经创建了一个证书颁发机构 (CA) 来签署客户端和服务器证书。

我已将服务器证书导入到 keystore 中,并在 standalone.xml 配置文件中添加了一个 HTTPS 连接器,以在 8443 端口上处理 HTTPS 请求。

我已将 CA 根证书导入到客户端 Firefox 中权限下的证书管理器中。

一切正常,当我请求 https://localhost:8443 时我得到一个带有有效服务器证书的页面。

问题是,当我将客户端证书导入 Firefox 中的证书管理器并设置服务器配置以验证客户端证书(standalone.xml 中的 verify-client="true")时,我收到浏览器错误:

Secure Connection Failed:
An error occurred during a connection to localhost:8443.
SSL peer cannot verify your certificate.
(Error code: ssl_error_bad_cert_alert)

当 jboss 登录服务器状态时:

11:01:31,142 DEBUG [org.apache.tomcat.util.net.JIoEndpoint] (http-localhost-127.0.0.1-8443-1) Handshake failed: java.io.IOException: SSL handshake failed. Ciper suite in SSL Session is SSL_NULL_WITH_NULL_NULL
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.handshake(JSSESocketFactory.java:191) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.tomcat.util.net.JIoEndpoint.setSocketOptions(JIoEndpoint.java:1144) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_30]

你知道如何解决这个问题吗?

我的设置:

本地主机服务器:

sovo@sovo-pc:~$ cat /etc/issue
Ubuntu 10.10

JBoss 7.0.2 Final standalone.xml(相关部分):

<management>
    <security-realms>
        <security-realm name="PropertiesMgmtSecurityRealm">
            <authentication>
                <properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>
            </authentication>
        </security-realm>
    </security-realms>
    <management-interfaces>
        <native-interface interface="management" port="9999"/>
        <http-interface interface="management" port="9990"/>
    </management-interfaces>
</management>
<profile>
    <subsystem xmlns="urn:jboss:domain:security:1.0">
        <security-domains>
            <security-domain name="other" cache-type="default">
                <authentication>
                    <login-module code="Disabled" flag="required"/>
                </authentication>
            </security-domain>
        </security-domains>
    </subsystem>
    <subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host">
        <connector name="https" protocol="HTTP/1.1" socket-binding="https" scheme="https" enable-lookups="false" secure="true">
            <ssl name="ssl" key-alias="sercer" password="changeit" certificate-key-file="/usr/share/jboss7.0.2/standalone/configuration/certificates/keystore.jks" protocol="TLSv1" verify-client="true" ca-certificate-file="/usr/share/jboss7.0.2/standalone/configuration/certificates/cacerts.jks"/>
        </connector>
        <virtual-server name="default-host" enable-welcome-root="true">
            <alias name="localhost"/>
            <alias name="example.com"/>
        </virtual-server>
    </subsystem>
    <subsystem xmlns="urn:jboss:domain:weld:1.0"/>
</profile>
<interfaces>
    <interface name="management">
        <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
    </interface>
    <interface name="public">
        <inet-address value="${jboss.bind.address:127.0.0.1}"/>
        <inet-address value="${jboss.bind.address:localhost}"/>
    </interface>
</interfaces>
<socket-binding-group name="standard-sockets" default-interface="public">
    <socket-binding name="http" port="8080"/>
    <socket-binding name="https" port="8443"/>
    <socket-binding name="jmx-connector-registry" port="1090" interface="management"/>
    <socket-binding name="jmx-connector-server" port="1091" interface="management"/>
    <socket-binding name="jndi" port="1099"/>
    <socket-binding name="osgi-http" port="8090" interface="management"/>
    <socket-binding name="remoting" port="4447"/>
    <socket-binding name="txn-recovery-environment" port="4712"/>
    <socket-binding name="txn-status-manager" port="4713"/>
</socket-binding-group>

Java 版本:

sovo@sovo-pc:~$ java -version
java version "1.6.0_30"
Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) Server VM (build 20.5-b03, mixed mode)
sovo@sovo-pc:~$ javac -version
javac 1.6.0_30

如果需要,我很乐意提供其他相关信息。

最佳答案

您可能想通过将密码套件添加到您的 ssl 连接器来尝试一下:

<ssl name="ssl" key-alias="sercer" password="changeit" certificate-key-file="/usr/share/jboss7.0.2/standalone/configuration/certificates/keystore.jks" protocol="TLSv1" verify-client="true" ca-certificate-file="/usr/share/jboss7.0.2/standalone/configuration/certificates/cacerts.jks" cipher-suite="AES+RSA"/>

关于ssl - JBoss 相互证书身份验证在 SSL 握手时失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9226555/

相关文章:

api - 想知道为什么尝试使用 cURL 将 Letsencrypt .pem 证书上传到 Cloudflare API 会抛出 "Malformed JSON in request body"错误?

java - 使用 JMX 或 JNDI 列出来自 Jboss 的所有部署

docker - 如何在 Docker Remote API 中发送 curl?

android - 我从 HTTPConnection 调用获取证书并保存在信任管理器中,但 webView 需要 SSL 而不是 X509 证书,是否可以转换?

ssl - 从 Web App 调用 Web API 时出现证书问题

rest - 试图获得基本的 Weblogic 服务器身份验证,但我得到这个异常 javax.net.ssl.SSLKeyException : [Security:090542]

使用 Eclipse Paho JavaScript 客户端的 SSL/TLS

rest - 用于测试 rest api 的性能测试工具

java - 在 WildFly 10 中使用自定义 SSLSocketFactory

jakarta-ee - @Asynchronous EJB 线程池配置