以本网站为指南:
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/