My question(s):
It would appear one of the differences in the underlying sun.net.www.protocol.https.HttpsClient is the HostNameVerifier implementation - The problem appears to be currently in HttpsClient in the afterConnect method where setHost is not being called, and that doesn’t seem to refer to any SSLParameters - my attempt to work around this was to get our WS client invocation code to load our factory, I have been unsuccessful thus far-
1) How do I get our WS client invocation code to load our factory?
OR
2) How do I setup JBOSS to process this request correctly? (Assuming it is a JBOSS configuration)
The Stage: - Java Oracle JDK 1.8 64-bit - Jboss 6.4 EAP - AXIS2 - JAX - Certs are Valid and loaded correctly - I am able to replicate the error using a standalone java application and I am able to repair the error with a standalone java application.
Attempts:
1) Added a CXF out interceptor of PRE-PROTOCOL phase, which will add hostname in header.
public void handleMessage(Message message) {
System.out.println("Inside handle message");
Map<String, List> headers = (Map<String, List>) message.get(Message.PROTOCOL_HEADERS);
try {
headers.put("Host", Collections.singletonList("ecm-users-dev.aexp.com"));
} catch (Exception ce) {
throw new Fault(ce);
}
}
2) Tried disabling HostNameVerfier as some blogs suggested enabling hostNameverfier would cause issues.
3) Created a wrapper around SSLSocketFactory to inject SSL parameters as suggested in below blog http://javabreaks.blogspot.com/2015/12/java-ssl-handshake-with-server-name.html
4) Injecting host parameters into httpconduit session through client policy.
final HTTPConduit httpConduit = (HTTPConduit) cxfClient.getConduit();
final TLSClientParameters tlsCP = new TLSClientParameters();
HTTPClientPolicy clientPolicy = new HTTPClientPolicy();
clientPolicy.setHost(endpoint.getHost());
httpConduit.setClient(clientPolicy);
httpConduit.setTlsClientParameters(tlsCP);
5) Tried injecting wrapper SSLSocketfactory through binding provider.
What appears to be the issue: Setting the SNI..
My logs:
-------Working-----
14:11:02,417 INFO [stdout] (http-/127.0.0.1:8080-2) Extension signature_algorithms, signature_algorithms: SHA512withECDSA, SHA512withRSA, SHA384withECDSA, SHA384withRSA, SHA256withECDSA, SHA256withRSA, SHA224withECDSA, SHA224withRSA, SHA1withECDSA, SHA1withRSA, SHA1withDSA, MD5withRSA
14:11:02,419 I
NFO [stdout] (http-/127.0.0.1:8080-2) Extension server_name, server_name: [type=host_name (0), value=some.server.value]
14:11:02,419
INFO [stdout] (http-/127.0.0.1:8080-2) ***
----Non-working-----
14:15:35,081 INFO [stdout] (http-/127.0.0.1:8080-1) Extension signature_algorithms, signature_algorithms: SHA512withECDSA, SHA512withRSA, SHA384withECDSA, SHA384withRSA, SHA256withECDSA, SHA256withRSA, SHA224withECDSA, SHA224withRSA, SHA1withECDSA, SHA1withRSA, SHA1withDSA, MD5withRSA
14:15:35,082
INFO [stdout] (http-/127.0.0.1:8080-1) ***
(this one is missing the SNI)
(two attempted) code snippets:
try{ bp.getRequestContext().put("com.sun.xml.ws.transport.https.client.SSLSocketFactory", new SSLSocketFactoryWrapper(sslContext.getSocketFactory(), sslParameters));
} catch (Exception e) {
log.error("Error of port default SSL configuration applying", e);
throw new IllegalArgumentException("fail to configure ws client by configuration", e);
}
--------------------
bp.getRequestContext().put("com.sun.xml.ws.transport.https.client.SSLSocketFactory" , new SSLSocketFactoryFacade().createSocket(endPoint,443));
log.info("exit getServiceClient(): " + client);
return client;
} catch(Throwable e) {
log.error("Error creating the Service Client", e);
throw new RuntimeException("Error creating the Service Client: " + e.getMessage(), e);
}
Similar Question:
(Suggestion did not work) Extended server_name (SNI Extension) not sent with jdk1.8.0 but send with jdk1.7.0