Balwant Kumar Singh
Balwant Kumar Singh

Reputation: 1178

Mule - java.security.cert.CertificateException: No subject alternative names present

I need to send HTTPS request to a flow. For that in calling flow I have a HTTPS outbound endpoint. The configuration of which looks like this :

 <http:request-config name="HTTPS_Request_to_OnPrem"  host="0.0.0.0"  doc:name="HTTP Request Configuration" port="8083"  responseTimeout="30000" protocol="HTTPS">

</http:request-config>

Now the other flow which has exposed HTTPS looks like this :

<http:listener-config name="HTTPS_Domain"  host="0.0.0.0" port="8083" doc:name="HTTP Listener Configuration" protocol="HTTPS">
    <tls:context>
        <tls:key-store type="jks" path="keystore" keyPassword="*****" password="*****"/>
    </tls:context>

</http:listener-config> 

While running and hitting request my application is failing with the following error:

********************************************************************************
Message               : Error sending HTTP request. Message payload is of   type: String
Type                  : org.mule.api.MessagingException
Code                  : MULE_ERROR--2
Payload               : some payload 
JavaDoc               :     http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html

Exception stack is:
1. No subject alternative names present    (java.security.cert.CertificateException)
  sun.security.util.HostnameChecker:142 (null)
2. General SSLEngine problem (javax.net.ssl.SSLHandshakeException)
  sun.security.ssl.Alerts:192    (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/net/ssl/SSLHandshakeExceptio    n.html)
3. General SSLEngine problem (javax.net.ssl.SSLHandshakeException)
  sun.security.ssl.Handshaker:1336    (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/net/ssl/SSLHandshakeExceptio    n.html)
4. javax.net.ssl.SSLHandshakeException: General SSLEngine problem     (java.util.concurrent.ExecutionException)
  org.glassfish.grizzly.impl.SafeFutureImpl$Sync:349 (null)
5. java.util.concurrent.ExecutionException:   javax.net.ssl.SSLHandshakeException: General SSLEngine problem     (java.io.IOException)
  org.mule.module.http.internal.request.grizzly.GrizzlyHttpClient:234 (null)
6. Error sending HTTP request. Message payload is of type: String    (org.mule.api.MessagingException)
  org.mule.module.http.internal.request.DefaultHttpRequester:287    (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingExcepti    on.html)
********************************************************************************
Root Exception stack trace:
java.security.cert.CertificateException: No subject alternative names present
at sun.security.util.HostnameChecker.matchIP(HostnameChecker.java:142)
at sun.security.util.HostnameChecker.match(HostnameChecker.java:91)
at sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:347)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:255)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:138)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1433)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:209)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:901)
at sun.security.ssl.Handshaker$1.run(Handshaker.java:841)
at sun.security.ssl.Handshaker$1.run(Handshaker.java:839)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.ssl.Handshaker$DelegatedTask.run(Handshaker.java:1273)
at org.glassfish.grizzly.ssl.SSLUtils.executeDelegatedTask(SSLUtils.java:247)
at org.glassfish.grizzly.ssl.SSLBaseFilter.doHandshakeStep(SSLBaseFilter.java:669)
at org.glassfish.grizzly.ssl.SSLFilter.doHandshakeStep(SSLFilter.java:330)
at org.glassfish.grizzly.ssl.SSLBaseFilter.doHandshakeStep(SSLBaseFilter.java:583)
at org.glassfish.grizzly.ssl.SSLBaseFilter.handleRead(SSLBaseFilter.java:304)
at com.ning.http.client.providers.grizzly.SwitchingSSLFilter.handleRead(SwitchingSSLFilter.java:74)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.mule.module.http.internal.request.grizzly.FlowWorkManagerIOStrategy.run0(FlowWorkManagerIOStrategy.java:134)
at org.mule.module.http.internal.request.grizzly.FlowWorkManagerIOStrategy.access$100(FlowWorkManagerIOStrategy.java:31)
at org.mule.module.http.internal.request.grizzly.FlowWorkManagerIOStrategy$WorkerThreadRunnable.run(FlowWorkManagerIOStrategy.java:157)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
at java.lang.Thread.run(Thread.java:745)

Upvotes: 2

Views: 2527

Answers (1)

David Dossot
David Dossot

Reputation: 33413

You're sending an HTTPS request to 0.0.0.0 and the certificate you're running there doesn't list 0.0.0.0 as SAN.

You should either:

  • Change the request host to match what is in your certificate,
  • Add a SAN for 0.0.0.0 in the certificate.

Upvotes: 4

Related Questions