ActiveMQ安全和权限配置

目录

一、管理页登录默认密码修改

1、默认登录地址及端口

2、修改页面管理端登录用户密码

二、队列和Topic连接权限配置

1、ActiveMQ安全机制的介绍

2. Simple authentication plugin-in配置

3. JAAS authentication plugin-in配置

三、注意

1、标点符号

2、simpleAuthenticationPlugin用户不生效




一、管理页登录默认密码修改

我这里以windows演示

1、默认登录地址及端口

Windows启动:双击apache-activemq-5.15.12\bin\win64\activemq.bat启动

Linux启动:apache-activemq-5.15.9/bin/linux-x86-64下,使用命令

 ./activemq start

默认使用端口为8161(管理端口)、61616(用于创建消息与消费消息)、61614(用于前端stomp连接)。

启动activemq后,默认的管理端页面地址:http:ip:port/8161/admin

ActiveMQ安全和权限配置_第1张图片

2、修改页面管理端登录用户密码

管理页用户数据配置文件地址:apache-activemq-5.15.12\conf\jetty-realm.properties

第一列是用户名,第二列是密码,第三列是角色,修改后重启

二、队列和Topic连接权限配置

1、ActiveMQ安全机制的介绍

安全机制一般包含验证(Authentication)和授权(Authorization)两部分。在ActiveMQ中,验证指通过访问者的用户名和密码实现用户身份的验证,授权指为消息目标(队列或主题)的读、写、管理指定具有相应权限的用户组,并为用户分配权限。ActiveMQ的安全机制基于插件实现。

ActiveMQ提供两种验证插件

1)Simple authentication plugin-in;

2)JAAS(Java Authentication and Authorization Service)authentication plugin-in。ActiveMQ提供一种授权插件:Authorization plugin-in。

2. Simple authentication plugin-in配置

在activemq.xml中如下配置:


    
        
            
        
     

节点通过子节点定义用户、密码、组信息;其中groups信息用于验证授权,用户信息可以从conf/credentials.properties中通过${}进行获得。

3. JAAS authentication plugin-in配置

在activemq.xml中如下配置:

我的配置里guests用户组只有读权限,users是读写权限


 
	
        
            
                
                    
 
			
															
			 
			 
                    
                    
                                                                 
                    
                
           
    

节点通过Java Authentication Authorization Service进行用户验证及授权操作;其中configuration=“activemq”中的activemq要与conf/login.config中节点名称对应,内容如下;

users.properties和groups.properties文件里,包含用户和用户组信息,reload=ture更新用用户信息可以动态加载。

activemq {
    org.apache.activemq.jaas.PropertiesLoginModule required
    org.apache.activemq.jaas.properties.user="users.properties"
    org.apache.activemq.jaas.properties.group="groups.properties"
    reload=true;
};

 

users.properties:

admin=admin
user=user
guest=guest

groups.properties:

admins=admin
users=user,develop,sslclient
tempDestinationAdmins=system,user,sslclient,client,broker1,broker2
guests=guest

重启activemq即可生效,对用户的读写权限进行了控制。

三、注意

1、标点符号

修改conf/login.config这里小心标点符号,否则不生效(我就是因为org.apache.activemq.jaas.properties.group="groups.properties"后多了个分号,导致配置一直不生效)。

2、simpleAuthenticationPlugin用户不生效

simpleAuthenticationPlugin和jaasAuthenticationPlugin 可以同时配置,但是配置后,里的用户配置不生效的,这里需要注意;

下边是不加的配置


     
        
            
            
            
        
     
     
        
            
                
                    
 
			
															
			 
			 
                    
                    
                                                                 
                    
                
           
    

 

你可能感兴趣的:(activemq权限配置)