目前我在ActiveMQ中配置了远程连接。对于代理配置,我们需要提供
jmx.access
和 jmx.password
纯文本文件。
<broker useJmx="true" persistent="false" xmlns="http://activemq.apache.org/schema/core">
...
<managementContext>
<managementContext createConnector="true">
<property xmlns="http://www.springframework.org/schema/beans" name="environment">
<map xmlns="http://www.springframework.org/schema/beans">
<entry xmlns="http://www.springframework.org/schema/beans" key="jmx.remote.x.password.file" value="/conf/jmx.password"/>
<entry xmlns="http://www.springframework.org/schema/beans" key="jmx.remote.x.access.file" value="/conf/jmx.access"/>
</map>
</property>
</managementContext>
</managementContext>
...
</broker>
现在我想写我自己的JAAS登录模块来支持加密密码和访问文件。
我创建了一个
login.config
文件,我在其中添加了自定义登录模块以在进行身份验证时加载。
MyLoginModule {
com.common.security.authentication.EncryptedLoginModule REQUIRED;
};
我修改了
activemq.xml
以添加这个JAAS登录模块。
<plugins>
<jaasAuthenticationPlugin configuration="MyLoginModule" />
</plugins>
但是,当我尝试登录时,它仍然使用
FileLoginModule
而不是EncryptedLoginModule
中提供的login.config
。
如果您使用的是 ActiveMQ“Classic”,我认为没有办法为 JMX 和消息传递用户共享凭据。据我所知,提供给
managementContext
的密码文件将由 JVM 提供的 MBean 服务器实现独占使用。有一些钩子可以改变它(例如JMXAuthenticator
),但这不是由 ActiveMQ“Classic”实现的。
值得注意的是 ActiveMQ Artemis 确实 实现了这些挂钩,以便 JMX 用户 和 消息传递用户都通过相同的 JAAS 登录模块进行身份验证。此外,默认配置支持加密密码。