读书人

JBoss 保险保护

发布时间: 2012-10-27 10:42:26 作者: rapoo

JBoss 安全保护

?

?

JBoss服务器差不多每一个方面都可以用JMX或Web控制台来控制,所以你至少要确保它有密码保护的。否则,任何远程用户都可以控制你的服务器,为了保护它,我们将添加一个安全域。

?

假设你启动的服务器是用default配置集

?

1、为JMX Console设置密码保护

?

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

?

这一步只是把安全域链接至web应用程序

?

?

<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>

?

这一步告诉web应用程序执行那个安全策略,保护那个URL以及允许谁访问,但是用户名和密码从来哪里来?

在%JBOSS_HOME%\server\default\conf\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>

?

?

?

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

?

?

<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>

?

?? <application-policy name = "web-console">

?????? <authentication>

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

???????????? flag = "required">

???????????? <module-option name="usersProperties">web-console-users.properties</module-option>

???????????? <module-option name="rolesProperties">web-console-roles.properties</module-option>

????????? </login-module>

????? ?</authentication>

??? </application-policy>

?它的存放路径是放在跟login-config.xml一个目录下的,如果没有这两个文件,可以自己创建对应名称的文件,配置跟jmx-console一样。

?

?

读书人网 >操作系统

热点推荐