jmx-console登录

参考:http://xiaoboss.iteye.com/blog/1113464

Jmx-console登录用户名密码设置:
默认情况下不需要用户名密码,但是存在安全隐患。
Jboss用户名密码设置步骤如下:
1. %JBOSS_HOME%/server/default/deploy/jmx-console.war/WEB-INF/jboss-web.xml中去掉<security-domain>java:/jaas/jmx-console</security-domain>的注解。
2. 同级目录下的web.xml中去掉security-constraint注解。
  <!-- A security constraint that restricts access to the HTML JMX console
   to users with the role JBossAdmin. Edit the roles to what you want and
   uncomment the WEB-INF/jboss-web.xml/security-domain element to enable
   secured access to the HTML JMX console.
   -->
  <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>
3. 在第一步中的jmx-console安全域和第二步中的运行角色JBossAdmin都是在login-config.xml中配置。
在%JBOSS_HOME%/server/default/config/login-config.xml中
 
  <!-- A template configuration for the jmx-console web application. This
    defaults to the UsersRolesLoginModule the same as other and should be
    changed to a stronger authentication mechanism as required.
  -->
  <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和jmx-console-roles.properties文件中配置
jmx-console-users.properties中:
# A sample users.properties file for use with the UsersRolesLoginModule
admin=admin
可以通过修改来改变密码admin=passweord
jmx-console-roles.properties中:
# A sample roles.properties file for use with the UsersRolesLoginModule
admin=JBossAdmin,HttpInvoker

猜你喜欢

转载自bingqianer.iteye.com/blog/2150035
JMX