-1

我使用此命令将.pem文件转换为.jks一个():

keytool -importcert -alias debian -file cert.pem -keystore cert.jks -storepass passwd

这是骡子文件:

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:http="http://www.mulesource.org/schema/mule/http/2.2"
    xmlns:https="http://www.mulesource.org/schema/mule/https/2.2"
    xsi:schemaLocation="
        http://www.mulesource.org/schema/mule/http/2.2 http://www.mulesource.org/schema/mule/http/2.2/mule-http.xsd
        http://www.mulesource.org/schema/mule/https/2.2 http://www.mulesource.org/schema/mule/https/2.2/mule-https.xsd
        http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd">

    <https:connector name="SslConnector" keepSendSocketOpen="true">
        <https:tls-client path="${mule.home}/cert.jks"
                          storePassword="passwd"/>
    </https:connector>

    <model>
        <service name="ConnectToHTTPS">
            <inbound>
                <http:inbound-endpoint host="localhost"
                                       port="9000"
                                       synchronous="true"/>
            </inbound>
            <outbound>
                <chaining-router>
                    <outbound-endpoint address="https://localhost"
                                       synchronous="true"/>
                </chaining-router>
            </outbound>
        </service>
    </model>
</mule>

现在,我明白了:

ERROR 2011-07-08 12:06:51,210 [main] org.mule.MuleServer: 
********************************************************************************
Message               : Initialisation Failure: Error creating bean with name 'SslConnector': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: The Key password cannot be null
Type                  : org.mule.api.lifecycle.InitialisationException
Code                  : MULE_ERROR-72085
JavaDoc               : http://www.mulesource.org/docs/site/current2/apidocs/org/mule/api/lifecycle/InitialisationException.html
Object                : org.mule.config.spring.SpringRegistry@160bf50
********************************************************************************
Exception stack is:
1. The Key password cannot be null (java.lang.IllegalArgumentException)
  org.mule.api.security.tls.TlsConfiguration:290 (null)
2. Error creating bean with name 'SslConnector': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: The Key password cannot be null (org.springframework.beans.factory.BeanCreationException)
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory:1338 (null)
3. Initialisation Failure: Error creating bean with name 'SslConnector': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: The Key password cannot be null (org.mule.api.lifecycle.InitialisationException)
  org.mule.registry.AbstractRegistry:76 (http://www.mulesource.org/docs/site/current2/apidocs/org/mule/api/lifecycle/InitialisationException.html)

旁注:这扩展了有没有办法通过仅指定 Mule 2 中的 url 来连接到 https 服务器?

4

1 回答 1

2

在尝试了您的配置后,我认为还需要一个 tls-key-store 元素。

以下 HTTPS 配置允许“ConnectToHTTPS”成功命中 HTTPS 出站目标:

<https:connector name="SslConnector" keepSendSocketOpen="true">
    <https:tls-client path="${mule.home}/cert.jks"
                      storePassword="passwd"/>
    <https:tls-key-store path="${mule.home}/cert.jks"
                         keyPassword="passwd"
                         storePassword="passwd" />
</https:connector>
于 2011-07-13T05:37:10.817 回答