java - ActiveMQ、SSL 和传输连接器

标签 java ssl encryption https activemq

以本网站为指南:

http://activemq.apache.org/how-do-i-use-ssl.html

我执行了以下操作(我在该站点中的 keytool 命令中添加了一些内容)

keytool -genkey -alias broker -keyalg RSA -keystore /home/amq/broker.ks -dname "CN=server, O=IBM, C=GB" -keypass passw0rd -storepass passw0rd

keytool -export -alias broker -keystore /home/amq/broker.ks -file /home/amq/broker_cert -storepass passw0rd

keytool -genkey -alias client -keyalg RSA -keystore /home/client/client.ks -dname "CN=client, O=IBM, C=GB" -keypass passw0rd -storepass passw0rd

keytool -import -alias broker -keystore /home/client/client.ts -file /home/amq/broker_cert -storepass passw0rd

keytool -export -alias client -keystore /home/client/client.ks -file /home/client/client_cert -storepass passw0rd

keytool -import -alias client -keystore /home/amq/broker.ts -file /home/client/client_cert -storepass passw0rd

现在 keystore 和信任库已经创建,我启动了代理

export SSL_OPTS=-Djavax.net.ssl.keyStore=/home/amq/broker.ks\ -Djavax.net.ssl.keyStorePassword=passw0rd\ -Djavax.net.ssl.trustStore=/home/amq/broker.ts

cd /usr/local/activemq/apache-activemq-5.9.0
bin/activemq console

到目前为止,一切都很好,我想做的是使用安装附带的 ProducerTool.java,并在 SSL 下运行它

看文档有点摸不着头脑,如下

Using Spring to configure SSL for a Broker instance

Sometimes the use of javax.net.ssl.* system properties is not appropriate as they effect all SSL users in a JVM. ActiveMQ 5.2.x adds an element to the that allows a broker specific set of SSL properties to be configured.

The SslContext test case validates starting an SSL transport listener using the configuration specified in the broker Xbean. The SslContext element is added to the broker as follows:

<amq:sslContext>
  <amq:sslContext
        keyStore="server.keystore" keyStorePassword="password"
        trustStore="client.keystore" trustStorePassword="password"/>
</amq:sslContext>

<amq:transportConnectors>
  <amq:transportConnector uri="ssl://localhost:61616" />
</amq:transportConnectors>
</amq:broker> </beans>

The SslContext is used to configure the SslTransportFactory for that broker. Full details of the configuration options available can be seen in the schema definition or in the accessors of org.apache.activemq.spring.SpringSslContext

我从这里收集到的是,由于我不关心所有 JVM 用户都将被迫使用 SSL,所以我很好,不需要任何 Spring 配置。 (至少我希望如此)

我被两件事困扰

1> 我认为我不需要执行任何 Spring 配置并且我可以简单地使用 -Djava 选项是否正确

2> 我认为我也不需要 ssl 传输连接器,我应该能够运行 ProducerTool.java 代码并且一切顺利。我为什么这么想,因为如果我需要将 SSL 传输连接器添加到额外配置​​的 borker,它会强制更改源代码。

我的假设是否正确

1> 我不需要任何 Spring 更改,因为我希望所有 JVM 用户都使用 SSL

2> 我可以不使用 ssl 传输连接器,而只使用 ProducerTool.java,基本上使默认连接使用 SSL 吗?

谢谢

最佳答案

它是一个 JMS 客户端,所以无论哪种方式(SSL 传输或不使用),客户端都将连接到端口 61616,因为 SSL 传输配置为 61616

但我无法从文档中判断是否需要传输

任何想法

关于java - ActiveMQ、SSL 和传输连接器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23748173/

相关文章:

encryption - 仅使用n e和c进行RSA解密

security - 可以存储可以检索的密码吗?

java - 为什么这个 while 循环在满足条件后才运行?

java - Play Framework 构建不一致

c++ - TLS 握手成功后,服务器关闭并出现错误 SSL 例程 :SSL3_GET_RECORD:wrong version number

ssl - 为什么 kubernetes pod 之间需要 ssl?

php - PDO 和 openssl_public_decrypt 失败

java - 日期差异包括时区偏移,怎么了?

java - 检查字符串是否包含希腊字符串

web-services - 通过 SSL 的 MonoTouch Web 服务请求获取 'authentication or decryption has failed'