【问题标题】:Jolokia access with custom JAAS使用自定义 JAAS 访问 Jolokia
【发布时间】:2020-06-13 23:02:42
【问题描述】:

在 ActiveMQ Artemis 中,当我将 requisiterequired 标志与我的自定义 JAAS 登录模块一起使用时,我无法登录到 Artemis 管理控制台(Jolokia,端口 8163)。我在对移动设备进行身份验证的自定义 JAAS 登录模块中有特殊的业务逻辑。但同时我希望有一个管理员用户可以使用一些用户名/密码甚至没有密码登录到 Artemis 管理控制台。为了在 Artemis login.config 中同时拥有自定义和访客登录模块,我必须至少将自定义 JAAS 模块的安全标志保留为 sufficient。我该如何处理这种情况?

【问题讨论】:

    标签: security jaas activemq-artemis


    【解决方案1】:

    Hawtio 使用的安全“领域”是通过etc/artemis.profile 中设置的hawtio.realm 系统属性配置的。例如,这里是默认值:

    JAVA_ARGS=" -XX:+PrintClassHistogram -XX:+UseG1GC -Xms512M -Xmx2G -Dhawtio.realm=activemq  -Dhawtio.offline=true -Dhawtio.role=amq -Dhawtio.rolePrincipalClasses=org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal -Djolokia.policyLocation=${ARTEMIS_INSTANCE_ETC_URI}jolokia-access.xml -Djon.id=amq"
    

    这里hawtio.realm 设置为activemq,它与默认login.config 中的条目匹配,例如:

    activemq {
       org.apache.activemq.artemis.spi.core.security.jaas.PropertiesLoginModule sufficient
           debug=false
           reload=true
           org.apache.activemq.jaas.properties.user="artemis-users.properties"
           org.apache.activemq.jaas.properties.role="artemis-roles.properties";
    
       org.apache.activemq.artemis.spi.core.security.jaas.GuestLoginModule sufficient
           debug=false
           org.apache.activemq.jaas.guest.user="myUser"
           org.apache.activemq.jaas.guest.role="amq";
    };
    

    我看不出有任何理由为什么您不能将专门用于 Hawtio 的新领域/域添加到您的 login.config,然后更改 artemis.profile 中的配置以引用它。这样您就可以根据需要自定义 Hawtio 连接和消息连接的安全性。

    此外,值得注意的是,Artemis 最近增加了对每个接受者安全域的支持。您可以在the documentation 中阅读更多相关信息。

    【讨论】:

    • 非常感谢贾斯汀。我缺少领域设置,这行得通。
    猜你喜欢
    • 1970-01-01
    • 2013-08-21
    • 2012-03-30
    • 1970-01-01
    • 1970-01-01
    • 2012-10-03
    • 2016-02-03
    • 2013-01-09
    • 1970-01-01
    相关资源
    最近更新 更多