ActiveMQ5.5安全配置分两种:控制台安全配置和JMS服务安全配置》(程序访问ActiveMQ时的安全设置)
1.控制台安全配置
打开conf/jetty.xml文件,找到
<bean id="securityConstraint" class="org.eclipse.jetty.http.security.Constraint">
<property name="name" value="BASIC" />
<property name="roles" value="admin" />
<property name="authenticate" value="false" />
</bean>
将"false" 改为"true",重启ActiveMQ 即可。控制台的登录用户名密码保存在conf/credentials.properties文件中。
2.JMS服务安全配置
方法一:
在conf/activemq.xml文件中加上
a)<plugins>
<!--use JAAS to authenticate using the login.config file on the classpath to configure JAAS -->
<jaasAuthenticationPlugin configuration="activemq-domain" />
<!-- lets configure a destination based authorization mechanism -->
<authorizationPlugin>
<map>
<authorizationMap>
<authorizationEntries>
<!-->表示通配符,例如USERS.>表示以USERS.开头的主题,>表示所有主题,read表示读的权限,write表示写的权限,admin表示角色组-->
<authorizationEntry queue=">" read="admins" write="admins" admin="admins" />
<authorizationEntry topic=">" read="admins" write="admins" admin="admins" />
<authorizationEntry queue="ActiveMQ.Advisory.>" read="admins" write="admins" admin="admins" />
<authorizationEntry topic="ActiveMQ.Advisory.>" read="admins" write="admins" admin="admins" />
</authorizationEntries>
</authorizationMap>
</map>
</authorizationPlugin>
</plugins>
b)在conf目录下增加login.config,groups.properties,users.properties
login.config 内容如下:
activemq-domain {
org.apache.activemq.jaas.PropertiesLoginModule required
debug=true
org.apache.activemq.jaas.properties.user="users.properties"
org.apache.activemq.jaas.properties.group="groups.properties";
};
groups.properties 内容如下:
#group=userName
admins=system
users.properties 内容如下:
#userName=password
system=manager
方法二:
在conf/activemq.xml文件中加入以下内容即可:
<plugins>
<!-- Configure authentication; Username, passwords and groups -->
<simpleAuthenticationPlugin>
<users>
<authenticationUser username="system" password="${activemq.password}" groups="users,admins"/>
<authenticationUser username="user" password="${guest.password}" groups="users"/>
<authenticationUser username="guest" password="${guest.password}" groups="guests"/>
</users>
</simpleAuthenticationPlugin>
</plugins>
此方法配置中的占位符的值可在conf/jetty-realm.properties 中设置
注意:按照官网资料http://activemq.apache.org/xml-reference.html
【To avoid this XML validation error in ActiveMQ 5.4/5.5, simply change the ordering of the XML elements so that they are in alphabetical order。】此配置文件中是按英文字母顺序排列。所以<plugins><plugins/>必须放在<systemUsage>与<managementContext>之间
groups.propert 文件定义了组下面的用户。
users.properties 文件定义了用户名对应的密码。
分享到:
相关推荐
activemq 配置的相关文档,助你完善activeMQ的配置
activemq 5.5.0的源代码,很全,对于研究activemq的人,很有帮助
apache-activemq-5.5.1apache-activemq-5.5.1apache-activemq-5.5.1apache-activemq-5.5.1
activemq服务器及spring简单模板项目
ActiveMQ5.13 安装与配置
NULL 博文链接:https://baobeituping.iteye.com/blog/407104
activeMQ 入门测试源码
activemq服务器使用的zookeeper replicable 的方式进行负载均衡以及容灾,客户端使用spring进行配置
Linux下,图解ActiveMQ 5.12.1 安装与配置
linux下activemq安装包和配置文档
ActiveMQ安装及配置文档介绍了ActiveMQ的安装过程和配置。让新手踏入JMS的门槛。
官网下载实在太慢.................
ActiveMQ spring 配置方案详解。
Spring集成ActiveMQ配置
spring activeMQ demo 配置
配置zk集群和mq集群的步骤,以及配置参数。
基于 IP 验证和授权插件的源码及jar,jar包可直接拷贝至activemq 目录下的 lib 目录下,打开activemq\conf\activemq.xml,在 broker 节点中加入: <plugins> ...
用于ACtiveMq 配置插件配置使用,配置介绍等,适合初学者
ActiveMQ5.13安装与配置[定义].pdf
ActiveMQ配置说明,包括java内存调整,主从集群配置,自动清理离线客户端(避免长时间持久订阅占用内存)等