Camel-Undertow не работает с конфигурацией SSL: - PullRequest
0 голосов
/ 13 июня 2018

Я использую Camel-Undertow для отправки запроса через HTTP2 с конфигурацией TLS: без конфигурации SSL я могу успешно отправить сообщение через HTTP2.После настройки параметров контекста SSL для UndertowComponent отправитель начал сообщать о следующей ошибке:

java.io.EOFException: EOF reached while reading
at jdk.incubator.httpclient/jdk.incubator.http.Http1AsyncReceiver$Http1TubeSubscriber.onComplete(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.SocketTube$InternalReadPublisher$ReadSubscription.signalCompletion(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.SocketTube$InternalReadPublisher$InternalReadSubscription.read(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.SocketTube$SocketFlowTask.run(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.internal.common.SequentialScheduler$SchedulableTask.run(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.internal.common.SequentialScheduler.runOrSchedule(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.internal.common.SequentialScheduler.runOrSchedule(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.SocketTube$InternalReadPublisher$InternalReadSubscription.signalReadable(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.SocketTube$InternalReadPublisher$ReadEvent.signalEvent(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.SocketTube$SocketFlowEvent.handle(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.HttpClientImpl$SelectorManager.handleEvent(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.HttpClientImpl$SelectorManager.run(Unknown Source)

И в приложении Camel нет исключений, только несколько операторов отладок, связанных с org.apache.camel.util.jsse.BaseSSLContextParameters

    "Using SSLEngineImpl.
2018-06-13 12:11:06,549 org.apache.camel.util.jsse.BaseSSLContextParameters DEBUG (BaseSSLContextParameters.java:engineCreateSSLEngine:881) [XNIO-2 I/O-3] | SSLEngine [50818ec5[SSLEngine[hostname=127.0.0.1 port=65113] SSL_NULL_WITH_NULL_NULL]] created from SSLContext [javax.net.ssl.SSLContext@56c4278e].
2018-06-13 12:11:06,550 org.apache.camel.util.jsse.BaseSSLContextParameters DEBUG (BaseSSLContextParameters.java:configure:353) [XNIO-2 I/O-3] | Configuring SSLEngine [50818ec5[SSLEngine[hostname=127.0.0.1 port=65113] SSL_NULL_WITH_NULL_NULL]] with 
 explicitly set cipher suites [null],
 cipher suite patterns [null],
 available cipher suites [[TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256, … TLS_EMPTY_RENEGOTIATION_INFO_SCSV]],
 currently enabled cipher suites [[TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256… TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, … TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]],
 and default cipher suite patterns [Patterns [includes=[.*], excludes=[.*_NULL_.*, .*_anon_.*, .*_EXPORT_.*, .*_DES_.*]]].
 Resulting enabled cipher suites are [[TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_.. TLS_EMPTY_RENEGOTIATION_INFO_SCSV]].
2018-06-13 12:11:06,550 org.apache.camel.util.jsse.BaseSSLContextParameters DEBUG (BaseSSLContextParameters.java:configure:372) [XNIO-2 I/O-3] | Configuring SSLEngine [50818ec5[SSLEngine[hostname=127.0.0.1 port=65113] SSL_NULL_WITH_NULL_NULL]] with 
 explicitly set protocols [null],
 protocol patterns [null],
 available protocols [[SSLv2Hello, TLSv1, TLSv1.1, TLSv1.2]],
 currently enabled protocols [[SSLv2Hello, TLSv1, TLSv1.1, TLSv1.2]],
 and default protocol patterns [Patterns [includes=[.*], excludes=[SSL.*]]].
 Resulting enabled protocols are [[TLSv1, TLSv1.1, TLSv1.2]].
XNIO-2 I/O-3, called closeInbound()
XNIO-2 I/O-3, closeInboundInternal()
XNIO-2 I/O-3, closeOutboundInternal()
XNIO-2 I/O-3, called closeOutbound()
XNIO-2 I/O-3, closeOutboundInternal()
Using SSLEngineImpl.
2018-06-13 12:11:06,620 org.apache.camel.util.jsse.BaseSSLContextParameters DEBUG (BaseSSLContextParameters.java:engineCreateSSLEngine:881) [XNIO-2 I/O-4] | SSLEngine [6d696524[SSLEngine[hostname=127.0.0.1 port=65114] SSL_NULL_WITH_NULL_NULL]] created from SSLContext [javax.net.ssl.SSLContext@56c4278e].
2018-06-13 12:11:06,622 org.apache.camel.util.jsse.BaseSSLContextParameters DEBUG (BaseSSLContextParameters.java:configure:353) [XNIO-2 I/O-4] | Configuring SSLEngine [6d696524[SSLEngine[hostname=127.0.0.1 port=65114] SSL_NULL_WITH_NULL_NULL]] with 
 explicitly set cipher suites [null],
 cipher suite patterns [null],
 available cipher suites [[TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256, …, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]],
 currently enabled cipher suites [[TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256…, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]],
 and default cipher suite patterns [Patterns [includes=[.*], excludes=[.*_NULL_.*, .*_anon_.*, .*_EXPORT_.*, .*_DES_.*]]].
 Resulting enabled cipher suites are [[TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256… TLS_EMPTY_RENEGOTIATION_INFO_SCSV]].
2018-06-13 12:11:06,642 org.apache.camel.util.jsse.BaseSSLContextParameters DEBUG (BaseSSLContextParameters.java:configure:372) [XNIO-2 I/O-4] | Configuring SSLEngine [6d696524[SSLEngine[hostname=127.0.0.1 port=65114] SSL_NULL_WITH_NULL_NULL]] with 
 explicitly set protocols [null],
 protocol patterns [null],
 available protocols [[SSLv2Hello, TLSv1, TLSv1.1, TLSv1.2]],
 currently enabled protocols [[SSLv2Hello, TLSv1, TLSv1.1, TLSv1.2]],
 and default protocol patterns [Patterns [includes=[.*], excludes=[SSL.*]]].
 Resulting enabled protocols are [[TLSv1, TLSv1.1, TLSv1.2]].
XNIO-2 I/O-4, called closeInbound()
XNIO-2 I/O-4, closeInboundInternal()
XNIO-2 I/O-4, closeOutboundInternal()
XNIO-2 I/O-4, called closeOutbound()
XNIO-2 I/O-4, closeOutboundInternal()"

Ниже приведен фрагмент из моего приложения верблюда

Маршрут 1:

   from("undertow:http://127.0.0.1:10199/Common")
   .process(new Processor() {
                    @Override
                    public void process(Exchange exchange) throws Exception {
                    System.out.println("Message received :" + 
                      exchange.getIn().getBody(String.class));
                }
             })
    .to("direct://protocolConverter");

Маршрут 2:

from("direct://protocolConverter").
to("undertow:https://localhost:8081/testEndpoint1");

Подготовка контекста верблюда

 //In main method

 context.addComponent("undertow", getUndertowComponent(context));

//outside main

static UndertowComponent getUndertowComponent(CamelContext context){
UndertowComponent uc = new UndertowComponent(context);
UndertowHostOptions uho = new UndertowHostOptions();
uho.setHttp2Enabled(true);
uc.setHostOptions(uho);
//  uc.setUseGlobalSslContextParameters(true);
//to enabled SSL support on undertow
configureSSLforUndertow(uc);

    return uc;
}

static void configureSSLforUndertow(UndertowComponent uc) {
KeyStoreParameters trust_ksp = new KeyStoreParameters();

trust_ksp.setResource("/cacerts.jks");
trust_ksp.setPassword("changeit");

TrustManagersParameters trustp = new TrustManagersParameters();
trustp.setKeyStore(trust_ksp);

SSLContextParameters scp = new SSLContextParameters();
scp.setTrustManagers(trustp);
    uc.setSslContextParameters(scp);
}

Понятия не имею, почему undertow не работает с включенным SSL, я пробовал аналогичную конфигурацию, SSL включен с HTTP, используя camel-HTTP4, он работал как положено, но с Camel-undertow он не прошел без достаточных симптомов.о проблеме.Даже println на маршруте 1 не печатается.Я заблокирован сейчас.Если кто-то из вас уже сталкивался с такой же проблемой.Пожалуйста, поделитесь своими знаниями о том же.

Используемая верблюжья версия: Apache Camel 2.21.1

Примечание: я проверил сертификаты, те же сертификаты работают с компонентом Http4.

Примечание: я удалил список шифров из журналов, чтобы сделать его более читабельным

...