Status: Closed (View Workflow)
I configured two WildFly server, one is the service provider (server), the other one the consumer (client). An EJB on the consumer server tries to call an EJB on the provider server and the remoting connection is secured by SSL. But it doesn't work. I can see the negotiation of the cipher suites and then the communication stops. I get a
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
on the provider side. A JavaSE client can call the service provider, but only when SSL_SARTTLS is not set. My current setup is:
subsystem undertow, default-server:
Output on the service provider side when the communication stops:
WildFly consumer config
subsystem remoting, outbound connections:
The realms contain the key- and truststores and all passwords are configured.
The reason for the communication problem comes from the following code.
The service consumer (or client) WildFly has a remote-outbound-connection in the remoting subsystem config which results in an org.jboss.as.remoting.RemoteOutboundConnectionService. There is a connect() method which contains the lines:
My configuration comes from this.connectionOptions and is overwritten by the defaults. The service consumer will open the connection with SSL_STARTTLS==true.
The service provider (or server) WildFly uses an https-listener from the undertow subsystem. Which generates an org.wildfly.extension.undertow.HttpsListenerService. Method startListening(XnioWorker worker,...) has the following code:
The OptionMap combined is used for the JsseXnioSsl and I can't see a way how to add my own configuration options. The result is that SSL_STARTTLS is undefined and in JsseXnioSsl has a method connectSsl which calls openSslConnection. There is an event handler build which calls:
This sets the flag startTls of the constructor to false and the member variable tls in org.xnio.ssl.JsseSslStreamConnection to true. And when I understand it right, will then the consumer start unencrypted and will only switch to TLS when it is told todo so. But the service provider expectes, because of tls==true, an encrypted connection right from the beginning. And this generates the above error message/exception. I can reproduce this by using a JavaSE client to call the service provider. This works well when I don't set SSL_STARTTLS on the client side. But when I set it to true I get the same behavior like when the client is another WildFly instance.
tomazcerar said that on the consumer side in the connect() method the builder.addAll(...) should be moved to the end after setting the defaults. Thats the reason for this issue.
With this solution I can switch off SSL_STARTTLS on the consumer(client) side.
Another additional possibility could be to make the provider (server) side configurable that the hard coded options can be overwritten. But I don't know if this fits in the original design.