打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
JBOSS的安全配置--『爪洼橙树园』

JBOSS的安全配置

Posted on 2007-06-22 11:46 Stephen Wong 阅读(48) 评论(0)  编辑 收藏 引用 网摘 所属分类: Web 部署安全验证 / 角色权限JavaJ2EE

版本:JBoss 4.0.5GA

jboss默认配置了以下服务:
  JMX Console
  JBoss Web Console
为了安全起见,需要用户通过授权进行访问。
一、JMX安全配置
STEP 1:
    找到%JBOSS_HOME%/server/default/deploy/jmx-console.war/WEB-INF/jboss-web.xml文件,根据说明,去掉注释。

<jboss-web>   
   
<security-domain>java:/jaas/jmx-console</security-domain>   
</jboss-web>   

STEP 2:
    与jboss-web.xml同级目录下还有一个文件web.xml,找到其中的节点,根据说明,取消注释。

<security-constraint>   
     
<web-resource-collection>   
       
<web-resource-name>HtmlAdaptor</web-resource-name>   
       
<description>An example security config that only allows users with the    
         role JBossAdmin to access the HTML JMX console web application    
       
</description>   
       
<url-pattern>/*</url-pattern>   
       
<http-method>GET</http-method>   
       
<http-method>POST</http-method>   
     
</web-resource-collection>   
     
<auth-constraint>   
       
<role-name>JBossAdmin</role-name>   
     
</auth-constraint>   
</security-constraint>   

STEP 3:
    在第一步中的jmx-console安全域和第二步中的运行角色JBossAdmin都是在login-config.xml中配置,我们在%

<application-policy name = "jmx-console">   
       
<authentication>   
          
<login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"   
             flag 
= "required">   
           
<module-option name="usersProperties">props/jmx-console-users.properties</module-option>   
           
<module-option name="rolesProperties">props/jmx-console-roles.properties</module-option>   
          
</login-module>   
       
</authentication>   
    
</application-policy>   

文件props/jmx-console-users.properties定义了用户名、密码;props/jmx-console-roles.properties定义了用户所属角色

注:
jmx-console-users.properties 格式是:用户名=密码明文
jmx-console-roles.properties 格式是:用户名=角色1,角色2,角色3

二、WEB-CONSOLE的安全配置
STEP 1:
找到%JBOSS_HOME%/server/default/deploy/ management/console-mgr.sar/web-console.war/WEB-INF/jboss-web.xml文件,根据说明,去掉注释。

<jboss-web>   
   
<depends>jboss.admin:service=PluginManager</depends>   
</jboss-web> 

STEP 2:
与jboss-web.xml同级目录下还有一个文件web.xml,找到其中的节点,根据说明,取消注释。


<security-constraint>   
   
<web-resource-collection>   
   
<web-resource-name>HtmlAdaptor</web-resource-name>   
   
<description>An example security config that only allows users with the    
   role JBossAdmin to access the HTML JMX console web application    
   
</description>   
   
<url-pattern>/*</url-pattern>   
   
<http-method>GET</http-method>   
   
<http-method>POST</http-method>   
   
</web-resource-collection>   
   
<auth-constraint>   
   
<role-name>JBossAdmin</role-name>   
   
</auth-constraint>   
   
</security-constraint>   

STEP 3:
在本目录的classes文件夹下找到web-console-users.properties和web-console-roles.properties两个文件更名为:

<application-policy name = "web-console">   
       
<authentication>   
          
<login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"   
             flag 
= "required">   
             
<module-option name="usersProperties">users.properties</module-option>   
             
<module-option name="rolesProperties">roles.properties</module-option>   
          
</login-module>   
       
</authentication>   
</application-policy>   

启动服务输入http://localhost:8080/
 然后分别点击JMX Console以及Jboss Web Console测试安全机制

user.properties和role.propertie并修改users.properties其中的用户名和密码修改%JBOSS_HOME%/server/default/conf/login-config.xml中web-console节点修改为以下:
到后自行修改或重新定义用户名、密码。JBOSS_HOME%/server/default/config下找到它。查找名字为:jmx-console的application-policy:

然后分别点击jmx console以及jboss web console测试安全机制

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
JAAS -数据库方式验证
Websphere5.1.x JAAS LDAP配置全攻略(1)
Securing the JBoss Server
JBOSS维护经验
jboss4配置
另一个Log4Shell?No!H2控制台 JNDI RCE(CVE-2021-42392)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服