我已经设置了一个EJB客户端,该客户端可以在没有SSL / TLS的情况下成功连接到remote+http://localhost:8080
。
现在,我创建了一个信任库和密钥库,并按照Wildfly文档here中的说明设置SSL / TLS。
我的wildfly-config.xml
包含以下内容:
<authentication-client xmlns="urn:elytron:1.0">
<authentication-rules>
<rule use-configuration="default-config"/>
</authentication-rules>
<authentication-configurations>
<configuration name="default-config">
<set-user-name name="${user}"/>
<credentials>
<clear-password password="${password}"/>
</credentials>
<sasl-mechanism-selector selector="#ALL" />
<providers>
<use-service-loader />
</providers>
</configuration>
</authentication-configurations>
<key-stores>
<key-store name="im-keystore" type="JKS">
<file name="client.truststore"/>
<key-store-clear-password password="xxx"/>
</key-store>
</key-stores>
<ssl-contexts>
<ssl-context name="im-ssl-context">
<trust-store key-store-name="im-keystore"/>
<protocol names="TLSv1.2"/>
</ssl-context>
</ssl-contexts>
<ssl-context-rules>
<rule use-ssl-context="im-ssl-context"/>
</ssl-context-rules>
</authentication-client>
服务器的配置如下:
<tls>
<key-stores>
<key-store name="httpsKS">
<credential-reference clear-text="xxx"/>
<implementation type="JKS"/>
<file path="server.keystore" relative-to="jboss.server.config.dir"/>
</key-store>
</key-stores>
<key-managers>
<key-manager name="httpsKM" key-store="httpsKS">
<credential-reference clear-text="xxx"/>
</key-manager>
</key-managers>
<server-ssl-contexts>
<server-ssl-context name="httpsSSC" protocols="TLSv1.2" key-manager="httpsKM"/>
</server-ssl-contexts>
</tls>
和
<https-listener name="https" socket-binding="https" ssl-context="httpsSSC" enable-http2="true"/>
现在,ejb客户端在连接到remote+https://localhost:8443
时引发以下异常:
LOG 2019-06-13T12:12:56Z [XNIO-1 task-1] TRACE org.jboss.remoting.endpoint - Registered exception result
org.xnio.http.UpgradeFailedException: Invalid response code 200
at org.xnio.http.HttpUpgrade$HttpUpgradeState$UpgradeResultListener.handleEvent(HttpUpgrade.java:471) ~[xnio-api-3.6.5.Final.jar:3.6.5.Final]
at org.xnio.http.HttpUpgrade$HttpUpgradeState$UpgradeResultListener.handleEvent(HttpUpgrade.java:400) ~[xnio-api-3.6.5.Final.jar:3.6.5.Final]
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) ~[xnio-api-3.6.5.Final.jar:3.6.5.Final]
at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) ~[xnio-api-3.6.5.Final.jar:3.6.5.Final]
at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89) ~[xnio-nio-3.6.5.Final.jar:3.6.5.Final]
at org.xnio.nio.WorkerThread.run(WorkerThread.java:591) ~[xnio-nio-3.6.5.Final.jar:3.6.5.Final]
有什么想法吗?
答案 0 :(得分:1)
原来,缺少一个附加的远程连接器,该连接器指向connector-ref
小节中定义的https-listener
,指向undertow
:
<subsystem xmlns="urn:jboss:domain:remoting:4.0">
<http-connector name="http-remoting-connector" connector-ref="default" security-realm="ApplicationRealm"/>
<http-connector name="https-remoting-connector" connector-ref="https" security-realm="ApplicationRealm"/>
</subsystem>