首页 > 解决方案 > https4 apache camel 给出的主机名与对端提供的证书主题不匹配

问题描述

我正在尝试在 Spring DSL 中建立与 apache camel 的 https 连接。按照本教程:https ://access.redhat.com/documentation/en-us/red_hat_jboss_fuse/6.2/html/apache_camel_component_reference/IDU-HTTP4

还有:http ://camel.apache.org/http4.html

我构造了以下代码:

<sslContextParameters id="sslContextParameters" xmlns="http://camel.apache.org/schema/blueprint"> 
        <trustManagers>
            <keyStore resource="keyStore/keyStore.jks" password="changeit"/>                   
        </trustManagers>                
</sslContextParameters>

和我的路线:

<route id="axis_camera">
    <to uri = "https4://my_ip_adress?sslContextParametersRef=sslContextParameters"
</route>

<bean id="http-ssl" class="org.apache.camel.component.http4.HttpComponent">
<property name="sslContextParameters" ref="sslContextParameters"/>
</bean>

在 apache servicemix 上运行它时,我得到:

javax.net.ssl.SSLPeerUnverifiedException: Host name my_ip_adress does not 
match the certificate subject provided by the peer (CN=axis-accc8ec51452, 
O=Axis Communications AB)

现在我可以在证书中看到该主机名未在主题中定义。我已经看到无法编辑证书,所以我的问题是如何调整此代码以使其读取正确的主机名?

标签: apache-camelapache-servicemixspring-dsl

解决方案


这是基于可用信息的疯狂猜测,但请尝试一下。您的证书 CN 是axis-accc8ec51452您应该连接到此主机名,而不是my_ip_address.

要将主机名映射axis-accc8ec51452my_ip_address,请在您的 DNS 解析器中更新它或将其添加到您的hosts文件中 (*nix : /etc/hosts| Windows: c:\Windows\System32\Drivers\etc\hosts)


推荐阅读