gpt4 book ai didi

ssl - 骡子 ESB 3.2.x : HTTPS Transport bad_certificate error?

转载 作者:太空宇宙 更新时间:2023-11-03 14:17:20 25 4
gpt4 key购买 nike

我需要使用自签名(或未签名)证书作为我的流程之一的入站端点的 HTTPS 监听器的证书。我尝试了几种方法来生成证书,但是当监听器尝试读取请求时,我总是得到一个错误:

javax.net.ssl.SSLHandshakeException: Received fatal alert: bad_certificate

Google 似乎认为 bad_certificate 消息与信任库有关。无论是否使用应该定义信任存储的 mule tls-server 配置,我都会继续看到相同的错误。

我使用了几种不同的机制来创建证书:

我已经尝试过配置和不配置 tls-servertls-client 元素,所有这些都在 mule 文档中进行了描述。

我无计可施,试图确定 Mule 可以接受哪些 key 类型,以及问题的根本原因是什么。任何建议表示赞赏。

我的配置和错误日志如下(省略各种样板内容)

mule-config.xml

<https:connector name="connectorName">
<!-- only one key, alias 'mule' -->
<https:tls-key-store path="/opt/mule/keys/keystore.jks" keyPassword="thePassword" storePassword="thePassword"/>
<!-- I've also tried the following, same error occurs both with or without this parameter -->
<https:tls-server path="/opt/mule/keys/keystore.jks storePassword="thePassword"/>
</https:connector>

<flow name="theFlow">
<https:inbound-endpoint host="0.0.0.0" port="8081" connector-ref="connectorName"/>
<!-- stuff: not important, works with http -->
</flow>

此配置正确加载,但是当我尝试使用与 HTTP 相同的方法(但使用 https://代替)发布请求时,我收到以下错误,并且没有响应(不是 500 错误,或任何东西,连接刚刚关闭)。这个特定的运行来 self 使用 HTTPS 传输的 mulesoft 文档中的说明生成的 key ,但它与我使用任何其他方法得到的错误没有任何不同。

错误列表

[ERROR] org.mule.exception.DefaultSystemExceptionStrategy - Caught exception in Exception Strategy: Received fatal alert: bad_certificate
javax.net.ssl.SSLHandshakeException: Received fatal alert: bad_certificate
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1822)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1004)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.waitForClose(SSLSocketImpl.java:1571)
at com.sun.net.ssl.internal.ssl.HandshakeOutStream.flush(HandshakeOutStream.java:103)
at com.sun.net.ssl.internal.ssl.Handshaker.sendChangeCipherSpec(Handshaker.java:689)
at com.sun.net.ssl.internal.ssl.ServerHandshaker.sendChangeCipherAndFinish(ServerHandshaker.java:1279)
at com.sun.net.ssl.internal.ssl.ServerHandshaker.clientFinished(ServerHandshaker.java:1239)
at com.sun.net.ssl.internal.ssl.ServerHandshaker.processMessage(ServerHandshaker.java:225)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:593)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:529)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:943)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1188)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:818)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:50)
at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78)
at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106)
at org.mule.transport.http.HttpServerConnection.readLine(HttpServerConnection.java:219)
at org.mule.transport.http.HttpServerConnection.readRequest(HttpServerConnection.java:185)
at org.mule.transport.http.HttpMessageReceiver$HttpWorker.run(HttpMessageReceiver.java:155)
at org.mule.work.WorkerContext.run(WorkerContext.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)

最后,感谢您花时间阅读到这里。

更新

我开始得到不同的堆栈跟踪,但出现相同的错误。改变? key 和 keystore 现在有不同的密码。

javax.net.ssl.SSLHandshakeException: Received fatal alert: bad_certificate
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1822)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1004)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:820)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:50)
at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78)
at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106)
at org.mule.transport.http.HttpServerConnection.readLine(HttpServerConnection.java:219)
at org.mule.transport.http.HttpServerConnection.readRequest(HttpServerConnection.java:185)
at org.mule.transport.http.HttpMessageReceiver$HttpWorker.run(HttpMessageReceiver.java:155)
at org.mule.work.WorkerContext.run(WorkerContext.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)

更新 2

我将 key 作为可信证书添加到 .../jre/lib/security/cacerts 文件中。没有变化。

最佳答案

