zoukankan      html  css  js  c++  java
  • Jboss Jmx-Console和 Jboss web-console安全设置

    1、介绍

          如果你暴露你的JBoss服务器通过网络(如通过启动服务器使用选项B 0.0.0.0或者通过改变jboss.bind.address首次出现0.0.0.0在.../jboss/server/default/deploy/web-deployer/server.xml)你自动也暴露了Jboss web控制台(http://localhost:8080/jmx-console)因为管理员工具没有任何用户和密码。

    注意:在下面的设置例子中,为默认的jboss服务器配置被使用。

    2、jmx-console安全设置

    2.1、在../jboss/server/default/deploy/jmx-console.war/WEB-INF/jboss-web.xml 取消如下注释:

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

    2.2、在../jboss/server/default/deploy/jmx-console.war/WEB-INF/web.xml 取消如下注释:

    1. <security-constraint>  
    2.    <web-resource-collection>  
    3.      <web-resource-name>HtmlAdaptor</web-resource-name>  
    4.      <description>An example security config that only allows users with the  
    5.        role JBossAdmin to access the HTML JMX console web application  
    6.      </description>  
    7.      <url-pattern>/*</url-pattern>  
    8.      <http-method>GET</http-method>  
    9.      <http-method>POST</http-method>  
    10.    </web-resource-collection>  
    11.    <auth-constraint>  
    12.      <role-name>JBossAdmin</role-name>  
    13.    </auth-constraint>  
    14.  </security-constraint>  
      <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>

    2.3、在..../jboss/server/default/conf/props/jmx-console-users.properties 添加或者编辑 admin=a_password_you_like

    指定一个不同的用户对jbossadmin组添加“用户名= jbossadmin”到jmx-console-roles.properties.properties文件(同一目录)。

    现有的jmx-console-users.properties文件与密码admin管理用户。为了安全,删除用户或更改密码更强的人。

    3、web-console安全设置

    3.1、在.../jboss/server/default/deploy/management/console-mgr.sar/web-console.war/WEB-INF/jboss-web.xml 取消如下注释:

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

    3.2、在../jboss/server/defualt/deploy/management/console-mgr.sar/web-console.war/WEB-INF/web.xml取消如下注释:

    1. <security-constraint>  
    2.    <web-resource-collection>  
    3.    <web-resource-name>HtmlAdaptor</web-resource-name>  
    4.    <description>An example security config that only allows users with the  
    5.    role JBossAdmin to access the HTML JMX console web application  
    6.    </description>  
    7.    <url-pattern>/*</url-pattern>  
    8.    <http-method>GET</http-method>  
    9.    <http-method>POST</http-method>  
    10.    </web-resource-collection>  
    11.    <auth-constraint>  
    12.    <role-name>JBossAdmin</role-name>  
    13.    </auth-constraint>  
    14.    </security-constraint>  
    <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>


    3.3、在.../jboss/server/default/deploy/management/console-mgr.sar/web-console.war/WEB-INF/classes/web-console-users.properties 添加或者编辑行admin=a_password_you_like

    指定一个不同的用户对jbossadmin组添加“用户名= jbossadmin”到web-console-roles.properties.properties文件(同一目录)。

    现有的web-console-users.properties文件与密码admin管理用户。为了安全,删除用户或更改密码更强的人。

    4、实例

    4.1、jmx-console安全配置

    第一步:打开jboss/server/default/deploy/jmx-console.war/WEB-INF目录下jboss-web.xml文件,添加security-domain,如下图-1所示:

    图-1

    第二步:同级目录打开web.xml,添加如下代码,如下图-2所示:

    图-2

    同时查看对应的角色是否存在,如下图-3所示:

    图-3

    第三步:打开jboss/server/default/conf目录下login-config.xml文件,如下下图-4所示:

    图-4

    在按照上图中路径找到如下文件,如下图-5所示:

    图-5

    打开users相关文档,更改admin的密码为etim123$%^,如下图-6所示:

    图-6

    4.2、web-console的安全设置

    第一步:打开如下图所示目录下的jboss-web.xml。

    打开jboss-web.xml添加如下内容:

    打开同级目录下的web.xml,添加如下内容:

    如下图所示路径,修改文件名称为roles.properties和users.properties

    打开修改过后的users.properties配置文件,如下图所示:

    打开如下路径的login-config.xml,修改为users.properties

    更改为如下图所示

    保存成功后,启动服务器输入:http://localhost:8080/jmx-consolehttp://localhost:8080/web-console测试安全机制,是否和自己修改后的账号信息一致。

  • 相关阅读:
    Android开发笔记——WebView
    字符串_最小表示法求循环串的最小序列(HDU_4162)
    STL_map简单应用(HDU_1075)
    DP_最大子序列和(HDU_1003)
    STL map 使用方法(转)
    数学_线性筛法建立素数表(HDU_1262)
    學習筆記 ADO數據庫訪問技術
    C#多线程学习
    Java容器
    选取单元格的基本语句
  • 原文地址:https://www.cnblogs.com/firstdream/p/9099393.html
Copyright © 2011-2022 走看看