【问题标题】:ActiveMQ 5.10: Cannot restrict access to server from remote clientActiveMQ 5.10:无法限制远程客户端对服务器的访问
【发布时间】:2015-01-25 07:02:00
【问题描述】:

我在 MacOSX Yosemite 上安装 ActiveMQ 5.10。 我可以更改文件 jetty-realm.properties 以限制在 localhost:8161 访问 Web 控制台。

但是,当我编写 Ruby 代码以使用 Stomp 连接到 ActiveMQ 时,如下所示:

require 'stomp'
client = Stomp::Client.new('any username', 'any password', 'localhost', 61613)

我可以使用客户端发布和订阅 ActiveMQ 服务器上的每个队列。

有人可以建议一种方法来限制远程连接对 ActiveMQ 服务器的访问。

我已经尝试了以下链接,但它们都不起作用: https://security.stackexchange.com/questions/7989/how-to-secure-a-activemq http://activemq.apache.org/version-5-getting-started.html#Version5GettingStarted-ConfiguringActiveMQ http://activemq.apache.org/security.html

【问题讨论】:

    标签: security connection activemq restrict


    【解决方案1】:

    我在玩了一段时间后找到了答案,并为经纪人阅读了整个架构文件。

    在 ActiveMQ 5.10 中,代理直接放在 conf/activemq.xml 中。

    首先,我这样解决问题:在activemq.xml中,<broker>下,我放:

    <plugins> 
      <simpleAuthenticationPlugin>
        <users>
          <authenticationUser username="admin" password="password" groups="admins,publishers,consumers"/>
        </users>
      </simpleAuthenticationPlugin>
    </plugins>
    

    因此,所有愚蠢的文档中缺少的&lt;plugins&gt; 使配置变得无用。

    更好的解决方案:

    我将整个 &lt;broker&gt; 部分复制到 activemq.xml 中,并将其放在一个名为 broker.xml 的文件中(您可以将其命名为任何名称,例如 apache_dumb_documentation.xml),在名为&lt;bean&gt;的部分下

    <beans
      xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/beans  
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
    
      <broker>
        ... broker config here, including <plugins> ...
      </broker>
    
    </beans>
    

    然后在activemq中,在&lt;broker&gt;之前的地方,我就这么写:

    <import resource="broker.xml"/>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-01-19
      • 1970-01-01
      • 1970-01-01
      • 2013-12-27
      • 2021-01-25
      • 1970-01-01
      • 2016-04-06
      • 1970-01-01
      相关资源
      最近更新 更多