ActiveMQ的安全配置
来源:互联网 发布:seo sem 新媒体 电商 编辑:程序博客网 时间:2024/06/05 06:42
前些天,我们系统需要使用ActiveMQ传递一些非常重要的消息,但是考虑到如果只是有个broker地址就能接收到消息感觉太不安全了,就给ActiveMQ加上了一些安全配置,如下:
1、控制台安全配置(也就是用户在网页浏览器打开192.168.10.40:8161/admin这个地址的时候,需要用户输入用户名/密码),打开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”即可。用户名和密码存放在conf/jetty-realm.properties文件中。
2、生产者和消费者连接ActiveMQ需要用户名、密码
(1)在工程的xml配置文件中配置连接工厂的用户名和密码:
<bean id="connectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" destroy-method="stop">
<property name="connectionFactory">
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL">
<value>${jms.brokerURL}</value>
</property>
<property name="useAsyncSend">
<value>true</value>
</property>
<property name="userName">
<value>${activemq.name}</value>
</property>
<property name="password">
<value>${activemq.pass}</value>
</property>
</bean>
</property>
</bean>
(2) 打开conf/activemq.xml文件,在<broker>标签里的<systemUsage>标签前加入:
<plugins>
<simpleAuthenticationPlugin>
<users>
<authenticationUser username="${activemq.username}" password="${activemq.password}" groups="users,admins"/>
</users>
</simpleAuthenticationPlugin>
</plugins>
注意必须在<systemUsage>标签前,否则启动ActiveMQ会报错。
<plugins>
<simpleAuthenticationPlugin>
<users>
<authenticationUser username="${activemq.username}" password="${activemq.password}" groups="users,admins"/>
</users>
</simpleAuthenticationPlugin>
</plugins>
<systemUsage>
<systemUsage>
<memoryUsage>
<memoryUsage percentOfJvmHeap="70" />
</memoryUsage>
<storeUsage>
<storeUsage limit="100 gb"/>
</storeUsage>
<tempUsage>
<tempUsage limit="50 gb"/>
</tempUsage>
</systemUsage>
</systemUsage>
用户名和密码存放在conf/credentials.properties文件中
- ActiveMQ的安全配置
- ActiveMQ的安全配置(九)
- ActiveMQ 5.x 的安全配置
- ActiveMQ 5.x 的安全配置
- ActiveMQ 5.x 的安全配置
- ActiveMQ 安全配置
- activeMQ的安全机制
- activeMQ安全配置及常见问题解决
- ActiveMq的配置
- ActiveMQ的XML配置
- ActiveMQ的安全性配置
- spring+activemq的配置
- ActiveMQ的安全性配置
- ActiveMQ的简单配置
- 关于ActiveMQ的配置
- spring+activemq的配置
- 关于ActiveMQ的配置
- 关于ActiveMQ的配置
- WebService:简介
- 字节对齐
- NumPy学习 -- 001_数组
- C++11 元编程 判断是否有std::hash<T>特例并提供hash函数通用实现
- Linux日志系统(Logcheck)的安装预配置
- ActiveMQ的安全配置
- 图解Android - Zygote, System Server 启动分析
- php foreach 意外情况简述
- 测试
- 安装g++
- WebService:JDK发布service
- Oracle数据库-建库、建表空间,建用户
- Service的两种启动方式及其之间的区别
- FMDB的简单使用