如何正确保护 ActiveMQ 实例,以及所有不同文件的用途是什么?

信息安全 验证 阿帕奇 配置
2021-08-10 23:58:45

我正在尝试为ActiveMQ配置基于用户的身份验证,我对此过程中涉及的许多不同文件感到非常困惑。我已经阅读了ActiveMQ的安全页面,但我仍然有几个问题。

需要明确的是,我的目标是让只有指定的用户才能读取或写入ActiveMQ或访问 Web 控制台。这些可以是本地ActiveMQ用户,不需要 LDAP。

我已经成功地意识到,为了配置对 Web 控制台的访问,我需要在 中配置用户conf/jetty-realm.properties,但除此之外我被卡住了。

好的,所以文件夹中似乎与身份验证相关的conf文件是......

  • credentials.properties
  • credentials-enc.properties
  • groups.properties
  • login.config
  • users.properties

最重要的是,安全页面建议使用“ simpleAuthenticationPlugin

<simpleAuthenticationPlugin>
    <users>
        <authenticationUser username="system" password="manager"
            groups="users,admins"/>
        <authenticationUser username="user" password="password"
            groups="users"/>
        <authenticationUser username="guest" password="password" groups="guests"/>
    </users>
</simpleAuthenticationPlugin>

在经纪人

所以我的理解是..

  • users.properties似乎是用户应该去的地方,但我看不出simpleAuthenticationPlugin这个文件是否存在。
  • group.properties 似乎是配置组的地方,好的。
  • login.config似乎它只是指向users.propertiesand groups.properties,好的。
  • credentials.properties似乎是多余的。看起来用户正在这里配置。如果存在,不确定为什么users.properties存在。
  • credentials-enc.properites似乎是加密密码的地方,但是如果users.properties存在,为什么还会存在呢?

我的问题是...

  1. 在ActiveMQ上配置本地用户并使其成为唯一可以读取或写入队列的正确方法是什么?

  2. 以下每个文件的目的是什么?

    • credentials.properties
    • credentials-enc.properties
    • groups.properties
    • login.config
    • users.properties
  3. 是否simpleAuthenticationPlugin使这些文件过时?

1个回答

在我回答这个问题时,这个问题已经 2 岁了,所以我的回答可能包括自发布之日起发生的变化。先回答第二个问题:

credentials.properties     -> clear text passwords
credentials-enc.properties -> Encrypted passwords, if configured
groups.properties          -> a list of groups, and what users are members
login.config               -> a file to configure more advanced auth like ldap integration
users.properties           -> a list of user names.  

所以我在尝试自己弄清楚其中一些事情时发现了这个问题,所以我不是专家。但我会分享我学到的东西。

除了 login.config 之外的所有内容现在都无关紧要了。或者对我来说似乎是这样。如果您尝试配置 LDAP 集成,则必须处理 login.config,但除此之外......我认为这也是无关紧要的。当我惹到他们时会做的事情:

jetty-realm.properties 这是“开箱即用”的重要一项。它的格式如下:

userName: securePassword, nameOfGroupUserIsMemberOf

因此,如果您希望“foouser”用户使用密码“barpasswd”,并成为“buzgroup”组的成员,则此文件需要一行:

foouser: barpaaswd, buzgroup

好的,那么 ActiveMQ 是如何知道调用这个文件的呢?默认情况下是在文件中配置的:jetty.xml 这是一个非常重要的文件。我为 LDAP 集成找到的许多说明都建议更改此文件......但我无法让它工作。如果我弄明白了,我会修改这个帖子。另一个重要的文件是:activemq.xml 在这篇文章的时候,官方文档建议修改这个文件有几个原因。其中之一是用于 LDAP 集成......但据我所知,这些说明不起作用。上面,您发现将此文件更改为硬编码用户帐户。我认为他们包括这个是为了向后兼容,但我不确定。

现在我来回答第一个问题。一旦你在 jetty-realm.properties 中配置了用户,你就可以为 activemq.xml 配置权限。

一个例子: https://svn.apache.org/repos/asf/activemq/trunk/activemq-unit-tests/src/test/resources/org/apache/activemq/security/jaas-broker.xml 你可以看到它在授权地图部分...

更多有兴趣的人注意:

当我按照说明加密密码时,服务停止加载。原因似乎是文件“credentials-enc.properties”的格式。当我重新格式化为“jetty-realm.properties”时,服务会加载,但会忽略加密密码。乐趣。我尝试将加密密码放在“jetty-realm.properties”中,不高兴。

我可以让 activemq 加密和解密文本,但请注意文档说只支持字母数字。没有空格,没有别的。

另外,我将提供指向我找到的页面的链接,但它们都存在冲突,除了默认设置外,我几乎没有什么可做的。

我对 LDAP 集成的了解:如果您使用 JAAS,请不要尝试使用较新的版本。不要尝试像他们在其中一些链接中建议的那样使用 jetty-plus。

https://www.middlewareinventory.com/blog/active-mq-installation-and-security-setup-and-hardening-step-by-step/ https://activemq.apache.org/encrypted-passwords.html http ://activemq.apache.org/cached-ldap-authorization-module.html http://activemq.apache.org/security.html https://stackoverflow.com/questions/52686757/activemq-web-console-using -ldap-active-directory-authentication/55244956#55244956 https://bacedifo.blogspot.com/2013/06/securing-activemq-580-web-console-using.html https://steamingpileofsoftware.blogspot.com/2013 /10/secure-your-jetty-activemq-web-console.html