Mule 文档中显示的创建自签名证书的方法有效:我已经用过好几次了。我又试了一次,它适用于您的配置,只是我删除了 https:tls-server,这是没用的。

以下是我遵循的步骤:

  • 使用以下方法创建 keystore :keytool -genkey -alias mule -keyalg RSA -keystore keystore.jks(我使用“thePassword”作为 keystore 和 key 密码)。
  • 像这样配置 Mule:

    <https:connector name="connectorName">
    <https:tls-key-store
    path="...path.../keystore.jks"
    keyPassword="thePassword" storePassword="thePassword" />
    </https:connector>

    <flow name="theFlow">
    <https:inbound-endpoint host="0.0.0.0" port="8081"
    connector-ref="connectorName" />
    <set-payload value="w00t" />
    </flow>
  • 测试:

    $ curl -vk https://localhost:8081
    * About to connect() to localhost port 8081 (#0)
    * Trying 127.0.0.1... connected
    * successfully set certificate verify locations:
    * CAfile: none
    CApath: /etc/ssl/certs
    * SSLv3, TLS handshake, Client hello (1):
    * SSLv3, TLS handshake, Server hello (2):
    * SSLv3, TLS handshake, CERT (11):
    * SSLv3, TLS handshake, Server key exchange (12):
    * SSLv3, TLS handshake, Server finished (14):
    * SSLv3, TLS handshake, Client key exchange (16):
    * SSLv3, TLS change cipher, Client hello (1):
    * SSLv3, TLS handshake, Finished (20):
    * SSLv3, TLS change cipher, Client hello (1):
    * SSLv3, TLS handshake, Finished (20):
    * SSL connection using ECDHE-RSA-AES256-SHA
    * Server certificate:
    * subject: C=Unknown; ST=Unknown; L=Unknown; O=Unknown; OU=Unknown; CN=Unknown
    * start date: 2013-05-15 18:20:34 GMT
    * expire date: 2013-08-13 18:20:34 GMT
    * common name: Unknown (does not match 'localhost')
    * issuer: C=Unknown; ST=Unknown; L=Unknown; O=Unknown; OU=Unknown; CN=Unknown
    * SSL certificate verify result: self signed certificate (18), continuing anyway.
    > GET / HTTP/1.1
    > User-Agent: curl/7.22.0 (i686-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
    > Host: localhost:8081
    > Accept: */*
    >
    < HTTP/1.1 200 OK
    < Date: Wed, 15 May 2013 11:24:24 -0700
    < Server: Mule Core/3.4.0
    < X-MULE_SESSION: rO0ABXNyACNvcmcubXVsZS5zZXNzaW9uLkRlZmF1bHRNdWxlU2Vzc2lvbi7rdtEW7GGKAwAEWgAFdmFsaWRMAA1mbG93Q29uc3RydWN0dAAmTG9yZy9tdWxlL2FwaS9jb25zdHJ1Y3QvRmxvd0NvbnN0cnVjdDtMAAJpZHQAEkxqYXZhL2xhbmcvU3RyaW5nO0wAD3NlY3VyaXR5Q29udGV4dHQAJ0xvcmcvbXVsZS9hcGkvc2VjdXJpdHkvU2VjdXJpdHlDb250ZXh0O3hwAXB0ACRhYjcwZTY0OS1iZDhjLTExZTItOWU5Yy1mZjdmMDIxMmE5MmZwc3IAJWphdmEudXRpbC5Db2xsZWN0aW9ucyRTeW5jaHJvbml6ZWRNYXAbc/kJS0s5ewMAAkwAAW10AA9MamF2YS91dGlsL01hcDtMAAVtdXRleHQAEkxqYXZhL2xhbmcvT2JqZWN0O3hwc3IAJG9yZy5tdWxlLnV0aWwuQ2FzZUluc2Vuc2l0aXZlSGFzaE1hcJ3R2e9nRc4AAwAAeHB3DD9AAAAAAAAQAAAAAHhxAH4ACXh4
    < X-MULE_ENCODING: UTF-8
    < LOCAL_CERTIFICATES: [Ljava.security.cert.X509Certificate;@1c5e22a
    < Content-Type: text/plain
    < Content-Length: 4
    < Connection: close
    <
    * Closing connection #0
    * SSLv3, TLS alert, Client hello (1):
    w00t

关于ssl - 骡子 ESB 3.2.x : HTTPS Transport bad_certificate error?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16550316/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com