我有一个运行在localhost上的ActiveMQ实例,它试图连接到运行在AWS (Amazon )上的另一个实例。运行在AWS上的代理需要通过SSL建立代理到代理的连接。
在localhost broker的activemq.xml中,添加了以下内容以创建与运行在AWS上的代理的连接(目前只有一种方式):
<networkConnectors>
<networkConnector name="local-to-aws" userName="myCommonUser" duplex="true" uri="static:(ssl://###.mq.ca-central-1.amazonaws.com:61617)"/>
</networkConnectors>如果我尝试用它启动本地主机代理,我将在我的activemy.log文件中得到以下错误:
2021-01-29 20:19:32,638 | WARN | Could not start network bridge between: vm://localhost and:
ssl://###.mq.ca-central-1.amazonaws.com:61617 due to: java.security.NoSuchAlgorithmException:
Error constructing implementation (algorithm: Default, provider: SunJSSE, class:
sun.security.ssl.SSLContextImpl$DefaultSSLContext) |
org.apache.activemq.network.DiscoveryNetworkConnector | Simple Discovery Agent-2为了解决这个问题,我在localhost broker的activemq.xml配置中添加了以下内容:
<sslContext>
<sslContext keyStore="file:${activemq.base}/conf/broker.ks"
keyStorePassword="###"
trustStore="file:${activemq.base}/conf/client.ts"
trustStorePassword="###"/>
</sslContext>broker.ks和client.ts是使用以下命令生成的:
Using keytool, create a certificate for the broker:
keytool -genkey -alias broker -keyalg RSA -keystore broker.ks
Export the broker's certificate so it can be shared with clients:
keytool -export -alias broker -keystore broker.ks -file broker_cert
Create a certificate/keystore for the client:
keytool -genkey -alias client -keyalg RSA -keystore client.ks
Create a truststore for the client, and import the broker's certificate. This establishes that the client "trusts" the broker:
keytool -import -alias broker -keystore client.ts -file broker_cert这就是我为在本地主机代理上启用SSL所做的一切,我不确定除了将<sslContext>元素添加到我的配置之外,还需要做什么。
当我尝试在进行更改后启动localhost代理时,我现在在activemq.log中得到了一个不同的错误。
2021-01-29 20:07:03,686 | INFO | Error with pending remote brokerInfo on:
ssl://###.mq.ca-central-1.amazonaws.com/##.###.#.106:61617 (Connection or inbound has closed) |
org.apache.activemq.network.DemandForwardingBridgeSupport | ActiveMQ Transport: ssl://###.mq.ca-
central-1.amazonaws.com/##.###.#.106:61617
2021-01-29 20:07:03,687 | WARN | Could not start network bridge between: vm://localhost and:
ssl://###.mq.ca-central-1.amazonaws.com:61617 due to: sun.security.validator.ValidatorException:
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find
valid certification path to requested target | org.apache.activemq.network.DiscoveryNetworkConnector |
Simple Discovery Agent-3这就是我困惑的地方。
有人知道我做错了什么吗?在AWS的配置中,我没有看到任何与SSL相关的内容,我认为这是因为AWS故意对我隐瞒这一点,以防止我更改代理的任何SSL设置。
我是否需要以某种方式获得AWS代理使用的SSL证书,并将其添加到本地主机代理中?我不知道下一步该怎么做。
Update:我使用Portecle从AWS代理下载SSL证书并将它们添加到 client.ts**.**中。
发布于 2021-02-04 04:56:39
在验证端(本地主机),似乎需要验证远程AWS代理的TLS证书。为此,验证端需要使用可信密钥库(也称为信任存储库)来设置,该密钥库包含证书层次结构(或根CA取决于从远程AWS返回的证书链),从根CA一直到服务器证书。
请将StarField CA证书上传到可信存储区,并根据您的评论解决此问题。
本链接提供了实现这一目标的详细信息。
https://stackoverflow.com/questions/65963783
复制相似问题