camel 支持htts接入概述

来源:互联网 发布:数据库可以存图片吗 编辑:程序博客网 时间:2024/06/06 01:53

camel 支持htts接入概述

camel 版本 :2.14.4
接入服务默认支持https服务接入,默认采用tls1.2协议;

协商阶段发送sslv2 hello消息;

目前测试接入camel https consumer没问题,但是接入tomcat尚不支持,需要tomcat和camel额外配置方能支持。

tomcat https接入问题

现象

camel日志报 “javax.net.ssl.SSLException: Received fatal alert: handshake_failure”,然后连接就断开了。

原因

  1. jetty(version 8.xx.xx)默认发起的sslv2 hello
  2. tomcat默认配置不支持 sslv2 hello

解决办法

对应原因也有两个方法

  1. 配置tomcat支持sslv2 hello消息
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"               sslEnabledProtocols="TLSv1,TLSv1.1,TLSv1.2,SSLv2Hello"               clientAuth="false"                sslProtocol="TLS"                keystoreFile="/conf/tomcat.keystore"                keystorePass="tomcat" />

参考 http://stackoverflow.com/questions/26488667/tomcat-7-getting-sslv2hello-is-disabled-error-when-trying-to-make-client-server

2.配置jetty不发送sslv2 hello消息

目前仅支持配置发送ssl hello消息,并且不支持信任所有证书,必须将接入服务的证书导入truststore

配置如下

<beans xmlns="http://www.springframework.org/schema/beans"       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"       xmlns:camel="http://camel.apache.org/schema/spring"       xsi:schemaLocation="                http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd                http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">    <camel:sslContextParameters id="mySslContext">        <camel:secureSocketProtocols>            <camel:secureSocketProtocol>TLSv1.1</camel:secureSocketProtocol>        </camel:secureSocketProtocols>        <camel:trustManagers>            <camel:keyStore resource="/conf/keystore/jetty.truststore" password="xxxx"/>        </camel:trustManagers>    </camel:sslContextParameters></beans>
  <to uri="jetty:https://xxx:8043?bridgeEndpoint=true&amp;throwExceptionOnFailure=false&amp;sslContextParametersRef=mySslContext"></to>

工具

  1. java https调试参数

    -Djavax.net.debug=all 这货可以直接给出错误原因,不支持的hello协议,不支持的算法等等
  2. wireshark

wireshark 默认仅对443端口的流进行https分析,需要在 设置-》协议-》http-》ssl/tsl ports

不设置的话根本观察不到https的协商过程。

0 0
原创粉丝点击