首页 > java > Jboss6安全配置

Jboss6安全配置

2011年8月5日 亲亲宝宝 发表评论 阅读评论

jboss默认配置了以下服务:

* Administration Console

* JMX Console

* JBoss Web Services Console

为了安全起见,需要用户通过授权进行访问。默认只有Administration Console需要输入用户名和密码,默认用户名和密码都是admin。后面两项需要启用安全检查,Administration Console和JMX Console 默认使用的是同一用户和角色,因此这两个只需要修改一次密码。

一、JMX安全配置

第一步:找到jboss-6.0.0.Final\common\deploy\jmx-console.war\WEB-INF \jboss-web.xml文件,根据说明,去掉注释。

xml 代码

<jboss-web>

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

</jboss-web>

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

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>

</web-resource-collection>

<auth-constraint>

<role-name>JBossAdmin</role-name>

</auth-constraint>

</security-constraint>

第三步:在第一步中的jmx-console安全域和第二步中的运行角色JBossAdmin都是在jboss-6.0.0.Final\server\default\conf\login-config.xml中配置,查找jmx-console

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定义了用户所属角色。

第四步:修改密码

打开jboss-6.0.0.Final\server\default\conf\props\ jmx-console-users.properties,自行修改密码。

二、WEB-CONSOLE的安全配置

第一步:根据说明,去掉文件注释jboss-6.0.0.Final/ common\deploy\jbossws-console.war\WEB-INF/jboss-web.xml。

xml 代码

<jboss-web>

<!– A security domain that restricts access  –>

<security-domain>java:/jaas/JBossWS</security-domain>

<context-root>jbossws</context-root>

</jboss-web>

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

xml 代码

<security-constraint>

<web-resource-collection>

<web-resource-name>ContextServlet</web-resource-name>

<description>An example security config that only allows users with the

role ‘friend’ to access the JBossWS console web application

</description>

<url-pattern>/*</url-pattern>

</web-resource-collection>

<auth-constraint>

<role-name>friend</role-name>

</auth-constraint>

</security-constraint>

第三步:在第一步中的JBossWS安全域和第二步中的运行角色friend都是在jboss-6.0.0.Final\server\default\conf\login-config.xml中配置,查找JBossWS

xml 代码

<application-policy>

<authentication>

<login-module code=”org.jboss.security.auth.spi.UsersRolesLoginModule”

flag=”required”>

<module-option name=”usersProperties”>props/jbossws-users.properties</module-option>

<module-option name=”rolesProperties”>props/jbossws-roles.properties</module-option>

<module-option name=”unauthenticatedIdentity”>anonymous</module-option>

</login-module>

</authentication>

</application-policy>

第四步:修改密码

打开jboss-6.0.0.Final\server\default\conf\props/jbossws-users.properties,自行修改密码。

启动服务输入http://localhost:8080/

然后分别点击JMX Console以及Jboss Web Console测试安全机制

分类: java 标签: 84,715 次阅读
原文链接:http://www.wenhq.com/article/view_708.html
欢迎转载,请注明出处:亲亲宝宝
  1. 2011年8月17日16:13 | #1

    精彩文章给力雄厚,辛苦了博主我先拿走了以后常来支持

    [回复]

  1. 本文目前尚无任何 trackbacks 和 pingbacks.