你好,一项任务:对于每个用户,给出操作的权限(列表、获取、浏览等等)只在他们的地址上。地址的权限在broker.xml中发布。
目前,任何具有浏览角色的用户都可以从任意地址读取消息。
引发具有域身份验证的Artemis集群。我们通过broker.xml向域用户的地址颁发权限。我们希望使域用户能够通过web管理他们的地址/队列。授予artemis.profile配置中的域用户组的权限,所有域用户都可以访问web。
授予域用户组对management.xml文件中的方法的权限,所有域用户都可以在所有队列中使用允许的方法,包括浏览方法(允许您读取消息)。
是否有可能限制web中的访问,以便域用户只能在其队列上使用允许的方法(在broker.xml中授予权限),或者您是否需要为management.xml中的每个队列指定方法块(您可以使用掩码),并授予方法单独组的权限?
发布于 2022-09-16 01:05:26
一般来说,ActiveMQ Artemis支持基于角色的访问控制(即RBAC),因此每个需要唯一权限的用户都需要处于一个独特的角色中。
ActiveMQ Artemis中的web控制台基于Hawtio,它使用Jolokia ( JMX桥)与代理中的JMX MBeans进行通信。在etc/management.xml中配置了对Jolokia的授权。以下是默认内容:
<management-context xmlns="http://activemq.apache.org/schema">
<!--<connector connector-port="1099"/>-->
<authorisation>
<allowlist>
<entry domain="hawtio"/>
</allowlist>
<default-access>
<access method="list*" roles="amq"/>
<access method="get*" roles="amq"/>
<access method="is*" roles="amq"/>
<access method="set*" roles="amq"/>
<access method="*" roles="amq"/>
</default-access>
<role-access>
<match domain="org.apache.activemq.artemis">
<access method="list*" roles="amq"/>
<access method="get*" roles="amq"/>
<access method="is*" roles="amq"/>
<access method="set*" roles="amq"/>
<!-- Note count and browse are need to access the browse tab in the console-->
<access method="browse*" roles="amq"/>
<access method="count*" roles="amq"/>
<access method="*" roles="amq"/>
</match>
<!--example of how to configure a specific object-->
<!--<match domain="org.apache.activemq.artemis" key="subcomponent=queues">
<access method="list*" roles="view,update,amq"/>
<access method="get*" roles="view,update,amq"/>
<access method="is*" roles="view,update,amq"/>
<access method="set*" roles="update,amq"/>
<access method="*" roles="amq"/>
</match>-->
</role-access>
</authorisation>
</management-context>domain和key基于代理上JMX MBean的名称。例如,代理“MBean”上地址"myAddress“上名为"myQueue”的anycast队列的名称是:
org.apache.activemq.artemis:broker=myBroker,component=addresses,address="myAddress",subcomponent=queues,routing-type="anycast",queue="myQueue"因此,如果您只希望角色"myRole“中的用户能够浏览队列"myQueue”上的消息,那么您将得到如下匹配:
<match domain="org.apache.activemq.artemis" key="queue=myQueue">
<access method="list*" roles="myRole"/>
<access method="get*" roles="myRole"/>
<access method="is*" roles="myRole"/>
<access method="set*" roles="myRole"/>
<access method="browse*" roles="myRole"/>
<access method="count*" roles="myRole"/>
<access method="*" roles="myRole"/>
</match>请记住,默认情况下,只有通过具有amq角色的用户才允许对控制台的访问。这是通过系统属性etc/artemis.profile在-Dhawtio.role=amq中配置的。您可以通过将其更改为-Dhawtio.roles=amq,myRole来配置多个角色。
您可以在文献资料中找到更多细节。
https://stackoverflow.com/questions/73732151
复制相似问题