Jboss中的web-console与jmx-console的配置
JBoss安装成功后,一般可以通过http://localhost:port来访问.Jmx Console和Jboss Web Console 里面可以修改和删除应用的参数,如果不加强安全设置,将会带来严重安全后果。
默认登录jmx-console的账号信息是:admin/admin,因此我们应该修改这个账号信息。
一、JMX安全配置
1: 找到%JBOSS_HOME%/server/default/deploy/jmx-console.war/WEB-INF/jboss-web.xml文件,去掉对下面这段xml文本的注释。
Xml代码
<jboss-web> <security-domain>java:/jaas/jmx-console</security-domain> </jboss-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>
<!--此处应与jboss-web.xml文件中的<security-domain>java:/jaas/jmx-console</security-domain> 一致 --><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-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>
<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>
Failed to load users/passwords/role filesjava.io.IOException: No properties file: users.properties or defaults: defaultUsers.properties found